Skip to content

Commit

Permalink
Merge branch 'dev_addrecursupinvoice' of github.com:FHenry/dolibarr i…
Browse files Browse the repository at this point in the history
…nto dev_addrecursupinvoice
  • Loading branch information
FHenry committed Sep 18, 2024
2 parents 70a6fd0 + 2fd663b commit 3196889
Show file tree
Hide file tree
Showing 132 changed files with 1,298 additions and 696 deletions.
13 changes: 8 additions & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,18 @@ WARNING:
--------

The following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Ldap class methods connect_bind() & dump_content() have been renamed
* More class properties (with old name in french) are now deprecated in favor of the property name in english.
* If a filter is defined into and extrafields "Select from a table", this filter MUST use the Universai Search Filter syntax (field:=:value) instead of field=value.
See https://wiki.dolibarr.org/index.php?title=Universal_Search_Filter_Syntax
* The parameter $filter of methods fetchAll() does not accept array of SQL commands but must be a string of an Universal Search Filter syntax.
See https://wiki.dolibarr.org/index.php?title=Universal_Search_Filter_Syntax
* The use of 'customurl' into $filter has been removed. Must use the USF syntax.
* Some API HTTP return code were moved from 401 to 403 to better follow REST specification.
* More class properties (with old name in french) are now deprecated in favor of the property name in english.
* dolibarrtriggers class VERSION_XXX constants have been deprecated. Please use array dictionary VERSIONS['XXX'].
* Properties ->date_update and ->date_modification were merged into date_modification.
* All CLI tools (into /scripts) return a positive value to the shell if error (0 remains success) for a better
cross platform compatibility. On linux the exit(-1) was caught as 255, it may be now exit(1) so will be caught as 1.
* The parameter $filter of method fetchAll does not accept array of SQL but must be a string of an Universal Search Filter syntax.
* Remove use of customurl into $filter. Must use the USF syntax.
* Ldap class methods connect_bind() & dump_content() have been renamed
* Use of dol_eval with parameter $returnvalue=0 is deprecated.
* The signature for all ->delete() method has been modified to match the modulebuilder template (so first param is now always $user), except
the delete for thirdparty (still accept the id of thirdparty to delete as first parameter). Will probably be modified into another version.
Expand All @@ -314,7 +317,7 @@ The following changes may create regressions for some external modules, but were
* Removed trigger BILLREC_CREATEBILL. This trigger was not a CRUD event. If you used it, you can already use the trigger BILL_CREATE and
test that ($object->fac_rec > 0) to know if creation trigger is from a recurring invoice or not. Also this old trigger was never enabled
into table llx_c_action_trigger.
* Renamings in expedition line table and class, fk_origin_line is now fk_elementdet in table and class.
* Renaming into expedition line table and class: fk_origin_line is now fk_elementdet in table and class.
* The signature of method fetch() of class CompanyBankAccount has been modified to match the signature of method Account->fetch()


Expand Down
82 changes: 32 additions & 50 deletions dev/tools/phan/baseline.txt

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dev/tools/phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@
'PhanTypePossiblyInvalidDimOffset', // a lot of false positive, in most cases, we want to keep the code as it is
// 'PhanPluginUnknownArrayFunctionReturnType', // a lot of false positive, in most cases, we want to keep the code as it is

'PhanPluginWhitespaceTab', // Dolibarr used tabs
'PhanPluginWhitespaceTab', // Dolibarr uses tabs
'PhanPluginCanUsePHP71Void', // Dolibarr is maintaining 7.0 compatibility
'PhanPluginShortArray', // Dolibarr uses array()
'PhanPluginShortArrayList', // Dolibarr uses array()
Expand All @@ -436,7 +436,7 @@

'PhanPluginNonBoolBranch', // Not essential - 31240+ occurrences
'PhanPluginNumericalComparison', // Not essential - 19870+ occurrences
'PhanTypeMismatchArgument', // Not essential - 12300+ occurrences
'PhanTypeMismatchArgument', // Also reported by phpstan < lvl6 - 12300+ occurrences
'PhanPluginNonBoolInLogicalArith', // Not essential - 11040+ occurrences
'PhanPluginConstantVariableScalar', // Not essential - 5180+ occurrences
'PhanPluginDuplicateAdjacentStatement',
Expand All @@ -448,7 +448,7 @@

