Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
0ef9acd8ae
22 changed files with 261 additions and 153 deletions
|
|
@ -2358,30 +2358,12 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/comm/propal/list.php
|
||||
|
||||
-
|
||||
message: '#^Negated boolean expression is always true\.$#'
|
||||
identifier: booleanNot.alwaysTrue
|
||||
count: 1
|
||||
path: ../../../htdocs/commande/card.php
|
||||
|
||||
-
|
||||
message: '#^Right side of && is always true\.$#'
|
||||
identifier: booleanAnd.rightAlwaysTrue
|
||||
count: 2
|
||||
path: ../../../htdocs/commande/card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$classname might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 3
|
||||
path: ../../../htdocs/commande/card.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$object of method Orders\:\:_cleanObjectDatas\(\) expects object, array\<int, array\<string, int\|string\>\>\|int given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/commande/class/api_orders.class.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$socid might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -9846,12 +9828,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/fourn/card.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$object of method SupplierOrders\:\:_cleanObjectDatas\(\) expects object, array\<mixed\> given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: ../../../htdocs/fourn/class/api_supplier_orders.class.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$contact might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ return [
|
|||
// PhanPossiblyUndeclaredGlobalVariable : 6 occurrences
|
||||
// PhanTypeArraySuspiciousNull : 6 occurrences
|
||||
// PhanTypeComparisonFromArray : 6 occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 6 occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 5 occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 5 occurrences
|
||||
// PhanPluginDuplicateArrayKey : 4 occurrences
|
||||
// PhanParamTooMany : 3 occurrences
|
||||
// PhanPluginUndeclaredVariableIsset : 3 occurrences
|
||||
|
|
@ -41,7 +41,6 @@ return [
|
|||
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/comm/mailing/targetemailing.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/comm/propal/list.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/commande/class/api_orders.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/commande/list.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'],
|
||||
|
|
@ -176,7 +175,6 @@ return [
|
|||
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/filefunc.inc.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/commande/card.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/facture/card-rec.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
|
|
|
|||
|
|
@ -303,6 +303,7 @@ foreach ($dirModMember as $dirroot) {
|
|||
|
||||
$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
|
||||
'@phan-var-force array<string,ModeleNumRefMembers> $arrayofmodules';
|
||||
/** @var array<string,ModeleNumRefMembers> $arrayofmodules */
|
||||
|
||||
foreach ($arrayofmodules as $file => $modCodeMember) {
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
|
@ -405,6 +406,7 @@ foreach ($dirmodels as $reldir) {
|
|||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
'@phan-var-force doc_generic_member_odt|pdf_standard_member $module';
|
||||
/** @var doc_generic_member_odt|pdf_standard_member $module */
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -237,14 +237,16 @@ if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
|
|||
print "</td></tr>\n";
|
||||
|
||||
// Force nature of member (mor/phy)
|
||||
$morphys = array();
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
$morphys = [
|
||||
"" => $langs->trans("MorAndPhy"), // for empty choice
|
||||
"phy" => $langs->trans("Physical"),
|
||||
"mor" => $langs->trans("Moral"),
|
||||
];
|
||||
print '<tr class="oddeven drag" id="trforcenature"><td>';
|
||||
print $langs->trans("ForceMemberNature");
|
||||
print '</td><td>';
|
||||
$forcenature = getDolGlobalInt('MEMBER_NEWFORM_FORCEMORPHY', 0);
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature, 1);
|
||||
$forcenature = getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY');
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCEMORPHY", $morphys, $forcenature);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Amount
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -26,22 +26,22 @@
|
|||
* \brief Page to output members business cards
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*
|
||||
* @var array<string,array{name:string,paper-size:string|array{0:float,1:float},orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:int,custom_x:float,custom_y:float}> $_Avery_Labels
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
|
||||
/** @var array<string,array{name:string,paper-size:string|array{0:float,1:float},orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:int,custom_x:float,custom_y:float}> $_Avery_Labels */
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php';
|
||||
|
||||
$langs->loadLangs(array("members", "errors"));
|
||||
|
||||
// Choice of printing year or current year.
|
||||
|
|
|
|||
|
|
@ -554,10 +554,11 @@ if ($action == 'create') {
|
|||
print '</td></tr>';
|
||||
|
||||
// Morphy
|
||||
$morphys = array();
|
||||
$morphys[""] = $langs->trans("MorAndPhy");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
$morphys = [
|
||||
"" => $langs->trans("MorAndPhy"), // for empty choice
|
||||
"phy" => $langs->trans("Physical"),
|
||||
"mor" => $langs->trans("Moral"),
|
||||
];
|
||||
print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
|
||||
print "</td></tr>";
|
||||
|
|
|
|||
|
|
@ -98,6 +98,10 @@ class Mailings extends DolibarrApi
|
|||
|
||||
$this->mailing->fetchObjectLinked();
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $this->mailing->fk_project))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->mailing);
|
||||
}
|
||||
|
||||
|
|
@ -112,6 +116,7 @@ class Mailings extends DolibarrApi
|
|||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $fk_projects Project ids to filter mass mailings (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i}
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'2016-01-01')"
|
||||
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
|
||||
* @param bool $pagination_data If this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
|
||||
|
|
@ -122,18 +127,27 @@ class Mailings extends DolibarrApi
|
|||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '', $pagination_data = false, $loadlinkedobjects = 0)
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $fk_projects = '', $sqlfilters = '', $properties = '', $pagination_data = false, $loadlinkedobjects = 0)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('mailing', 'read')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
$arrayProjects = explode(",", $fk_projects);
|
||||
foreach ($arrayProjects as $project => $value) {
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $value))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
}
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing AS t";
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('mailing').')';
|
||||
// Add sql filters
|
||||
if ($fk_projects) {
|
||||
$sql .= " AND t.fk_project IN (".$this->db->sanitize($fk_projects).")";
|
||||
} // Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
|
|
@ -224,6 +238,10 @@ class Mailings extends DolibarrApi
|
|||
throw new RestException(404, 'Mass mailing to clone not found, id='.$id);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $this->mailing->fk_project))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$cloningResult = $this->mailing->createFromClone(DolibarrApiAccess::$user, ((int) $id), ((int) $cloneContent), ((int) $cloneRecipients), ((int) $notrigger));
|
||||
if ($cloningResult < 0) {
|
||||
throw new RestException(500, "Error cloning mass mailing", array_merge(array($this->mailing->error), $this->mailing->errors));
|
||||
|
|
@ -262,9 +280,15 @@ class Mailings extends DolibarrApi
|
|||
$this->mailing->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
|
||||
continue;
|
||||
}
|
||||
if ($field === 'fk_project') {
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $value))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
}
|
||||
|
||||
$this->mailing->$field = $this->_checkValForAPI($field, $value, $this->mailing);
|
||||
}
|
||||
|
||||
if ($this->mailing->create(DolibarrApiAccess::$user) < 0) {
|
||||
throw new RestException(500, "Error creating mass mailing", array_merge(array($this->mailing->error), $this->mailing->errors));
|
||||
}
|
||||
|
|
@ -296,6 +320,10 @@ class Mailings extends DolibarrApi
|
|||
throw new RestException(404, 'Mass mailing not found, id='.$id);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $this->mailing->fk_project))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('mailing', $this->mailing->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
|
@ -349,6 +377,10 @@ class Mailings extends DolibarrApi
|
|||
throw new RestException(404, 'Mass mailing not found, id='.$id);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $this->mailing->fk_project))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('mailing', $this->mailing->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
|
@ -391,6 +423,10 @@ class Mailings extends DolibarrApi
|
|||
throw new RestException(404, 'Mass mailing not found, id='.$id);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $this->mailing->fk_project))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('mailing', $this->mailing->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
|
@ -434,6 +470,10 @@ class Mailings extends DolibarrApi
|
|||
throw new RestException(404, 'Mass mailing not found, id='.$id);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $this->mailing->fk_project))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('mailing', $this->mailing->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
|
@ -476,6 +516,10 @@ class Mailings extends DolibarrApi
|
|||
throw new RestException(404, 'Mass mailing not found, id='.$id);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $this->mailing->fk_project))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('mailing', $this->mailing->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
|
@ -524,6 +568,10 @@ class Mailings extends DolibarrApi
|
|||
throw new RestException(404, 'Mass mailing not found, id='.$id);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('project', ((int) $this->mailing->fk_project))) {
|
||||
throw new RestException(403, 'Access (project) not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('mailing', $this->mailing->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
|
@ -614,7 +662,6 @@ class Mailings extends DolibarrApi
|
|||
unset($object->fk_delivery_address);
|
||||
unset($object->fk_element);
|
||||
unset($object->fk_multicurrency);
|
||||
unset($object->fk_project);
|
||||
unset($object->fk_projet);
|
||||
unset($object->import_key);
|
||||
unset($object->isextrafieldmanaged);
|
||||
|
|
|
|||
|
|
@ -174,6 +174,12 @@ class Mailing extends CommonObject
|
|||
*/
|
||||
public $substitutionarrayfortest;
|
||||
|
||||
/**
|
||||
* @var ?int The related project ID
|
||||
* @see setProject(), project
|
||||
*/
|
||||
public $fk_project;
|
||||
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1;
|
||||
const STATUS_SENTPARTIALY = 2;
|
||||
|
|
@ -318,6 +324,7 @@ class Mailing extends CommonObject
|
|||
$sql .= ", evenunsubscribe = ".((int) $this->evenunsubscribe);
|
||||
$sql .= ", note_public = '".$this->db->escape($this->note_public)."'";
|
||||
$sql .= ", note_private = '".$this->db->escape($this->note_private)."'";
|
||||
$sql .= ", fk_project = '".((int) $this->fk_project)."'";
|
||||
$sql .= " WHERE rowid = ".(int) $this->id;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
|
@ -381,6 +388,7 @@ class Mailing extends CommonObject
|
|||
$sql .= ", m.joined_file2";
|
||||
$sql .= ", m.joined_file3";
|
||||
$sql .= ", m.joined_file4";
|
||||
$sql .= ", m.fk_project";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
|
||||
$sql .= " WHERE entity IN (".getEntity('mailing').")";
|
||||
if ($ref) {
|
||||
|
|
@ -443,6 +451,7 @@ class Mailing extends CommonObject
|
|||
$this->joined_file2 = $obj->joined_file2;
|
||||
$this->joined_file3 = $obj->joined_file3;
|
||||
$this->joined_file4 = $obj->joined_file4;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
|
||||
if ($this->messtype == 'sms') {
|
||||
$this->picto = 'phone';
|
||||
|
|
|
|||
|
|
@ -655,6 +655,41 @@ class Proposals extends DolibarrApi
|
|||
throw new RestException(405, $this->propal->error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get contacts of given proposal
|
||||
*
|
||||
* Return an array with contact information
|
||||
*
|
||||
* @param int $id ID of proposal
|
||||
* @param string $type Type of the proposal
|
||||
* @return array<int,mixed> Array of contacts associated
|
||||
*
|
||||
* @url GET {id}/contacts
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getContacts($id, $type = '')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('propal', 'lire')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$contacts = $this->propal->liste_contact(-1, 'external', 0, $type);
|
||||
$socpeoples = $this->propal->liste_contact(-1, 'internal', 0, $type);
|
||||
|
||||
$contacts = array_merge($contacts, $socpeoples);
|
||||
|
||||
return $contacts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add (link) a contact to a commercial proposal
|
||||
|
|
|
|||
|
|
@ -391,11 +391,9 @@ if (empty($reshook)) {
|
|||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOSTFLOAT('originmulticurrency_tx');
|
||||
// Fill array 'array_options' with data from add form
|
||||
if (!$error) {
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||
|
|
@ -440,6 +438,7 @@ if (empty($reshook)) {
|
|||
$classname = ucfirst($subelement);
|
||||
$srcobject = new $classname($db);
|
||||
'@phan-var-force Commande|Propal|Contrat $srcobject';
|
||||
/** @var Commande|Propal|Contrat $srcobject */
|
||||
|
||||
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
|
||||
$result = $srcobject->fetch($object->origin_id);
|
||||
|
|
@ -2044,7 +2043,7 @@ if (empty($reshook)) {
|
|||
|
||||
|
||||
if (!$error && getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $usercancreate) {
|
||||
if ($action == 'addcontact' && $usercancreate) {
|
||||
if ($action == 'addcontact') { // Test on permission already done
|
||||
if ($object->id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
|
|
@ -2062,14 +2061,14 @@ if (empty($reshook)) {
|
|||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'swapstatut' && $usercancreate) {
|
||||
} elseif ($action == 'swapstatut') { // Test on permission already done
|
||||
// bascule du statut d'un contact
|
||||
if ($object->id > 0) {
|
||||
$result = $object->swapContactStatus(GETPOSTINT('ligne'));
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'deletecontact' && $usercancreate) {
|
||||
} elseif ($action == 'deletecontact') { // Test on permission already done
|
||||
// Efface un contact
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
|
|
@ -2186,10 +2185,10 @@ if ($action == 'create' && $usercancreate) {
|
|||
$fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
|
||||
$availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : 0);
|
||||
$shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0));
|
||||
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
|
||||
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
|
||||
$demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0));
|
||||
//$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
|
||||
//$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
// $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
|
||||
// $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
$dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ? -1 : '';
|
||||
|
||||
$date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '');
|
||||
|
|
@ -2218,9 +2217,9 @@ if ($action == 'create' && $usercancreate) {
|
|||
$shipping_method_id = $soc->shipping_method_id;
|
||||
$warehouse_id = $soc->fk_warehouse;
|
||||
$demand_reason_id = $soc->demand_reason_id;
|
||||
//$remise_percent = $soc->remise_percent;
|
||||
//$remise_absolue = 0;
|
||||
$dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ? -1 : '';
|
||||
// $remise_percent = $soc->remise_percent;
|
||||
// $remise_absolue = 0;
|
||||
$dateorder = !getDolGlobalString('MAIN_AUTOFILL_DATE_ORDER') ? -1 : '';
|
||||
|
||||
if (isModEnabled("multicurrency") && !empty($soc->multicurrency_code)) {
|
||||
$currency_code = $soc->multicurrency_code;
|
||||
|
|
@ -2484,7 +2483,7 @@ if ($action == 'create' && $usercancreate) {
|
|||
}
|
||||
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
if (isModEnabled('category')) {
|
||||
print '<tr><td>' . $langs->trans("Categories") . '</td><td colspan="3">';
|
||||
print $form->selectCategories(Categorie::TYPE_ORDER, 'categories', $object);
|
||||
print "</td></tr>";
|
||||
|
|
@ -2521,13 +2520,12 @@ if ($action == 'create' && $usercancreate) {
|
|||
$objectsrc->update_price(1);
|
||||
}
|
||||
|
||||
print "\n<!-- " . $classname . " info -->";
|
||||
print "\n";
|
||||
print '<input type="hidden" name="amount" value="' . $objectsrc->total_ht . '">' . "\n";
|
||||
print '<input type="hidden" name="total" value="' . $objectsrc->total_ttc . '">' . "\n";
|
||||
print '<input type="hidden" name="tva" value="' . $objectsrc->total_tva . '">' . "\n";
|
||||
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
|
||||
print "\n<!-- " . $classname . " info -->\n";
|
||||
print '<input type="hidden" name="amount" value="' . $objectsrc->total_ht . '">' . "\n";
|
||||
print '<input type="hidden" name="total" value="' . $objectsrc->total_ttc . '">' . "\n";
|
||||
print '<input type="hidden" name="tva" value="' . $objectsrc->total_tva . '">' . "\n";
|
||||
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
|
||||
|
||||
switch ($classname) {
|
||||
case 'Propal':
|
||||
|
|
@ -2752,7 +2750,6 @@ if ($action == 'create' && $usercancreate) {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
$paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200');
|
||||
|
||||
$formquestion[] = array(
|
||||
|
|
@ -2819,12 +2816,17 @@ if ($action == 'create' && $usercancreate) {
|
|||
if ($conf->browser->name == 'ie') {
|
||||
$forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
}
|
||||
$formquestion = array(
|
||||
$formquestion = [
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ? GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
[
|
||||
'type' => 'other',
|
||||
'name' => 'idwarehouse',
|
||||
'label' => $langs->trans("SelectWarehouseForStockIncrease"),
|
||||
'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ? GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220);
|
||||
|
|
@ -2898,12 +2900,12 @@ if ($action == 'create' && $usercancreate) {
|
|||
$langs->load('subtotals');
|
||||
$type = 'title';
|
||||
$depth_array = $object->getPossibleLevels($langs);
|
||||
require dol_buildpath('/core/tpl/subtotal_create.tpl.php');
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/subtotal_create.tpl.php';
|
||||
} elseif ($action == 'add_subtotal_line') {
|
||||
$langs->load('subtotals');
|
||||
$type = 'subtotal';
|
||||
$titles = $object->getPossibleTitles();
|
||||
require dol_buildpath('/core/tpl/subtotal_create.tpl.php');
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/subtotal_create.tpl.php';
|
||||
}
|
||||
|
||||
// Call Hook formConfirm
|
||||
|
|
@ -2956,7 +2958,6 @@ if ($action == 'create' && $usercancreate) {
|
|||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
// Call Hook tabContentViewOrder
|
||||
|
|
|
|||
|
|
@ -607,6 +607,9 @@ class Orders extends DolibarrApi
|
|||
}
|
||||
|
||||
$contacts = $this->commande->liste_contact(-1, 'external', 0, $type);
|
||||
$socpeoples = $this->commande->liste_contact(-1, 'internal', 0, $type);
|
||||
|
||||
$contacts = array_merge($contacts, $socpeoples);
|
||||
|
||||
return $contacts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ if ($action == 'create') {
|
|||
print $hookmanager->resPrint;
|
||||
|
||||
// Category
|
||||
if (is_array($options) && count($options) && $conf->categorie->enabled) {
|
||||
if (is_array($options) && count($options) && isModEnabled('category')) {
|
||||
print '<tr><td>'.$langs->trans("RubriquesTransactions").'</td><td>';
|
||||
print img_picto('', 'category').Form::selectarray('category_transaction', $options, GETPOST('category_transaction'), 1, 0, 0, '', 0, 0, 0, '', 'minwidth300', 1);
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
/* Copyright (C) 2003 Steve Dillon
|
||||
* Copyright (C) 2003 Laurent Passebecq
|
||||
* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
/* Copyright (C) 2003 Steve Dillon
|
||||
* Copyright (C) 2003 Laurent Passebecq
|
||||
* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -112,7 +113,7 @@ abstract class CommonStickerGenerator extends CommonDocGenerator
|
|||
public $Tformat;
|
||||
|
||||
/**
|
||||
* @var array<string,array{name:string,paper-size:'custom'|array{0:float,1:float},orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:int,custom_x:float,custom_y:float}>
|
||||
* @var ?array<string,array{name:string,paper-size:'custom'|array{0:float,1:float},orientation:string,metric:string,marginLeft:float,marginTop:float,NX:int,NY:int,SpaceX:float,SpaceY:float,width:float,height:float,font-size:int,custom_x:float,custom_y:float}>
|
||||
*/
|
||||
public $_Avery_Labels;
|
||||
// phpcs:enable
|
||||
|
|
|
|||
|
|
@ -431,6 +431,8 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object =
|
|||
|
||||
if (is_null($object)) {
|
||||
$object = new stdClass();
|
||||
$object->id = null;
|
||||
$object->element = null;
|
||||
}
|
||||
|
||||
$filearrayindatabase = dol_dir_list_in_database(rtrim($relativedir, "/\\"), '', null, 'name', SORT_ASC, 0, '', $object);
|
||||
|
|
@ -461,11 +463,6 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object =
|
|||
}
|
||||
}
|
||||
|
||||
//var_dump($relativedir);
|
||||
//var_dump($filearray);
|
||||
//var_dump($filearrayindatabase);
|
||||
//var_dump($object->entity);
|
||||
|
||||
// Complete filearray with properties found into $filearrayindatabase
|
||||
foreach ($filearray as $key => $val) {
|
||||
$tmpfilename = preg_replace('/\.noexe$/', '', $filearray[$key]['name']);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -49,7 +49,7 @@ class pdf_standard_member extends CommonStickerGenerator
|
|||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $_Avery_Labels;
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("main", "admin"));
|
||||
|
|
@ -58,6 +58,7 @@ class pdf_standard_member extends CommonStickerGenerator
|
|||
$this->name = "standard";
|
||||
$this->description = $langs->trans('TemplateforBusinessCards');
|
||||
//$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
|
||||
$this->_Avery_Labels = $_Avery_Labels;
|
||||
|
||||
$this->type = 'pdf-various-sizes';
|
||||
}
|
||||
|
|
@ -165,7 +166,6 @@ class pdf_standard_member extends CommonStickerGenerator
|
|||
$pdf->Cell($this->_Width - 2 * $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($header), 0, 1, 'C');
|
||||
}
|
||||
|
||||
|
||||
$ytop += (empty($header) ? 0 : (1 + $this->_Line_Height));
|
||||
|
||||
// Define widthtouse and heighttouse
|
||||
|
|
@ -272,10 +272,10 @@ class pdf_standard_member extends CommonStickerGenerator
|
|||
* @param string $filename Name of output file (without extension)
|
||||
* @return int<-1,1> 1=OK, <=0=KO
|
||||
*/
|
||||
public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = '', $filename = 'tmp_cards')
|
||||
public function write_file($object, $outputlangs, $srctemplatepath = '', $mode = 'member', $nooutput = '', $filename = 'tmp_cards')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user, $conf, $langs, $mysoc, $_Avery_Labels;
|
||||
global $user, $conf, $langs, $mysoc;
|
||||
|
||||
$this->code = $srctemplatepath;
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ class pdf_standard_member extends CommonStickerGenerator
|
|||
$textfooter = make_substitutions(getDolGlobalString("ADHERENT_CARD_FOOTER_TEXT"), $substitutionarray);
|
||||
$textright = make_substitutions(getDolGlobalString("ADHERENT_CARD_TEXT_RIGHT"), $substitutionarray);
|
||||
|
||||
$nb = $_Avery_Labels[$this->code]['NX'] * $_Avery_Labels[$this->code]['NY'];
|
||||
$nb = $this->_Avery_Labels[$this->code]['NX'] * $this->_Avery_Labels[$this->code]['NY'];
|
||||
if ($nb <= 0) {
|
||||
$nb = 1; // Protection to avoid empty page
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ class pdf_standard_member extends CommonStickerGenerator
|
|||
$arrayofrecords = $object;
|
||||
}
|
||||
|
||||
$this->Tformat = $_Avery_Labels[$this->code];
|
||||
$this->Tformat = $this->_Avery_Labels[$this->code];
|
||||
if (empty($this->Tformat)) {
|
||||
dol_print_error(null, 'ErrorBadTypeForCard'.$this->code);
|
||||
exit;
|
||||
|
|
@ -426,8 +426,6 @@ class pdf_standard_member extends CommonStickerGenerator
|
|||
$file = $dir.'/'.$filename;
|
||||
}
|
||||
|
||||
//var_dump($file);exit;
|
||||
|
||||
if (!file_exists($dir)) {
|
||||
if (dol_mkdir($dir) < 0) {
|
||||
$this->error = $langs->trans("ErrorCanNotCreateDir", $dir);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2008-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2008-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -27,12 +27,6 @@
|
|||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
|
|
@ -41,6 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
|||
* @var User $user
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('ecm', 'companies', 'other', 'users', 'orders', 'propal', 'bills', 'contracts'));
|
||||
|
||||
|
|
@ -143,9 +143,9 @@ if ($action == 'renamefile') { // Test on permission not required here. Must be
|
|||
|
||||
// Add directory
|
||||
if ($action == 'add' && $permissiontouploadfile) {
|
||||
$ecmdir->ref = 'NOTUSEDYET';
|
||||
$ecmdir->label = GETPOST("label");
|
||||
$ecmdir->description = GETPOST("desc");
|
||||
$ecmdir->ref = 'NOTUSEDYET';
|
||||
$ecmdir->label = GETPOST("label");
|
||||
$ecmdir->description = GETPOST("desc");
|
||||
|
||||
$id = $ecmdir->create($user);
|
||||
if ($id > 0) {
|
||||
|
|
@ -188,8 +188,6 @@ if ($action == 'refreshmanual' && $permissiontoread) {
|
|||
$adirwascreated = 0;
|
||||
|
||||
// Now we compare both trees to complete missing trees into database
|
||||
//var_dump($disktree);
|
||||
//var_dump($sqltree);
|
||||
foreach ($disktree as $dirdesc) { // Loop on tree onto disk
|
||||
$dirisindatabase = 0;
|
||||
foreach ($sqltree as $dirsqldesc) {
|
||||
|
|
@ -202,7 +200,6 @@ if ($action == 'refreshmanual' && $permissiontoread) {
|
|||
if (!$dirisindatabase) {
|
||||
$txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
|
||||
dol_syslog($txt);
|
||||
//print $txt."<br>\n";
|
||||
|
||||
// We must first find the fk_parent of directory to create $dirdesc['fullname']
|
||||
$fk_parent = -1;
|
||||
|
|
@ -237,23 +234,24 @@ if ($action == 'refreshmanual' && $permissiontoread) {
|
|||
}
|
||||
|
||||
if ($fk_parent >= 0) {
|
||||
$ecmdirtmp->ref = 'NOTUSEDYET';
|
||||
$ecmdirtmp->label = dol_basename($dirdesc['fullname']);
|
||||
$ecmdirtmp->description = '';
|
||||
$ecmdirtmp->fk_parent = $fk_parent;
|
||||
$ecmdirtmp->ref = 'NOTUSEDYET';
|
||||
$ecmdirtmp->label = dol_basename($dirdesc['fullname']);
|
||||
$ecmdirtmp->description = '';
|
||||
$ecmdirtmp->fk_parent = $fk_parent;
|
||||
|
||||
$txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
|
||||
dol_syslog($txt);
|
||||
//print $ecmdirtmp->cachenbofdoc."<br>\n";exit;
|
||||
$id = $ecmdirtmp->create($user);
|
||||
if ($id > 0) {
|
||||
$newdirsql = array('id' => $id,
|
||||
'id_mere' => $ecmdirtmp->fk_parent,
|
||||
'label' => $ecmdirtmp->label,
|
||||
'description' => $ecmdirtmp->description,
|
||||
'fullrelativename' => $relativepathmissing);
|
||||
$newdirsql = [
|
||||
'id' => $id,
|
||||
'id_mere' => $ecmdirtmp->fk_parent,
|
||||
'label' => $ecmdirtmp->label,
|
||||
'description' => $ecmdirtmp->description,
|
||||
'fullrelativename' => $relativepathmissing,
|
||||
];
|
||||
$sqltree[] = $newdirsql; // We complete fulltree for following loops
|
||||
//var_dump($sqltree);
|
||||
$adirwascreated = 1;
|
||||
} else {
|
||||
dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
|
||||
|
|
@ -261,7 +259,6 @@ if ($action == 'refreshmanual' && $permissiontoread) {
|
|||
} else {
|
||||
$txt = "Parent of ".$dirdesc['fullname']." not found";
|
||||
dol_syslog($txt);
|
||||
//print $txt."<br>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -732,13 +732,50 @@ class Interventions extends DolibarrApi
|
|||
return $this->_cleanObjectDatas($this->fichinter);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get contacts of given interventional
|
||||
*
|
||||
* Return an array with contact information
|
||||
*
|
||||
* @param int $id ID of interventional
|
||||
* @param string $type Type of the interventional
|
||||
* @return array<int,mixed> Object with cleaned properties
|
||||
*
|
||||
* @url GET {id}/contacts
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getContacts($id, $type = '')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'lire')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
$result = $this->fichinter->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Interventional not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) {
|
||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$contacts = $this->fichinter->liste_contact(-1, 'external', 0, $type);
|
||||
$socpeoples = $this->fichinter->liste_contact(-1, 'internal', 0, $type);
|
||||
|
||||
$contacts = array_merge($contacts, $socpeoples);
|
||||
|
||||
return $contacts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete a contact type of given interventional
|
||||
*
|
||||
* @param int $id Id of interventional to update
|
||||
* @param int $contactid Row key of the contact in the array contact_ids.
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
|
||||
* @return Object Object with cleaned properties
|
||||
* @param int $id Id of interventional to update
|
||||
* @param int $contactid Row key of the contact in the array contact_ids.
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
|
||||
* @return Object Object deleted
|
||||
*
|
||||
* @url DELETE {id}/contact/{contactid}/{type}
|
||||
*
|
||||
|
|
@ -792,7 +829,6 @@ class Interventions extends DolibarrApi
|
|||
*/
|
||||
public function updateInterventionalLine($id, $lineid, $request_data)
|
||||
{
|
||||
|
||||
$result = $this->fichinter->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Interventional not found');
|
||||
|
|
|
|||
|
|
@ -3160,7 +3160,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||
}
|
||||
|
||||
$tabprice = calcul_price_total($qty, (float) $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, (float) $pu_ht_devise);
|
||||
$tabprice = calcul_price_total($qty, (float) $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, (float) $this->multicurrency_tx, (float) $pu_ht_devise);
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
|
|
@ -3199,14 +3199,14 @@ class CommandeFournisseur extends CommonOrder
|
|||
} else {
|
||||
// Ensure packaging is numeric, positive, and use fmod instead of %, to prevent error with decimal packaging values (resulting in division by zero)
|
||||
if (
|
||||
!empty($this->line->packaging)
|
||||
&& is_numeric($this->line->packaging)
|
||||
&& (float) $this->line->packaging > 0
|
||||
&& fmod((float) $qty, (float) $this->line->packaging) > 0
|
||||
) {
|
||||
$coeff = intval($qty / $this->line->packaging) + 1;
|
||||
$qty = $this->line->packaging * $coeff;
|
||||
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
|
||||
!empty($this->line->packaging)
|
||||
&& is_numeric($this->line->packaging)
|
||||
&& (float) $this->line->packaging > 0
|
||||
&& fmod((float) $qty, (float) $this->line->packaging) > 0
|
||||
) {
|
||||
$coeff = intval($qty / $this->line->packaging) + 1;
|
||||
$qty = $this->line->packaging * $coeff;
|
||||
setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,4 +200,6 @@ create table llx_categorie_supplier_proposal
|
|||
import_key varchar(14)
|
||||
)ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_mailing ADD COLUMN fk_project integer DEFAULT NULL;
|
||||
|
||||
-- end of migration
|
||||
|
|
|
|||
|
|
@ -52,5 +52,6 @@ create table llx_mailing
|
|||
joined_file4 varchar(255),
|
||||
statut smallint DEFAULT 0, -- status (draft:0, valid: 1, approved: 2, sent: 3)
|
||||
note_private text,
|
||||
note_public text
|
||||
note_public text,
|
||||
fk_project integer DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class PriceParser
|
|||
} elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) { //Internal errors
|
||||
return $langs->trans("ErrorPriceExpressionInternal", (string) $code);
|
||||
} else { //Unknown errors
|
||||
return $langs->trans("ErrorPriceExpressionUnknown", $code);
|
||||
return $langs->trans("ErrorPriceExpressionUnknown", (string) $code);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
* Copyright (C) 2022 Udo Tamm <dev@dolibit.de>
|
||||
|
|
@ -609,9 +609,11 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
|
|||
print '</td></tr>'."\n";
|
||||
|
||||
// Moral/Physic attribute
|
||||
$morphys = array();
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
$morphys = [
|
||||
// "" => $langs->trans("MorAndPhy"),
|
||||
"phy" => $langs->trans("Physical"),
|
||||
"mor" => $langs->trans("Moral"),
|
||||
];
|
||||
$checkednature = GETPOST("morphy", 'alpha');
|
||||
$listetype_natures = $adht->morphyByType(1); // Load the array of morphy per type
|
||||
$listetype_natures_json = json_encode($listetype_natures);
|
||||
|
|
|
|||
Loading…
Reference in a new issue