// 'PhanPluginUnknownArrayMethodParamType', // Too many troubles to manage. Is enabled in config_extended only.
// 'PhanPluginUnknownArrayMethodReturnType', // Too many troubles to manage. Is enabled in config_extended only.
'PhanUndeclaredGlobalVariable', // Too many false positives on .tpl.php files. Is enabled into config_extended only.
// 'PhanUndeclaredGlobalVariable', // Helps identify variables that are not set/defined - add '@phan-var-force TYPE $varname' in tpl or includes to help type the variable
// 'PhanPluginUnknownObjectMethodCall', // False positive for some class. Is enabled in config_extended only.
],
// You can put relative paths to internal stubs in this config option.
Expand Down
1 change: 1 addition & 0 deletions htdocs/admin/barcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@
$classname = "mod".ucfirst($obj->coder);
if (class_exists($classname)) {
$module = new $classname($db);
'@phan-var-force ModeleBarCode $module';
if ($module->encodingIsSupported($obj->encoding)) {
// Build barcode on disk (not used, this is done to make debug easier)
$result = $module->writeBarCode($obj->example, $obj->encoding, 'Y');
Expand Down
5 changes: 3 additions & 2 deletions htdocs/admin/contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
if ($action == 'updateMask') {
$maskconst = GETPOST('maskconstcontract', 'aZ09');
$maskvalue = GETPOST('maskcontract', 'alpha');
$res = 0;
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
}
Expand Down Expand Up @@ -103,8 +104,8 @@
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=contract&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR);
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
Expand Down
5 changes: 3 additions & 2 deletions htdocs/admin/holiday.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
if ($action == 'updateMask') {
$maskconst = GETPOST('maskconstholiday', 'aZ09');
$maskvalue = GETPOST('maskholiday', 'alpha');
$res = 0;
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
}
Expand Down Expand Up @@ -102,8 +103,8 @@
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR);
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
Expand Down
1 change: 1 addition & 0 deletions htdocs/asset/tpl/linkedobjectblock.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
$langs->load("assets");

$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
'@phan-var-force CommonObject[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array)

$total = 0;
$ilink = 0;
Expand Down
46 changes: 23 additions & 23 deletions htdocs/categories/class/categorie.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Categorie extends CommonObject


/**
* @var array Table of mapping between type string and ID used for field 'type' in table llx_categories
* @var array<string,int> Table of mapping between type string and ID used for field 'type' in table llx_categories
*/
protected $MAP_ID = array(
'product' => 0,
Expand All @@ -90,7 +90,7 @@ class Categorie extends CommonObject
);

/**
* @var array Code mapping from ID
* @var array<int,string> Code mapping from ID
*
* @note This array should be removed in future, once previous constants are moved to the string value. Deprecated
*/
Expand All @@ -112,7 +112,7 @@ class Categorie extends CommonObject
);

/**
* @var array Foreign keys mapping from type string when value does not match
* @var array<string,string> Foreign keys mapping from type string when value does not match
*
* @todo Move to const array when PHP 5.6 will be our minimum target
*/
Expand All @@ -124,7 +124,7 @@ class Categorie extends CommonObject
);

/**
* @var array Category tables mapping from type string (llx_categorie_...) when value does not match
* @var array<string,string> Category tables mapping from type string (llx_categorie_...) when value does not match
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
Expand All @@ -135,7 +135,7 @@ class Categorie extends CommonObject
);

/**
* @var array Object class mapping from type string
* @var array<string,string> Object class mapping from type string
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
Expand All @@ -157,7 +157,7 @@ class Categorie extends CommonObject
);

/**
* @var array Title Area mapping from type string
* @var array<string,string> Title Area mapping from type string
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
Expand All @@ -179,7 +179,7 @@ class Categorie extends CommonObject
);

/**
* @var array Object table mapping from type string (table llx_...) when value of key does not match table name.
* @var array<string,string> Object table mapping from type string (table llx_...) when value of key does not match table name.
* This array may be completed by external modules with hook "constructCategory"
*/
public $MAP_OBJ_TABLE = array(
Expand Down Expand Up @@ -287,22 +287,22 @@ class Categorie extends CommonObject
*/
public $imgHeight;

public $fields=array(
"rowid" => array("type"=>"integer", "label"=>"TechnicalID", "enabled"=>"1", 'position'=>10, 'notnull'=>1, "visible"=>"-1",),
"fk_parent" => array("type"=>"integer", "label"=>"Fkparent", "enabled"=>"1", 'position'=>20, 'notnull'=>1, "visible"=>"-1", "css"=>"maxwidth500 widthcentpercentminusxx",),
"label" => array("type"=>"varchar(180)", "label"=>"Label", "enabled"=>"1", 'position'=>25, 'notnull'=>1, "visible"=>"-1", "alwayseditable"=>"1", "css"=>"minwidth300", "cssview"=>"wordbreak", "csslist"=>"tdoverflowmax150",),
"ref_ext" => array("type"=>"varchar(255)", "label"=>"Refext", "enabled"=>"1", 'position'=>30, 'notnull'=>0, "visible"=>"0", "alwayseditable"=>"1",),
"type" => array("type"=>"integer", "label"=>"Type", "enabled"=>"1", 'position'=>35, 'notnull'=>1, "visible"=>"-1", "alwayseditable"=>"1",),
"description" => array("type"=>"text", "label"=>"Description", "enabled"=>"1", 'position'=>40, 'notnull'=>0, "visible"=>"-1", "alwayseditable"=>"1",),
"color" => array("type"=>"varchar(8)", "label"=>"Color", "enabled"=>"1", 'position'=>45, 'notnull'=>0, "visible"=>"-1", "alwayseditable"=>"1",),
"position" => array("type"=>"integer", "label"=>"Position", "enabled"=>"1", 'position'=>50, 'notnull'=>0, "visible"=>"-1", "alwayseditable"=>"1",),
"fk_soc" => array("type"=>"integer:Societe:societe/class/societe.class.php", "label"=>"ThirdParty", "picto"=>"company", "enabled"=>"1", 'position'=>55, 'notnull'=>0, "visible"=>"-1", "alwayseditable"=>"1", "css"=>"maxwidth500 widthcentpercentminusxx", "csslist"=>"tdoverflowmax150",),
"visible" => array("type"=>"integer", "label"=>"Visible", "enabled"=>"1", 'position'=>60, 'notnull'=>1, "visible"=>"-1", "alwayseditable"=>"1",),
"import_key" => array("type"=>"varchar(14)", "label"=>"ImportId", "enabled"=>"1", 'position'=>900, 'notnull'=>0, "visible"=>"-2", "alwayseditable"=>"1",),
"date_creation" => array("type"=>"datetime", "label"=>"Datecreation", "enabled"=>"1", 'position'=>70, 'notnull'=>0, "visible"=>"-1", "alwayseditable"=>"1",),
"tms" => array("type"=>"timestamp", "label"=>"DateModification", "enabled"=>"1", 'position'=>75, 'notnull'=>1, "visible"=>"-1", "alwayseditable"=>"1",),
"fk_user_creat" => array("type"=>"integer:User:user/class/user.class.php", "label"=>"UserAuthor", "enabled"=>"1", 'position'=>80, 'notnull'=>0, "visible"=>"-2", "alwayseditable"=>"1", "css"=>"maxwidth500 widthcentpercentminusxx", "csslist"=>"tdoverflowmax150",),
"fk_user_modif" => array("type"=>"integer:User:user/class/user.class.php", "label"=>"UserModif", "enabled"=>"1", 'position'=>85, 'notnull'=>-1, "visible"=>"-2", "alwayseditable"=>"1", "css"=>"maxwidth500 widthcentpercentminusxx", "csslist"=>"tdoverflowmax150",),
public $fields = array(
"rowid" => array("type" => "integer", "label" => "TechnicalID", "enabled" => "1", 'position' => 10, 'notnull' => 1, "visible" => "-1",),
"fk_parent" => array("type" => "integer", "label" => "Fkparent", "enabled" => "1", 'position' => 20, 'notnull' => 1, "visible" => "-1", "css" => "maxwidth500 widthcentpercentminusxx",),
"label" => array("type" => "varchar(180)", "label" => "Label", "enabled" => "1", 'position' => 25, 'notnull' => 1, "visible" => "-1", "alwayseditable" => "1", "css" => "minwidth300", "cssview" => "wordbreak", "csslist" => "tdoverflowmax150",),
"ref_ext" => array("type" => "varchar(255)", "label" => "Refext", "enabled" => "1", 'position' => 30, 'notnull' => 0, "visible" => "0", "alwayseditable" => "1",),
"type" => array("type" => "integer", "label" => "Type", "enabled" => "1", 'position' => 35, 'notnull' => 1, "visible" => "-1", "alwayseditable" => "1",),
"description" => array("type" => "text", "label" => "Description", "enabled" => "1", 'position' => 40, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",),
"color" => array("type" => "varchar(8)", "label" => "Color", "enabled" => "1", 'position' => 45, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",),
"position" => array("type" => "integer", "label" => "Position", "enabled" => "1", 'position' => 50, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",),
"fk_soc" => array("type" => "integer:Societe:societe/class/societe.class.php", "label" => "ThirdParty", "picto" => "company", "enabled" => "1", 'position' => 55, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1", "css" => "maxwidth500 widthcentpercentminusxx", "csslist" => "tdoverflowmax150",),
"visible" => array("type" => "integer", "label" => "Visible", "enabled" => "1", 'position' => 60, 'notnull' => 1, "visible" => "-1", "alwayseditable" => "1",),
"import_key" => array("type" => "varchar(14)", "label" => "ImportId", "enabled" => "1", 'position' => 900, 'notnull' => 0, "visible" => "-2", "alwayseditable" => "1",),
"date_creation" => array("type" => "datetime", "label" => "Datecreation", "enabled" => "1", 'position' => 70, 'notnull' => 0, "visible" => "-1", "alwayseditable" => "1",),
"tms" => array("type" => "timestamp", "label" => "DateModification", "enabled" => "1", 'position' => 75, 'notnull' => 1, "visible" => "-1", "alwayseditable" => "1",),
"fk_user_creat" => array("type" => "integer:User:user/class/user.class.php", "label" => "UserAuthor", "enabled" => "1", 'position' => 80, 'notnull' => 0, "visible" => "-2", "alwayseditable" => "1", "css" => "maxwidth500 widthcentpercentminusxx", "csslist" => "tdoverflowmax150",),
"fk_user_modif" => array("type" => "integer:User:user/class/user.class.php", "label" => "UserModif", "enabled" => "1", 'position' => 85, 'notnull' => -1, "visible" => "-2", "alwayseditable" => "1", "css" => "maxwidth500 widthcentpercentminusxx", "csslist" => "tdoverflowmax150",),
);

/**
Expand Down
19 changes: 14 additions & 5 deletions htdocs/comm/action/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@

$_SESSION['assignedtouser'] = json_encode($tmpassigneduserids);
$donotclearsession = 1;
if ($action == 'add' && $usercancreate) {
if ($action == 'add') { // Test on permission not required here
$action = 'create';
}
if ($action == 'update' && $usercancreate) {
if ($action == 'update') { // Test on permission not required here
$action = 'edit';
}

Expand Down Expand Up @@ -989,6 +989,13 @@
// the notification must be created for every user assigned to the event
foreach ($object->userassigned as $userassigned) {
$actionCommReminder->fk_user = $userassigned['id'];

// We update the event, so we recreate the notification event.
// First we delete all reminders for the user and the type of reminding (all offset dates).
$sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder";
$sqldelete .= " WHERE fk_user = ".((int) $actionCommReminder->fk_user)." AND fk_actioncomm = ".((int) $object->id)." AND typeremind = '".$db->escape($remindertype)."'";
$resqldelete = $db->query($sqldelete);

$res = $actionCommReminder->create($user);

if ($res <= 0) {
Expand All @@ -1003,13 +1010,14 @@
}
}

unset($_SESSION['assignedtouser']);
unset($_SESSION['assignedtoresource']);

if (!$error) {
unset($_SESSION['assignedtouser']);
unset($_SESSION['assignedtoresource']);

$db->commit();
} else {
$db->rollback();
$action = 'edit';
}
} else {
setEventMessages($object->error, $object->errors, 'errors');
Expand Down Expand Up @@ -1964,6 +1972,7 @@ function setdatefields()
$listofuserid = json_decode($_SESSION['assignedtouser'], true);
}
}

$listofcontactid = $object->socpeopleassigned; // Contact assigned
$listofotherid = $object->otherassigned; // Other undefined email (not used yet)

Expand Down
3 changes: 1 addition & 2 deletions htdocs/comm/action/class/actioncommreminder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,14 @@ class ActionCommReminder extends CommonObject
public $fk_email_template;
// END MODULEBUILDER PROPERTIES


/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
global $conf;

$this->db = $db;

$this->ismultientitymanaged = 0;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/comm/propal/class/propal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3442,7 +3442,7 @@ public function load_board($user, $mode)
$response->label = $label;
$response->labelShort = $labelShort;
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals';
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_option=late&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
$response->img = img_object('', "propal");

// This assignment in condition is not a bug. It allows walking the results.
Expand Down
31 changes: 23 additions & 8 deletions htdocs/comm/propal/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Copyright (C) 2021-2024 Frédéric France <[email protected]>
* Copyright (C) 2022 Josep Lluís Amador <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2024 William Mead <[email protected]>
*
* 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
Expand Down Expand Up @@ -146,6 +147,12 @@
$search_status = GETPOST('search_status', 'alpha');
$search_note_public = GETPOST('search_note_public', 'alpha');

$search_option = GETPOST('search_option', 'alpha');
if ($search_option == 'late') {
$search_status = '1';
$object_statut = '1';
}

// Pagination
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
Expand Down Expand Up @@ -257,11 +264,11 @@

// List of fields to search into when doing a "search in all"
/*$fieldstosearchall = array();
foreach ($object->fields as $key => $val) {
if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}*/
foreach ($object->fields as $key => $val) {
if (!empty($val['searchall'])) {
$fieldstosearchall['t.'.$key] = $val['label'];
}
}*/

// Definition of array of fields for columns
/*$arrayfields = array();
Expand Down Expand Up @@ -375,6 +382,7 @@
$search_date_delivery_start = '';
$search_date_delivery_end = '';
$search_availability = '';
$search_option = '';
$search_status = '';
$search_categ_cus = 0;
$search_fk_cond_reglement = '';
Expand Down Expand Up @@ -813,6 +821,9 @@
}
}
}
if ($search_option == 'late') {
$sql .= " AND p.fin_validite < '".$db->idate(dol_now() - $conf->propal->cloture->warning_delay)."'";
}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
//print $sql;
Expand Down Expand Up @@ -1716,10 +1727,11 @@
|| !empty($arrayfields['total_margin']['checked'])
|| !empty($arrayfields['total_margin_rate']['checked'])
|| !empty($arrayfields['total_mark_rate']['checked'])
)
) {
$with_margin_info = true;
)
) {
$with_margin_info = true;
}

$total_ht = 0;
$total_margin = 0;

Expand All @@ -1733,6 +1745,9 @@
if (empty($obj)) {
break; // Should not happen
}
if ($search_option) {
$param .= "&search_option=".urlencode($search_option);
}

$objectstatic->id = $obj->rowid;
$objectstatic->ref = $obj->ref;
Expand Down
Loading

0 comments on commit 3196889

Please sign in to comment.