From 165d34ec56d12e29b79ab12235d7ca9bffcd9dbb Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 29 Oct 2021 12:49:27 +0200 Subject: [PATCH 001/177] Fix: Import don't work if extrafield is separator --- htdocs/core/modules/modAdherent.class.php | 2 +- htdocs/core/modules/modBom.class.php | 4 ++-- htdocs/core/modules/modCommande.class.php | 4 ++-- htdocs/core/modules/modFournisseur.class.php | 8 ++++---- htdocs/core/modules/modProduct.class.php | 4 ++-- htdocs/core/modules/modProjet.class.php | 2 +- htdocs/core/modules/modPropale.class.php | 4 ++-- htdocs/core/modules/modResource.class.php | 2 +- htdocs/core/modules/modService.class.php | 2 +- htdocs/core/modules/modSociete.class.php | 4 ++-- htdocs/core/modules/modUser.class.php | 2 +- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 074969451c1..a3942220286 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -349,7 +349,7 @@ class modAdherent extends DolibarrModules $this->import_fields_array[$r]['a.fk_soc'] = "ThirdParty"; } // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'adherent' AND entity IN (0,".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 18f46fda70f..febc6135fab 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -352,7 +352,7 @@ class modBom extends DolibarrModules // Add extra fields $import_extrafield_sample = []; - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bom' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'bom_bom' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { @@ -422,7 +422,7 @@ class modBom extends DolibarrModules ]; // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'bom_bomline' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'bom_bomline' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 4275d806d40..6e486420328 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -322,7 +322,7 @@ class modCommande extends DolibarrModules // Add extra fields $import_extrafield_sample = []; - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'commande' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { @@ -404,7 +404,7 @@ class modCommande extends DolibarrModules } // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commandedet' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'commandedet' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 5d71a5abdc8..4150ab019b3 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -541,7 +541,7 @@ class modFournisseur extends DolibarrModules } // Add extra fields $import_extrafield_sample = []; - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { @@ -628,7 +628,7 @@ class modFournisseur extends DolibarrModules } // Add extra fields $import_extrafield_sample = []; - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { @@ -717,7 +717,7 @@ class modFournisseur extends DolibarrModules // Add extra fields $import_extrafield_sample = []; - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { @@ -794,7 +794,7 @@ class modFournisseur extends DolibarrModules } // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseurdet' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'commande_fournisseurdet' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 37cda4b7b30..1736abef905 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -636,7 +636,7 @@ class modProduct extends DolibarrModules // Add extra fields $import_extrafield_sample = array(); - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'product' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) while ($obj = $this->db->fetch_object($resql)) { @@ -797,7 +797,7 @@ class modProduct extends DolibarrModules // Add extra fields $import_extrafield_sample = array(); - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product_fournisseur_price' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'product_fournisseur_price' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 7acbb2bfb68..621d799d4f6 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -296,7 +296,7 @@ class modProjet extends DolibarrModules $this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet_task', 'extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order) $this->import_fields_array[$r] = array('t.fk_projet'=>'ProjectRef*', 't.ref'=>'RefTask*', 't.label'=>'LabelTask*', 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.planned_workload'=>"PlannedWorkload", 't.progress'=>"Progress", 't.note_private'=>"NotePrivate", 't.note_public'=>"NotePublic", 't.datec'=>"DateCreation"); // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index eb589fc1759..becab61f862 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -302,7 +302,7 @@ class modPropale extends DolibarrModules } // Add extra fields $import_extrafield_sample = []; - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propal' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'propal' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { @@ -386,7 +386,7 @@ class modPropale extends DolibarrModules } // Add extra fields $import_extrafield_sample = []; - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propaldet' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'propaldet' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 6f2d3f8d409..7a042cf5ff7 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -268,7 +268,7 @@ class modResource extends DolibarrModules $this->import_tables_array[$r] = array('r'=>MAIN_DB_PREFIX.'resource', 'extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order) $this->import_fields_array[$r] = array('r.ref'=>"ResourceFormLabel_ref*", 'r.fk_code_type_resource'=>'ResourceTypeCode', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>'DateCreation'); // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity IN (0,".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'resource' AND entity IN (0,".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 21a26bdc750..60383bf3bea 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -584,7 +584,7 @@ class modService extends DolibarrModules } // Add extra fields $import_extrafield_sample = array(); - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0,".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'product' AND entity IN (0,".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 7c3d93499e4..41d21874c31 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -496,7 +496,7 @@ class modSociete extends DolibarrModules $this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode'); } // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) while ($obj = $this->db->fetch_object($resql)) { @@ -674,7 +674,7 @@ class modSociete extends DolibarrModules 's.note_public' => "NotePublic" ); // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on an old database (during a migration for example) while ($obj = $this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index e54ac7bd440..47cd04ecd26 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -298,7 +298,7 @@ class modUser extends DolibarrModules 'u.statut'=>'Status' ); // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")"; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'user' AND entity IN (0,".$conf->entity.")"; $resql = $this->db->query($sql); if ($resql) { // This can fail when class is used on old database (during migration for example) while ($obj = $this->db->fetch_object($resql)) { From ea8280af9854a81cc9b42bf641a676fd2a574b92 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 17 Nov 2021 17:32:17 +0100 Subject: [PATCH 002/177] FIX : status filter on supplierOrder stats doesn't work --- htdocs/commande/stats/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index bd92dc084c7..e92cd076928 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -95,12 +95,12 @@ dol_mkdir($dir); $stats = new CommandeStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0)); if ($mode == 'customer') { if ($object_status != '' && $object_status >= -1) { - $stats->where .= ' AND c.fk_statut IN ('.$db->sanitize($object_status).')'; + $stats->where .= ' AND c.fk_statut IN ('.implode(',',$object_status).')'; } } if ($mode == 'supplier') { if ($object_status != '' && $object_status >= 0) { - $stats->where .= ' AND c.fk_statut IN ('.$db->sanitize($object_status).')'; + $stats->where .= ' AND c.fk_statut IN ('.implode(',',$object_status).')'; } } From c5f6c617c91dce34eced356c7605f5a4cd5ff2b9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 19 Nov 2021 08:34:45 +0000 Subject: [PATCH 003/177] Fixing style errors. --- htdocs/commande/stats/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index e92cd076928..4753666b2bc 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -95,12 +95,12 @@ dol_mkdir($dir); $stats = new CommandeStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0)); if ($mode == 'customer') { if ($object_status != '' && $object_status >= -1) { - $stats->where .= ' AND c.fk_statut IN ('.implode(',',$object_status).')'; + $stats->where .= ' AND c.fk_statut IN ('.implode(',', $object_status).')'; } } if ($mode == 'supplier') { if ($object_status != '' && $object_status >= 0) { - $stats->where .= ' AND c.fk_statut IN ('.implode(',',$object_status).')'; + $stats->where .= ' AND c.fk_statut IN ('.implode(',', $object_status).')'; } } From dc23c7f6a3a69ae11367d696cde8a46a587d08a7 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Fri, 19 Nov 2021 10:29:27 +0100 Subject: [PATCH 004/177] FIX : Travis --- htdocs/commande/stats/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 4753666b2bc..c93c8888aa9 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -95,12 +95,12 @@ dol_mkdir($dir); $stats = new CommandeStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0)); if ($mode == 'customer') { if ($object_status != '' && $object_status >= -1) { - $stats->where .= ' AND c.fk_statut IN ('.implode(',', $object_status).')'; + $stats->where .= ' AND c.fk_statut IN ('.$db->escape(implode(',', $object_status)).')'; } } if ($mode == 'supplier') { if ($object_status != '' && $object_status >= 0) { - $stats->where .= ' AND c.fk_statut IN ('.implode(',', $object_status).')'; + $stats->where .= ' AND c.fk_statut IN ('.$db->escape(implode(',', $object_status)).')'; } } From 7cb657c99189a02695ba74e1b511ff5b3802e7aa Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 19 Nov 2021 14:49:11 +0100 Subject: [PATCH 005/177] FIX: project timesheets: assume Saturday and Sunday are default weekend days when working days conf is empty or badly formed --- htdocs/projet/activity/perday.php | 5 +++++ htdocs/projet/activity/perweek.php | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index e315f638dd2..cefdf4d6463 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -620,6 +620,11 @@ $restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSI // Get if user is available or not for each day $isavailable = array(); + +// Assume from Monday to Friday if conf empty or badly formed +$numstartworkingday = 1; +$numendworkingday = 5; + if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) { $tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 54283681029..becbb86157a 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -521,6 +521,11 @@ $startday = dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray[' // Get if user is available or not for each day $isavailable = array(); + +// Assume from Monday to Friday if conf empty or badly formed +$numstartworkingday = 1; +$numendworkingday = 5; + if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) { $tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS); @@ -530,7 +535,6 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) $numendworkingday = $tmparray[1]; } } - for ($idw = 0; $idw < 7; $idw++) { $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 From c5f0faad43315aaaf3a877aa1a6414eaba9b708b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 19 Nov 2021 15:36:00 +0100 Subject: [PATCH 006/177] FIX: project timesheet: public holidays offset by 1 day --- htdocs/projet/activity/perday.php | 6 +++++- htdocs/projet/activity/perweek.php | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 79a259f1ccc..159f4f11b6b 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -87,6 +87,10 @@ $daytoparse = $now; if ($yearofday && $monthofday && $dayofday) $daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime' elseif ($year && $month && $day) $daytoparse = dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect' +$daytoparsegmt = dol_now('gmt'); +if ($yearofday && $monthofday && $dayofday) $daytoparsegmt = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday, 'gmt'); // xxxofday is value of day after submit action 'addtime' +elseif ($year && $month && $day) $daytoparsegmt = dol_mktime(0, 0, 0, $month, $day, $year, 'gmt'); // this are value submited after submit of action 'submitdateselect' + if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) { @@ -616,7 +620,7 @@ $statusofholidaytocheck = Holiday::STATUS_APPROVED; $isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0 $isavailable[$daytoparse] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day -$test = num_public_holiday($daytoparse, $daytoparse + 86400, $mysoc->country_code); +$test = num_public_holiday($daytoparsegmt, $daytoparsegmt + 86400, $mysoc->country_code); if ($test) $isavailable[$daytoparse] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday'); $tmparray = dol_getdate($daytoparse, true); // detail of current day diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index d7c0f874383..267106c5721 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -97,6 +97,7 @@ $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year); +$firstdaytoshowgmt = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt'); $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd'); if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) @@ -520,6 +521,7 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) for ($idw = 0; $idw < 7; $idw++) { $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 + $dayinloopfromfirstdaytoshowgmt = dol_time_plus_duree($firstdaytoshowgmt, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 $dayinloop = dol_time_plus_duree($startday, $idw, 'd'); // Useless because $dayinloopwithouthours should be same than $dayinloopfromfirstdaytoshow @@ -534,7 +536,7 @@ for ($idw = 0; $idw < 7; $idw++) $isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, $statusofholidaytocheck); $isavailable[$dayinloopfromfirstdaytoshow] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day - $test = num_public_holiday($dayinloopfromfirstdaytoshow, $dayinloopfromfirstdaytoshow + 86400, $mysoc->country_code); + $test = num_public_holiday($dayinloopfromfirstdaytoshowgmt, $dayinloopfromfirstdaytoshowgmt + 86400, $mysoc->country_code); if ($test) $isavailable[$dayinloopfromfirstdaytoshow] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday'); } //var_dump($isavailable); From 112922206469e35129ec5198bac125f40ce736fa Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 19 Nov 2021 15:59:34 +0100 Subject: [PATCH 007/177] FIX: user employee tab: offset in open days messes up holiday length calculation --- htdocs/user/bank.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 3bdc6b5390c..e97d6504369 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -327,7 +327,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco $holiday->id = $objp->rowid; $holiday->ref = $objp->rowid; $holiday->fk_type = $objp->fk_type; - $nbopenedday = num_open_day($db->jdate($objp->date_debut), $db->jdate($objp->date_fin), 0, 1, $objp->halfday); + $nbopenedday = num_open_day($db->jdate($objp->date_debut, 'gmt'), $db->jdate($objp->date_fin, 'gmt'), 0, 1, $objp->halfday); print $holiday->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->date_debut), 'day')."\n"; From ffa88b803ffd4636b626b6631d1a79b9122597cb Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 19 Nov 2021 16:03:41 +0100 Subject: [PATCH 008/177] FIX: project timesheet by week: cleanup unused code --- htdocs/projet/activity/perweek.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 267106c5721..2e1926c8847 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -98,7 +98,6 @@ $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year); $firstdaytoshowgmt = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt'); -$lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd'); if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) { @@ -522,14 +521,6 @@ for ($idw = 0; $idw < 7; $idw++) { $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 $dayinloopfromfirstdaytoshowgmt = dol_time_plus_duree($firstdaytoshowgmt, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 - $dayinloop = dol_time_plus_duree($startday, $idw, 'd'); - - // Useless because $dayinloopwithouthours should be same than $dayinloopfromfirstdaytoshow - //$tmparray = dol_getdate($dayinloop); - //$dayinloopwithouthours=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); - //print dol_print_date($dayinloop, 'dayhour').' '; - //print dol_print_date($dayinloopwithouthours, 'dayhour').' '; - //print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour').'
'; $statusofholidaytocheck = Holiday::STATUS_APPROVED; @@ -539,7 +530,6 @@ for ($idw = 0; $idw < 7; $idw++) $test = num_public_holiday($dayinloopfromfirstdaytoshowgmt, $dayinloopfromfirstdaytoshowgmt + 86400, $mysoc->country_code); if ($test) $isavailable[$dayinloopfromfirstdaytoshow] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday'); } -//var_dump($isavailable); @@ -659,7 +649,6 @@ print ''.$langs->trans("TimeSpent").($usertoprocess for ($idw = 0; $idw < 7; $idw++) { $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 - $dayinloop = dol_time_plus_duree($startday, $idw, 'd'); $cssweekend = ''; if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) // This is a day is not inside the setup of working days, so we use a week-end css. From 4246cd80f9cde7c61601b6e7cd6e0bf571ac9749 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 24 Nov 2021 16:27:01 +0100 Subject: [PATCH 009/177] FIX : Travis + Update dev --- htdocs/commande/stats/index.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index c93c8888aa9..307588adb32 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -46,7 +46,9 @@ if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) { accessforbidden(); } -$object_status = GETPOST('object_status', 'intcomma'); +$object_status = GETPOST('object_status', 'array'); +$object_status = implode(',', $object_status); + $typent_id = GETPOST('typent_id', 'int'); $categ_id = GETPOST('categ_id', 'categ_id'); @@ -95,12 +97,12 @@ dol_mkdir($dir); $stats = new CommandeStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0)); if ($mode == 'customer') { if ($object_status != '' && $object_status >= -1) { - $stats->where .= ' AND c.fk_statut IN ('.$db->escape(implode(',', $object_status)).')'; + $stats->where .= ' AND c.fk_statut IN ('.$db->sanitize($object_status).')'; } } if ($mode == 'supplier') { if ($object_status != '' && $object_status >= 0) { - $stats->where .= ' AND c.fk_statut IN ('.$db->escape(implode(',', $object_status)).')'; + $stats->where .= ' AND c.fk_statut IN ('.$db->sanitize($object_status).')'; } } From 400f6b244b5ef91b2752a4e158eec0a7da1b6c0c Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 11 Jan 2022 17:29:02 +0100 Subject: [PATCH 010/177] FIX user actions rights when mulit-company transverse mode is enabled --- htdocs/user/card.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 28fcda3871d..79a55f1604e 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1905,7 +1905,7 @@ else } } - if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { @@ -1917,7 +1917,7 @@ else } } elseif ($caneditpassword && !$object->ldap_sid && - (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { print ''; } @@ -1930,7 +1930,7 @@ else print ''; } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { print ''; } @@ -1940,7 +1940,7 @@ else print ''; } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { if ($object->email) print ''; else print ''; @@ -1949,13 +1949,13 @@ else // Enable user if ($user->id <> $id && $candisableuser && $object->statut == 0 && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { print ''; } // Disable user if ($user->id <> $id && $candisableuser && $object->statut == 1 && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { print ''; } @@ -1968,7 +1968,7 @@ else } // Delete if ($user->id <> $id && $candisableuser && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) { if ($user->admin || !$object->admin) // If user edited is admin, delete is possible on for an admin { From 99fb08240376c647b11bbd708bcb4457377ee9d7 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Mon, 24 Jan 2022 14:50:54 +0100 Subject: [PATCH 011/177] prevent access denied page --- htdocs/core/lib/security.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 3ea554a4a8f..b26c723a014 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -615,6 +615,9 @@ function checkUserAccessToObject($user, array $featuresarray, $objectid = 0, $ta if ($feature == 'task') { $feature = 'projet_task'; } + if ($feature == 'banque') { + $feature = 'fk_account@bank_account'; + } $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object From a15353fa333bd1bfa42a8a1657d2083a48aae89b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Feb 2022 13:42:40 +0100 Subject: [PATCH 012/177] FIX Disable customer type by default if type prospect/customer is disabled --- htdocs/societe/admin/societe.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index c87289da390..55c42cd4c28 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -225,10 +226,12 @@ if ($action == "setaskforshippingmet") { } } -//Activate "Disable prospect/customer type" +// Activate "Disable prospect/customer type" if ($action == "setdisableprospectcustomer") { $setdisableprospectcustomer = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); + // Remove customer type by default if type prospect/customer is disabled + $res = dolibarr_del_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $conf->entity); if (!($res > 0)) { $error++; } From 5a86f998904f386cb7af9dbb987c8244f5dc825a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Feb 2022 17:53:22 +0100 Subject: [PATCH 013/177] FIX Disable customer type by default if type prospect/customer is disabled --- htdocs/societe/admin/societe.php | 3 --- htdocs/societe/card.php | 41 +++++++++++++++++--------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 55c42cd4c28..ab6c6bd063d 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -4,7 +4,6 @@ * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -230,8 +229,6 @@ if ($action == "setaskforshippingmet") { if ($action == "setdisableprospectcustomer") { $setdisableprospectcustomer = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); - // Remove customer type by default if type prospect/customer is disabled - $res = dolibarr_del_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $conf->entity); if (!($res > 0)) { $error++; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 668d8199b16..8c2c7e85e56 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2008 Patrick Raguin * Copyright (C) 2010-2020 Juanjo Menent - * Copyright (C) 2011-2013 Alexandre Spangaro + * Copyright (C) 2011-2022 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud @@ -986,21 +986,24 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $modCodeFournisseur = new $module; // Define if customer/prospect or supplier status is set or not - if (GETPOST("type") != 'f') { + if (GETPOST("type", 'aZ') != 'f') { $object->client = -1; if (!empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { $object->client = 3; } } // Prospect / Customer - if (GETPOST("type") == 'c') { + if (GETPOST("type", 'aZ') == 'c') { if (!empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { $object->client = $conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; } else { $object->client = 3; } } - if (GETPOST("type") == 'p') { + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { + $object->client = 1; + } + if (GETPOST("type", 'aZ') == 'p') { $object->client = 2; } if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { @@ -1757,21 +1760,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (GETPOSTISSET('name')) { // We overwrite with values if posted - $object->name = GETPOST('name', 'alphanohtml'); - $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml'); - $object->client = GETPOST('client', 'int'); - $object->code_client = GETPOST('customer_code', 'alpha'); - $object->fournisseur = GETPOST('fournisseur', 'int'); - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); - $object->address = GETPOST('address', 'alphanohtml'); - $object->zip = GETPOST('zipcode', 'alphanohtml'); - $object->town = GETPOST('town', 'alphanohtml'); - $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; - $object->state_id = GETPOST('state_id', 'int'); - //$object->skype = GETPOST('skype', 'alpha'); - //$object->twitter = GETPOST('twitter', 'alpha'); - //$object->facebook = GETPOST('facebook', 'alpha'); - //$object->linkedin = GETPOST('linkedin', 'alpha'); + $object->name = GETPOST('name', 'alphanohtml'); + $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml'); + $object->client = GETPOST('client', 'int'); + $object->code_client = GETPOST('customer_code', 'alpha'); + $object->fournisseur = GETPOST('fournisseur', 'int'); + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->address = GETPOST('address', 'alphanohtml'); + $object->zip = GETPOST('zipcode', 'alphanohtml'); + $object->town = GETPOST('town', 'alphanohtml'); + $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; + $object->state_id = GETPOST('state_id', 'int'); + //$object->skype = GETPOST('skype', 'alpha'); + //$object->twitter = GETPOST('twitter', 'alpha'); + //$object->facebook = GETPOST('facebook', 'alpha'); + //$object->linkedin = GETPOST('linkedin', 'alpha'); $object->socialnetworks = array(); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { From 146b432acfed10fd9b57e835de5c48da6e1952af Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 24 Feb 2022 11:07:31 +0100 Subject: [PATCH 014/177] FIX: PR returns --- htdocs/commande/stats/index.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 307588adb32..19092e49a3c 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -45,9 +45,13 @@ if ($mode == 'customer' && !$user->rights->commande->lire) { if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) { accessforbidden(); } +if($mode == 'supplier'){ + $object_status = GETPOST('object_status', 'array:int'); + $object_status = implode(',', $object_status); +} else { + $object_status = GETPOST('object_status', 'intcomma'); +} -$object_status = GETPOST('object_status', 'array'); -$object_status = implode(',', $object_status); $typent_id = GETPOST('typent_id', 'int'); $categ_id = GETPOST('categ_id', 'categ_id'); From fa4e6bd93a068a52f6123fecb3e9062761f8f8a4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 24 Feb 2022 10:10:41 +0000 Subject: [PATCH 015/177] Fixing style errors. --- htdocs/commande/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 19092e49a3c..7d0f9fb5a3a 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -45,7 +45,7 @@ if ($mode == 'customer' && !$user->rights->commande->lire) { if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) { accessforbidden(); } -if($mode == 'supplier'){ +if ($mode == 'supplier') { $object_status = GETPOST('object_status', 'array:int'); $object_status = implode(',', $object_status); } else { From e3aae6d2e1343a905f34624368e59d377c0e7a3a Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 1 Mar 2022 10:50:22 +0100 Subject: [PATCH 016/177] FIX: object cloning: set unique extrafield values to null to prevent duplicates --- htdocs/core/class/commonobject.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a4fc828ef4b..b2d5ac8e068 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5307,8 +5307,15 @@ abstract class CommonObject $attributeLabel = $extrafields->attributes[$this->table_element]['label'][$attributeKey]; $attributeParam = $extrafields->attributes[$this->table_element]['param'][$attributeKey]; $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey]; + $attributeUnique = $extrafields->attributes[$this->table_element]['unique'][$attributeKey]; $attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey]; + // If we clone, we have to clean unique extrafields to prevent duplicates. + // This behaviour can be prevented by external code by changing $this->context['createfromclone'] value in createFrom hook + if (! empty($this->context['createfromclone']) && $this->context['createfromclone'] == 'createfromclone' && ! empty($attributeUnique)) { + $new_array_options[$key] = null; + } + // Similar code than into insertExtraFields if ($attributeRequired) { From 7239fa36052c68e8761b1753fd0806a485db608e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:19:47 +0100 Subject: [PATCH 017/177] FIX: project creation prevented if PROJECTLEADER contact role renamed, de-activated or deleted --- htdocs/projet/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 3f496de2f66..ab61a613734 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -174,10 +174,11 @@ if (empty($reshook)) if (!$error && $result > 0) { // Add myself as project leader - $typeofcontact = 'PROJECTLEADER'; // TODO If use rename this code in dictionary, the add_contact will generate an error. + $typeofcontact = 'PROJECTLEADER'; $result = $object->add_contact($user->id, $typeofcontact, 'internal'); - if ($result < 0) - { + + // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case + if ($result < 0 && $result != -3) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; From 801402f46aa7e085c7e6ea72b28c403c73f04718 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Mar 2022 11:58:52 +0100 Subject: [PATCH 018/177] fix: #20267 --- htdocs/comm/action/card.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 752868acb87..ee71cc48f07 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1439,6 +1439,10 @@ if ($id > 0) { $("#fullday").change(function() { setdatefields(); }); + $("#actioncode").change(function() { + if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired"); + else $("#dateend").removeClass("fieldrequired"); + }); })'; print ''."\n"; } @@ -1483,7 +1487,12 @@ if ($id > 0) { print ''.$langs->trans("EventOnFullDay").'fulldayevent ? ' checked' : '').'>'; // Date start - end - print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; + print ''; + print ''.$langs->trans("DateActionStart").''; + print ' - '; + print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").''; + print ''; + //print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); } elseif (GETPOST("afaire") == 2) { From e4f4a07fc669568f00895100905a5b13854974a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Fri, 4 Mar 2022 17:31:04 +0100 Subject: [PATCH 019/177] correct mass action "classify delivered" --- htdocs/commande/list.php | 8 ++++---- htdocs/langs/en_US/orders.lang | 3 +++ htdocs/langs/fr_FR/orders.lang | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b534d915914..2033b5626b2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -337,15 +337,15 @@ if ($action == 'shipped' && $permissiontoadd) { $error = 0; foreach ($toselect as $checked) { if ($objecttmp->fetch($checked)) { - if ($objecttmp->statut == 1) { + if ($objecttmp->statut == 1 || $objecttmp->statut == 2) { if ($objecttmp->cloture($user)) { - setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + setEventMessage($objecttmp->ref." ".$langs->trans('PassedInShippedStatus'), 'mesgs'); } else { - setEventMessage($langs->trans('CantBeValidated'), 'errors'); + setEventMessage($langs->trans('YouCantShipThis'), 'errors'); $error++; } } else { - setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); + setEventMessage($objecttmp->ref." ".$langs->trans('MustBeValidatedBefore'), 'errors'); $error++; } } else { diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 9018db40a5b..e94153db1a9 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -102,6 +102,9 @@ ConfirmCancelOrder=Are you sure you want to cancel this order? ConfirmMakeOrder=Are you sure you want to confirm you made this order on %s? GenerateBill=Generate invoice ClassifyShipped=Classify delivered +PassedInShippedStatus=classified delivered +YouCantShipThis=I can't classify this. Please check user permissions +MustBeValidatedBefore=must be Validated or Shipping in order to be classified as shipped DraftOrders=Draft orders DraftSuppliersOrders=Draft purchase orders OnProcessOrders=In process orders diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 16d1ecc2b27..3b0a3e38a7d 100644 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -102,6 +102,9 @@ ConfirmCancelOrder=Êtes-vous sûr de vouloir annuler cette commande ? ConfirmMakeOrder=Êtes-vous sûr de vouloir confirmer cette commande en date du %s ? GenerateBill=Facturer ClassifyShipped=Classer livrée +PassedInShippedStatus=classée livrée +YouCantShipThis=Classement impossible : veuillez vérifier les droits utilisateur +MustBeValidatedBefore=doit être Validée ou En cours de livraison pour pouvoir être classée livrée DraftOrders=Commandes brouillons DraftSuppliersOrders=Commandes fournisseurs brouillons OnProcessOrders=Commandes en cours de traitement From cfabaea645a9f8bbe0ad23b668ae770c26264ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Fri, 4 Mar 2022 17:38:39 +0100 Subject: [PATCH 020/177] translation refining --- htdocs/langs/en_US/orders.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index e94153db1a9..cbe9cca4d7a 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -104,7 +104,7 @@ GenerateBill=Generate invoice ClassifyShipped=Classify delivered PassedInShippedStatus=classified delivered YouCantShipThis=I can't classify this. Please check user permissions -MustBeValidatedBefore=must be Validated or Shipping in order to be classified as shipped +MustBeValidatedBefore=must be Validated or In process in order to be classified as shipped DraftOrders=Draft orders DraftSuppliersOrders=Draft purchase orders OnProcessOrders=In process orders From 87b187bded77fc30f63a30986a45619906366e97 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 8 Mar 2022 03:43:40 +0100 Subject: [PATCH 021/177] FIX #20279 Accountancy - PostGreSQL - Error on mass update lines already binded --- htdocs/accountancy/customer/lines.php | 6 +++--- htdocs/accountancy/supplier/lines.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index c45e7b27b0a..63314208883 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -121,9 +121,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { { $db->begin(); - $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l"; - $sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); - $sql1 .= ' WHERE l.rowid IN ('.implode(',', $changeaccount).')'; + $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet"; + $sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); + $sql1 .= ' WHERE rowid IN ('.implode(',', $changeaccount).')'; dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1); $resql1 = $db->query($sql1); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 30976287769..2edf3d01791 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -123,9 +123,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { { $db->begin(); - $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l"; - $sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); - $sql1 .= ' WHERE l.rowid IN ('.implode(',', $changeaccount).')'; + $sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; + $sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0'); + $sql1 .= ' WHERE rowid IN ('.implode(',', $changeaccount).')'; dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1); $resql1 = $db->query($sql1); From 397776d4a42edeaddd7a36ece03ae833020b276a Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 11:29:01 +0100 Subject: [PATCH 022/177] FIX check mandatory thirdparty fields for mass action --- htdocs/compta/facture/card.php | 39 ----------------- htdocs/compta/facture/class/facture.class.php | 42 ++++++++++++++++++- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d3e5a0062b0..573f1548b9a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -566,45 +566,6 @@ if (empty($reshook)) // Check parameters - // Check for mandatory fields in thirdparty (defined into setup) - $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); - foreach ($array_to_check as $key) - { - $keymin = strtolower($key); - $i = (int) preg_replace('/[^0-9]/', '', $key); - $vallabel = $object->thirdparty->$keymin; - - if ($i > 0) - { - if ($object->thirdparty->isACompany()) - { - // Check for mandatory prof id (but only if country is other than ours) - if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) - { - $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; - if (!$vallabel && !empty($conf->global->$idprof_mandatory)) - { - $langs->load("errors"); - $error++; - setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors'); - } - } - } - } else { - //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); - if ($key == 'EMAIL') - { - // Check for mandatory - if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($object->thirdparty->email)) - { - $langs->load("errors"); - $error++; - setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors'); - } - } - } - } - // Check for mandatory fields in invoice $array_to_check = array('REF_CUSTOMER'=>'RefCustomer'); foreach ($array_to_check as $key => $val) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 63a7b2f8e21..6ae01621b2e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2470,7 +2470,7 @@ class Facture extends CommonInvoice */ public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0) { - global $conf, $langs; + global $conf, $langs, $mysoc; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $productStatic = null; @@ -2512,6 +2512,46 @@ class Facture extends CommonInvoice return -1; } + // Check for mandatory fields in thirdparty (defined into setup) + $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); + foreach ($array_to_check as $key) + { + $keymin = strtolower($key); + $i = (int) preg_replace('/[^0-9]/', '', $key); + $vallabel = $this->thirdparty->$keymin; + + if ($i > 0) + { + if ($this->thirdparty->isACompany()) + { + // Check for mandatory prof id (but only if country is other than ours) + if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) + { + $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; + if (!$vallabel && !empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + } + } else { + if ($key == 'EMAIL') + { + // Check for mandatory + if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) + { + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + } + } + $this->db->begin(); // Check parameters From 19ad2310125a57069ae76ef774664ac051996c03 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 8 Mar 2022 12:02:05 +0100 Subject: [PATCH 023/177] FIX stickler-ci --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6ae01621b2e..00734ccb680 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2531,7 +2531,7 @@ class Facture extends CommonInvoice if (!$vallabel && !empty($conf->global->$idprof_mandatory)) { $langs->load("errors"); - $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } @@ -2544,7 +2544,7 @@ class Facture extends CommonInvoice if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) { $langs->load("errors"); - $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')'.' ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } From e9893716519da24ded648c4b51c872ffbccc148d Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 8 Mar 2022 14:49:26 +0100 Subject: [PATCH 024/177] FIX: better error management at product selling price update --- htdocs/product/class/product.class.php | 3 +- htdocs/product/price.php | 40 +++++++++++++------ .../class/ProductCombination.class.php | 20 +++++++++- 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ce7a5858a6a..cdab6a18c38 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2045,7 +2045,8 @@ class Product extends CommonObject $this->db->commit(); } else { $this->db->rollback(); - dol_print_error($this->db); + $this->error = $this->db->lasterror(); + return -1; } } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 9c084cd8352..704db910147 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -163,11 +163,15 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } - if ($error) - { + if (!$error) { //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2); $localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them. - $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode); + + if ($ret < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } if (!$error) @@ -400,14 +404,22 @@ if (empty($reshook)) { // Activating product price by quantity add a new price line with price_by_qty set to 1 $level = GETPOST('level', 'int'); - $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); + + if ($ret < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } // Unset Price by quantity if ($action == 'disable_price_by_qty') { // Disabling product price by quantity add a new price line with price_by_qty set to 0 $level = GETPOST('level', 'int'); - $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0); + $ret = $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 0); + + if ($ret < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } if ($action == 'edit_price_by_qty') @@ -1444,17 +1456,21 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul { $db->free($result); - // Il doit au moins y avoir la ligne de prix initial. - // On l'ajoute donc pour remettre a niveau (pb vieilles versions) - // We emulate the change of the price from interface with the same value than the one into table llx_product + // Il doit au moins y avoir la ligne de prix initial. + // On l'ajoute donc pour remettre a niveau (pb vieilles versions) + // We emulate the change of the price from interface with the same value than the one into table llx_product if (!empty($conf->global->PRODUIT_MULTIPRICES)) { - $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); + $ret = $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); } else { - $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); + $ret = $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); } - $result = $db->query($sql); - $num = $db->num_rows($result); + if ($ret < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + $result = $db->query($sql); + $num = $db->num_rows($result); + } } if ($num > 0) { diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 336503056f9..93960b62f9e 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -534,7 +534,14 @@ class ProductCombination $new_price += $variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code); + $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code); + + if ($ret < 0) { + $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; + return $ret; + } } } } else { @@ -556,7 +563,14 @@ class ProductCombination $new_price += $this->variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq); + $ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq); + + if ($ret < 0) { + $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; + return $ret; + } } $this->db->commit(); @@ -565,6 +579,8 @@ class ProductCombination } $this->db->rollback(); + $this->error = $child->error; + $this->errors = $child->errors; return -1; } From f837845c122840182ca1f52e0f5a50066accbc70 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 8 Mar 2022 15:07:02 +0100 Subject: [PATCH 025/177] FIX: still prevent project creation if PROJECTLEADER role unavailable, but with a specific error message --- htdocs/langs/en_US/projects.lang | 3 ++- htdocs/projet/card.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2aedbd53377..d93bbbe4a9d 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -267,4 +267,5 @@ NewInvoice=New invoice OneLinePerTask=One line per task OneLinePerPeriod=One line per period RefTaskParent=Ref. Parent Task -ProfitIsCalculatedWith=Profit is calculated using \ No newline at end of file +ProfitIsCalculatedWith=Profit is calculated using +ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types \ No newline at end of file diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index ab61a613734..8c921c0868e 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -178,7 +178,10 @@ if (empty($reshook)) $result = $object->add_contact($user->id, $typeofcontact, 'internal'); // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case - if ($result < 0 && $result != -3) { + if ($result == -3) { + setEventMessage('ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary', 'errors'); + $error++; + } elseif ($result < 0) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; From 8e944b8b6de998f1c8a03a22044015d7ffb7a9ee Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Tue, 8 Mar 2022 17:34:51 +0100 Subject: [PATCH 026/177] Fix: Error whem generating supplier payment pdf --- .../core/modules/supplier_payment/doc/pdf_standard.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index b6da2d4c294..1f32f645116 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García + * Copyright (C) 2022 Ferran Marcet * * 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 @@ -132,7 +133,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->db = $db; $this->name = "standard"; $this->description = $langs->trans('DocumentModelStandardPDF'); - $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + $this->update_main_doc_field = 0; // Save the name of generated file as the main doc when generating a doc with this template // Page size for A4 format $this->type = 'pdf'; From e06c38650796bbfb531ec98556f7a5cfd4bc2f3b Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 9 Mar 2022 11:32:07 +0100 Subject: [PATCH 027/177] Fix errors propagation and trigger position on delete proposal line --- htdocs/comm/propal/card.php | 5 ++- htdocs/comm/propal/class/propal.class.php | 52 +++++++++++++---------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 63f2977acdb..a77e242379f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -231,8 +231,11 @@ if (empty($reshook)) { // Remove line $result = $object->deleteline($lineid); // reorder lines - if ($result) { + if ($result > 0) { $object->line_order(true); + } else { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0142d0c1b7a..16db2b12723 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -980,6 +980,8 @@ class Propal extends CommonObject $this->db->commit(); return 1; } else { + $this->error = $line->error; + $this->errors = $line->errors; $this->db->rollback(); return -1; } @@ -4166,36 +4168,40 @@ class PropaleLigne extends CommonObjectLine $error = 0; $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".((int) $this->rowid); - dol_syslog("PropaleLigne::delete", LOG_DEBUG); - if ($this->db->query($sql)) { - // Remove extrafields - if (!$error) { - $this->id = $this->rowid; - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('LINEPROPAL_DELETE', $user); + if ($result < 0) { + $error++; } + } + // End call triggers - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('LINEPROPAL_DELETE', $user); - if ($result < 0) { - $this->db->rollback(); - return -1; + if (!$error) { + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int)$this->rowid); + dol_syslog("PropaleLigne::delete", LOG_DEBUG); + if ($this->db->query($sql)) { + // Remove extrafields + if (!$error) { + $this->id = $this->rowid; + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR); + } } + } else { + $this->error = $this->db->error() . " sql=" . $sql; + $error++; } - // End call triggers + } - $this->db->commit(); - - return 1; - } else { - $this->error = $this->db->error()." sql=".$sql; + if ($error) { $this->db->rollback(); return -1; + } else { + $this->db->commit(); + return 1; } } From 1f00dff4dac508c367f29025ef2302815670347b Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 9 Mar 2022 11:40:26 +0100 Subject: [PATCH 028/177] Correction Stickler CI / stickler-ci --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 16db2b12723..65a2e60777f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -4178,7 +4178,7 @@ class PropaleLigne extends CommonObjectLine // End call triggers if (!$error) { - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int)$this->rowid); + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid); dol_syslog("PropaleLigne::delete", LOG_DEBUG); if ($this->db->query($sql)) { // Remove extrafields From f2aaa27d7b25477380272a8ff84afa6115756a65 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 9 Mar 2022 17:41:48 +0100 Subject: [PATCH 029/177] FIX : when we use ajax select product fourn price on supplier order for example, unitprice should be rounded with MU and not MT --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 39d53e9dbc7..9c14bfeb866 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3400,7 +3400,7 @@ class Form 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, - 'price_ht'=>price2num($objp->unitprice, 'MT'), + 'price_ht'=>price2num($objp->unitprice, 'MU'), 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, From 45df52343b6d7048b615a70d0ff245be0a0948cc Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 13 Mar 2022 14:42:38 +0100 Subject: [PATCH 030/177] Fix Warning in htdocs/adherents/card.php Fix Warning: Creating default object from empty value in htdocs/adherents/card.php on line 1058 --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index e081b126dfe..b36781a99b1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -789,8 +789,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->country = $tmparray['label']; } + $soc = new Societe($db); if (!empty($socid)) { - $soc = new Societe($db); if ($socid > 0) $soc->fetch($socid); if (!($soc->id > 0)) { From 3eebbc0b14c8eb9f4d5a283651eb61b531ac9e29 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 14 Mar 2022 09:24:26 +0100 Subject: [PATCH 031/177] Fix #20263 Accountancy setup displayed with right Fix #20263 Accountancy setup is displayed only for user with rights->accounting->chartofaccount --- htdocs/accountancy/index.php | 151 ++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index f44b5bc72f8..c71e51ed427 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -93,88 +93,89 @@ if ($conf->accounting->enabled) print '
'; // hideobject is to start hidden print "
\n"; print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; - print "
\n"; print "
\n"; + if (!empty($user->rights->accounting->chartofaccount)){ + print "
\n"; print "
\n"; - print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; - print '
'; - print "
\n"; + print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; + print '
'; + print "
\n"; - // STEPS - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); - print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); - print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); - print "
\n"; + // STEPS + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); + print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); + print "
\n"; - print "
\n"; - print $langs->trans("AccountancyAreaDescActionOnceBis"); - print "
\n"; - print "
\n"; + print "
\n"; + print $langs->trans("AccountancyAreaDescActionOnceBis"); + print "
\n"; + print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; - print "
\n"; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; + print "
\n"; - $step++; - $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); - print "
\n"; - if (!empty($conf->tax->enabled)) - { - $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); - print "
\n"; + $step++; + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); + print "
\n"; + if (!empty($conf->tax->enabled)) + { + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); + print "
\n"; + } + /*if (! empty($conf->salaries->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + // htdocs/admin/salaries.php + print "
\n"; + print "
\n"; + }*/ + if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); + print "
\n"; + } + /* + if (! empty($conf->loan->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->don->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + } + if (! empty($conf->adherents->enabled)) + { + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print "
\n"; + }*/ + + $step++; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); + print "
\n"; + + print '
'; } - /*if (! empty($conf->salaries->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - // htdocs/admin/salaries.php - print "
\n"; - print "
\n"; - }*/ - if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); - print "
\n"; - } - /* - if (! empty($conf->loan->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->don->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->adherents->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - }*/ - - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); - print "
\n"; - - - print '
'; - + // Step A - E print "
\n"; From 19be5f662d9fdbdb443a665da539519778fa0084 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 14 Mar 2022 08:25:15 +0000 Subject: [PATCH 032/177] Fixing style errors. --- htdocs/accountancy/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index c71e51ed427..b0305050840 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -175,7 +175,7 @@ if ($conf->accounting->enabled) print '
'; } - + // Step A - E print "
\n"; From 1a20afe29b7ce023ddc3574a11c4f35b3dc93acf Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Mar 2022 16:11:34 +0100 Subject: [PATCH 033/177] Fix #20351 : top navbar no longer hiden in extarnal site --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index c0d4f0f3829..3037fe29c4f 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location !== window.parent.location ) { + if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 &&window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From 22706b70e9fde88e7a31e1d19a035fd4714dafaa Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Mar 2022 16:21:12 +0100 Subject: [PATCH 034/177] fix syntax error --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 3037fe29c4f..53e89182227 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 &&window.location !== window.parent.location ) { + if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From 92bfd6893d84d13410591d74b52c2ec6100b376e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 15 Mar 2022 09:10:41 +0100 Subject: [PATCH 035/177] fix:incoterm bad sql request --- htdocs/core/class/commonincoterm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonincoterm.class.php b/htdocs/core/class/commonincoterm.class.php index f98f3aaabad..f349925a00a 100644 --- a/htdocs/core/class/commonincoterm.class.php +++ b/htdocs/core/class/commonincoterm.class.php @@ -122,7 +122,7 @@ trait CommonIncoterm $this->fk_incoterms = $id_incoterm; $this->location_incoterms = $location; - $sql = 'SELECT libelle as label_incotermsFROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $sql = 'SELECT libelle as label_incoterms FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; $res = $this->db->query($sql); if ($res) { From 0899caf74d7ba437b539765cc6d49d71ab8b4668 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Mar 2022 19:23:17 +0100 Subject: [PATCH 036/177] Update lib_head.js.php --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 53e89182227..9a0eaf0e0ed 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -1138,7 +1138,7 @@ $(document).ready(function() { // Force to hide menus when page is inside an iFrame $(document).ready(function() { - if (window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { + if (window.location && window.location.pathname.indexOf("externalsite/frametop.php") == -1 && window.location !== window.parent.location ) { console.log("Page is detected to be into an iframe, we hide by CSS the menus"); // The page is in an iframe jQuery(".side-nav-vert, .side-nav, .websitebar").hide(); From 5a2ed9461fbffdc083f92039507e3d0ca11c08a9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Mar 2022 08:58:01 +0100 Subject: [PATCH 037/177] FIX Reception - Error on trackid --- htdocs/reception/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index e5f5fccffad..48b0953e399 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -679,7 +679,7 @@ if (empty($reshook)) { $triggersendname = 'RECEPTION_SENTBYMAIL'; $paramname = 'id'; $mode = 'emailfromreception'; - $trackid = 'shi'.$object->id; + $trackid = 'rec'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } From cfa3f2f4a13ab5d069d88306fb2a5f0ee6d05004 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Mar 2022 09:36:52 +0100 Subject: [PATCH 038/177] fix: prededefault setup values for public field (visibility) works --- htdocs/projet/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 89bdb013a32..c2f7df6c222 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -615,11 +615,11 @@ if ($action == 'create' && $user->rights->projet->creer) { } if (count($array) > 0) { - print $form->selectarray('public', $array, GETPOSTISSET('public') ? GETPOST('public') : $object->public, 0, 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray('public', $array, GETPOST('public'), 0, 0, 0, '', 0, 0, 0, '', '', 1); } else { - print ''; + print ''; - if ( (GETPOSTISSET('public') ? GETPOST('public') : $object->public)==0) { + if (GETPOST('public') == 0) { print $langs->trans("PrivateProject"); } else { print $langs->trans("SharedProject"); From 9514062868456d7270dedd492373d4f09dd68d98 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 16 Mar 2022 09:40:31 +0100 Subject: [PATCH 039/177] FIX: holiday monthly report: wrong 'Employee' and holiday type translations --- htdocs/holiday/month_report.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 6f8b0830b2a..fe98779c516 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; // Load translation files required by the page -$langs->loadLangs(array("holiday")); +$langs->loadLangs(array('holiday', 'hrm')); // Security check $socid = 0; @@ -106,7 +106,7 @@ if (empty($reshook)) $arrayfields = array( 'cp.ref'=>array('label'=>$langs->trans('Ref'), 'checked'=>1), 'cp.fk_user'=>array('label'=>$langs->trans('Employee'), 'checked'=>1), - 'ct.label'=>array('label'=>$langs->trans('Type'), 'checked'=>1), + 'cp.fk_type'=>array('label'=>$langs->trans('Type'), 'checked'=>1), 'cp.date_debut'=>array('label'=>$langs->trans('DateDebCP'), 'checked'=>1), 'cp.date_fin'=>array('label'=>$langs->trans('DateFinCP'), 'checked'=>1), 'used_days'=>array('label'=>$langs->trans('NbUseDaysCPShort'), 'checked'=>1), @@ -133,10 +133,9 @@ $search_month = GETPOST("remonth", 'int') ?GETPOST("remonth", 'int') : date("m", $search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time()); $year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month); -$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, ct.label, cp.description, cp.halfday"; +$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, cp.fk_type, cp.description, cp.halfday"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid"; $sql .= " WHERE cp.rowid > 0"; $sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED; $sql .= " AND ("; @@ -223,7 +222,7 @@ if (!empty($arrayfields['cp.fk_user']['checked'])) { } // Filter: Type -if (!empty($arrayfields['ct.label']['checked'])) { +if (!empty($arrayfields['cp.fk_type']['checked'])) { $typeleaves = $holidaystatic->getTypes(1, -1); $arraytypeleaves = array(); foreach ($typeleaves as $key => $val) @@ -261,7 +260,7 @@ print ''; print ''; if (!empty($arrayfields['cp.ref']['checked'])) print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.fk_user']['checked'])) print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder); -if (!empty($arrayfields['ct.label']['checked'])) print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder); +if (!empty($arrayfields['cp.fk_type']['checked'])) print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], 'cp.fk_type', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.date_debut']['checked'])) print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], 'cp.date_debut', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['cp.date_fin']['checked'])) print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], 'cp.date_fin', '', '', '', $sortfield, $sortorder); if (!empty($arrayfields['used_days']['checked'])) print_liste_field_titre($arrayfields['used_days']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder); @@ -323,7 +322,10 @@ else { if (!empty($arrayfields['cp.ref']['checked'])) print ''.$holidaystatic->getNomUrl(1, 1).''; if (!empty($arrayfields['cp.fk_user']['checked'])) print ''.$user->getFullName($langs).''; - if (!empty($arrayfields['ct.label']['checked'])) print ''.$obj->label.''; + + if (!empty($arrayfields['cp.fk_type']['checked'])) { + print ''.$arraytypeleaves[$obj->fk_type].''; + } if (!empty($arrayfields['cp.date_debut']['checked'])) { From 8a8462bf5785e8fb1aa165851b892a40edb0f047 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 16 Mar 2022 09:47:57 +0100 Subject: [PATCH 040/177] FIX: holiday monthly report: html entity codes showing in description with WYSIWYG activated --- htdocs/holiday/month_report.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index fe98779c516..b45444524f7 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -358,7 +358,10 @@ else { } if (!empty($arrayfields['used_days_month']['checked'])) print ''.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).''; - if (!empty($arrayfields['cp.description']['checked'])) print ''.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).''; + + if (!empty($arrayfields['cp.description']['checked'])) { + print ''.dolGetFirstLineOfText($obj->description).''; + } print ''; print ''; From 4f395a836ea3b180f38c2d6e42d2d0cd76096a63 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 16 Mar 2022 12:10:10 +0100 Subject: [PATCH 041/177] fix crabe multidir output --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index e26b03cdc46..00f91b6399b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -290,11 +290,11 @@ class pdf_crabe extends ModelePDFFactures // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->facture->dir_output; + $dir = $conf->facture->multidir_output[$conf->entity]; $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->facture->dir_output."/".$objectref; + $dir = $conf->facture->multidir_output[$object->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; } if (!file_exists($dir)) { From a028e795f746c077db56a7cc65114331ca627f17 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 16 Mar 2022 13:54:21 +0100 Subject: [PATCH 042/177] add missing colspan --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ee71cc48f07..0833929c82a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1491,7 +1491,7 @@ if ($id > 0) { print ''.$langs->trans("DateActionStart").''; print ' - '; print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").''; - print ''; + print ''; //print ''.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) { print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); From 536bae97e8dda9b720720bee954902cf24367b9c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 16 Mar 2022 15:49:49 +0100 Subject: [PATCH 043/177] FIX Update icon of module reception --- htdocs/admin/mails_templates.php | 2 +- htdocs/core/boxes/box_supplier_orders_awaiting_reception.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 0adc526d69e..3abeb0bde54 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -205,7 +205,7 @@ if (!empty($conf->expedition->enabled)) { $elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment')); } if (!empty($conf->reception->enabled)) { - $elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception')); + $elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception')); } if (!empty($conf->ficheinter->enabled)) { $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention')); diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 78d38455d83..6345e13cce0 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -162,7 +162,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => $delayIcon.' '.dol_print_date($delivery_date, 'day', 'tzuserrel').'', + 'text' => $delayIcon.' '.dol_print_date($delivery_date, 'day', 'tzuserrel').'', 'asis' => 1 ); From 319f21ef69327f6b83589e13ac54ee9db21678ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Mar 2022 16:23:27 +0100 Subject: [PATCH 044/177] Fix regression --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 00f91b6399b..eac6a8df762 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -290,11 +290,11 @@ class pdf_crabe extends ModelePDFFactures // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->facture->multidir_output[$conf->entity]; + $dir = empty($conf->facture->multidir_output[$conf->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$conf->entity]; $file = $dir."/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->facture->multidir_output[$object->entity]."/".$objectref; + $dir = (empty($conf->facture->multidir_output[$conf->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$conf->entity])."/".$objectref; $file = $dir."/".$objectref.".pdf"; } if (!file_exists($dir)) { From 800c490c12d52e22054226c32ac0c57f1bff5871 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Mar 2022 20:07:50 +0100 Subject: [PATCH 045/177] Fix travis --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 08fa830a6fe..ff28cbddf8b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ jobs: php: '5.6' env: DB=postgresql - if: type = pull_request OR type = push - php: '7.4' + php: '7.4.22' env: DB=mysql - if: type = push AND branch = develop php: nightly @@ -102,7 +102,7 @@ install: php-parallel-lint/php-console-highlighter ^0 \ squizlabs/php_codesniffer ^3 fi - if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then + if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then composer -n require phpunit/phpunit ^7 \ php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-console-highlighter ^0 \ @@ -237,7 +237,7 @@ before_script: # enable php-fpm - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - | - if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then + if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then # Copy the included pool sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf fi @@ -272,7 +272,7 @@ script: set -e #parallel-lint --exclude htdocs/includes --blame . # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then + if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \ --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \ --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \ @@ -287,7 +287,7 @@ script: # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file - if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then + if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e From 63b96e22b0998e165bb06750a789feb2cbdfbc40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Mar 2022 02:37:30 +0100 Subject: [PATCH 046/177] Update card.php --- htdocs/projet/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 8c921c0868e..04eba73b794 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -179,7 +179,7 @@ if (empty($reshook)) // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case if ($result == -3) { - setEventMessage('ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary', 'errors'); + setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors'); $error++; } elseif ($result < 0) { $langs->load("errors"); From c147acabe1ce7656258b695a7ba655dd9f04c5c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Mar 2022 02:37:46 +0100 Subject: [PATCH 047/177] Update projects.lang --- htdocs/langs/en_US/projects.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index d93bbbe4a9d..fbbef5fe2bd 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -268,4 +268,4 @@ OneLinePerTask=One line per task OneLinePerPeriod=One line per period RefTaskParent=Ref. Parent Task ProfitIsCalculatedWith=Profit is calculated using -ErrorPROJECTLEADERRoleMissingOrDeActivatedPleaseRestoreItInContactTypesDictionary=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types \ No newline at end of file +ErrorPROJECTLEADERRoleMissingRestoreIt=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types From 4aa93b363a993938c528018b858acaf7d53559da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Mar 2022 11:24:23 +0100 Subject: [PATCH 048/177] FIX #20387 --- htdocs/core/class/discount.class.php | 41 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index eaf4bc511c8..b4613d87fc8 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -54,12 +54,21 @@ class DiscountAbsolute public $fk_soc; public $discount_type; // 0 => customer discount, 1 => supplier discount - public $amount_ht; // - public $amount_tva; // - public $amount_ttc; // - public $multicurrency_amount_ht; - public $multicurrency_amount_tva; - public $multicurrency_amount_ttc; + + public $total_ht; + public $total_tva; + public $total_ttc; + public $amount_ht; // deprecated + public $amount_tva; // deprecated + public $amount_ttc; // deprecated + + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + public $multicurrency_amount_ht; // deprecated + public $multicurrency_amount_tva; // deprecated + public $multicurrency_amount_ttc; // deprecated + // Vat rate public $tva_tx; public $vat_src_code; @@ -163,13 +172,21 @@ class DiscountAbsolute $this->fk_soc = $obj->fk_soc; $this->discount_type = $obj->discount_type; - $this->amount_ht = $obj->amount_ht; - $this->amount_tva = $obj->amount_tva; - $this->amount_ttc = $obj->amount_ttc; + $this->total_ht = $obj->amount_ht; + $this->total_tva = $obj->amount_tva; + $this->total_ttc = $obj->amount_ttc; + // For backward compatibility + $this->amount_ht = $this->total_ht; + $this->amount_tva = $this->total_tva; + $this->amount_ttc = $this->total_ttc; - $this->multicurrency_amount_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht; - $this->multicurrency_amount_tva = $obj->multicurrency_amount_tva; - $this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc; + $this->multicurrency_total_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht; + $this->multicurrency_total_tva = $obj->multicurrency_amount_tva; + $this->multicurrency_total_ttc = $obj->multicurrency_amount_ttc; + // For backward compatibility + $this->multicurrency_amount_ht = $this->multicurrency_total_ht; + $this->multicurrency_amount_tva = $this->multicurrency_total_tva; + $this->multicurrency_amount_ttc = $this->multicurrency_total_ttc; $this->tva_tx = $obj->tva_tx; $this->vat_src_code = $obj->vat_src_code; From 49e53abf5325752e09ca1743d69d390948c6cbe9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Mar 2022 15:01:15 +0100 Subject: [PATCH 049/177] Fix pdf on letter format --- .../modules/facture/doc/pdf_crabe.modules.php | 5 +++-- .../modules/facture/doc/pdf_sponge.modules.php | 15 ++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index eac6a8df762..ee45641c57e 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -837,7 +837,7 @@ class pdf_crabe extends ModelePDFFactures $tab3_width = 80; $tab3_height = 4; if ($this->page_largeur < 210) { // To work with US executive format - $tab3_posx -= 20; + $tab3_posx -= 15; } $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1211,7 +1211,8 @@ class pdf_crabe extends ModelePDFFactures $col1x = 120; $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format - $col2x -= 20; + $col1x -= 15; + $col2x -= 10; } $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index ef63ad14a94..3134bbc63f5 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -498,7 +498,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->useTemplate($tplidx); } if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); } // $this->_pagefoot($pdf,$object,$outputlangs,1); $pdf->setTopMargin($tab_top_newpage); @@ -556,7 +556,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->useTemplate($tplidx); } if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); } $height_note = $posyafter - $tab_top_newpage; $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); @@ -578,7 +578,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->useTemplate($tplidx); } if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); } $posyafter = $tab_top_newpage; @@ -873,7 +873,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); } } @@ -891,7 +891,7 @@ class pdf_sponge extends ModelePDFFactures } $pagenb++; if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { - $this->_pagehead($pdf, $object, 0, $outputlangs); + $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis); } } } @@ -977,7 +977,7 @@ class pdf_sponge extends ModelePDFFactures $tab3_width = 80; $tab3_height = 4; if ($this->page_largeur < 210) { // To work with US executive format - $tab3_posx -= 20; + $tab3_posx -= 15; } $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1292,7 +1292,8 @@ class pdf_sponge extends ModelePDFFactures $col1x = 120; $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format - $col2x -= 20; + $col1x -= 15; + $col2x -= 10; } $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); From e46ee982ec0586b0b5ec23e43aa950a8adbaf3b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Mar 2022 18:53:50 +0100 Subject: [PATCH 050/177] FIX Option to manage packaging. FIX size/length/volume of reception Conflicts: htdocs/fourn/class/fournisseur.commande.class.php htdocs/install/mysql/migration/14.0.0-15.0.0.sql htdocs/langs/en_US/products.lang htdocs/reception/card.php htdocs/reception/class/reception.class.php --- htdocs/core/modules/modProduct.class.php | 2 +- htdocs/core/modules/modService.class.php | 2 +- .../class/fournisseur.commande.class.php | 98 ++++++++++++------- .../fourn/class/fournisseur.product.class.php | 25 ++--- .../install/mysql/migration/13.0.0-14.0.0.sql | 4 +- .../tables/llx_product_fournisseur_price.sql | 2 +- htdocs/langs/en_US/products.lang | 2 +- htdocs/langs/en_US/stocks.lang | 2 +- htdocs/langs/fr_FR/products.lang | 2 +- htdocs/product/fournisseurs.php | 3 +- htdocs/reception/card.php | 19 ++-- htdocs/reception/class/reception.class.php | 21 ++-- 12 files changed, 105 insertions(+), 77 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 5e51dd0344d..e5b0473597b 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -855,7 +855,7 @@ class modProduct extends DolibarrModules } if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( - 'sp.packagning'=>'1', + 'sp.packaging'=>'10', )); } diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 0390a23cc83..bdc3388da5c 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -786,7 +786,7 @@ class modService extends DolibarrModules } if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( - 'sp.packagning'=>'1', + 'sp.packagning'=>'10', )); } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 528bda30442..5f671599c50 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -32,7 +32,7 @@ * \brief File of class to manage suppliers orders */ -include_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (!empty($conf->productbatch->enabled)) { require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; @@ -431,6 +431,7 @@ class CommandeFournisseur extends CommonOrder * Lines */ $result = $this->fetch_lines(); + if ($result < 0) { return -1; } else { @@ -453,7 +454,7 @@ class CommandeFournisseur extends CommonOrder { global $conf; // phpcs:enable - //$result=$this->fetch_lines(); + $this->lines = array(); $sql = "SELECT l.rowid, l.ref as ref_supplier, l.fk_product, l.product_type, l.label, l.description, l.qty,"; @@ -464,22 +465,12 @@ class CommandeFournisseur extends CommonOrder $sql .= " l.fk_unit,"; $sql .= " l.date_start, l.date_end,"; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc'; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty"; - } $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND l.qty >= pfp.quantity AND pfp.fk_soc = ".((int) $this->socid); - } - $sql .= " WHERE l.fk_commande = ".$this->id; + $sql .= " WHERE l.fk_commande = ".((int) $this->id); if ($only_product) { $sql .= ' AND p.fk_product_type = 0'; } - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql.= " GROUP BY l.rowid"; - $sql.= " HAVING (max_qty = MAX(pfp.quantity) OR max_qty IS NULL)"; - } $sql .= " ORDER BY l.rang, l.rowid"; //print $sql; @@ -527,11 +518,34 @@ class CommandeFournisseur extends CommonOrder $line->ref_supplier = $objp->ref_supplier; // The supplier ref of price when product was added. May have change since if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $line->fk_fournprice = $objp->fk_pfp; - $line->packaging = $objp->packaging; + // TODO We should not fetch this properties into the fetch_lines. This is NOT properties of a line. + // Move this into another method and call it when required. + + // Take better packaging for $objp->qty (first supplier ref quantity <= $objp->qty) + $sqlsearchpackage = 'SELECT rowid, packaging FROM '.MAIN_DB_PREFIX."product_fournisseur_price"; + $sqlsearchpackage .= ' WHERE entity IN ('.getEntity('product_fournisseur_price').")"; + $sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product); + $sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'"; + $sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified + $sqlsearchpackage .= " AND fk_soc = ".((int) $this->socid); + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first + $sqlsearchpackage .= " LIMIT 1"; + + $resqlsearchpackage = $this->db->query($sqlsearchpackage); + if ($resqlsearchpackage) { + $objsearchpackage = $this->db->fetch_object($resqlsearchpackage); + if ($objsearchpackage) { + $line->fk_fournprice = $objsearchpackage->rowid; + $line->packaging = $objsearchpackage->packaging; + } + } else { + $this->error = $this->db->lasterror(); + return -1; + } } - $line->date_start = $this->db->jdate($objp->date_start); + $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); $line->fk_unit = $objp->fk_unit; @@ -1807,6 +1821,7 @@ class CommandeFournisseur extends CommonOrder if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { $prod = new Product($this->db, $fk_product); $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); + if ($qty < $prod->packaging) { $qty = $prod->packaging; } else { @@ -3515,25 +3530,18 @@ class CommandeFournisseurLigne extends CommonOrderLine global $conf; $sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_product, cd.product_type, cd.description, cd.qty, cd.tva_tx, cd.special_code,'; - $sql .= ' cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.ref,'; + $sql .= ' cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.ref as ref_supplier,'; $sql .= ' cd.remise, cd.remise_percent, cd.subprice,'; $sql .= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,'; $sql .= ' cd.total_localtax1, cd.total_localtax2,'; $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,'; $sql .= ' cd.date_start, cd.date_end, cd.fk_unit,'; - $sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc'; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty"; - } - $sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; + $sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,'; + $sql .= ' c.fk_soc as socid'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseur as c, '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn AND cd.qty >= pfp.quantity"; - } - $sql .= ' WHERE cd.rowid = '.((int) $rowid); - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql .= " GROUP BY cd.rowid HAVING (max_qty = MAX(pfp.quantity) OR max_qty IS NULL)"; - } + $sql .= ' WHERE cd.fk_commande = c.rowid AND cd.rowid = '.((int) $rowid); + $result = $this->db->query($sql); if ($result) { $objp = $this->db->fetch_object($result); @@ -3544,8 +3552,8 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->fk_commande = $objp->fk_commande; $this->desc = $objp->description; $this->qty = $objp->qty; - $this->ref_fourn = $objp->ref; - $this->ref_supplier = $objp->ref; + $this->ref_fourn = $objp->ref_supplier; + $this->ref_supplier = $objp->ref_supplier; $this->subprice = $objp->subprice; $this->tva_tx = $objp->tva_tx; $this->localtax1_tx = $objp->localtax1_tx; @@ -3569,9 +3577,33 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->product_ref = $objp->product_ref; $this->product_label = $objp->product_label; $this->product_desc = $objp->product_desc; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $this->packaging = $objp->packaging; - $this->fk_fournprice = $objp->fk_pfp; + // TODO We should not fetch this properties into the fetch_lines. This is NOT properties of a line. + // Move this into another method and call it when required. + + // Take better packaging for $objp->qty (first supplier ref quantity <= $objp->qty) + $sqlsearchpackage = 'SELECT rowid, packaging FROM '.MAIN_DB_PREFIX."product_fournisseur_price"; + $sqlsearchpackage .= ' WHERE entity IN ('.getEntity('product_fournisseur_price').")"; + $sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product); + $sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'"; + $sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified + $sqlsearchpackage .= " AND fk_soc = ".((int) $objp->socid); + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first + $sqlsearchpackage .= " LIMIT 1"; + + $resqlsearchpackage = $this->db->query($sqlsearchpackage); + if ($resqlsearchpackage) { + $objsearchpackage = $this->db->fetch_object($resqlsearchpackage); + if ($objsearchpackage) { + $this->fk_fournprice = $objsearchpackage->rowid; + $this->packaging = $objsearchpackage->packaging; + } + } else { + $this->error = $this->db->lasterror(); + return -1; + } } $this->date_start = $this->db->jdate($objp->date_start); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 6232b901382..ffb9bc06229 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -317,7 +317,9 @@ class ProductFournisseur extends Product $qty = price2num($qty, 'MS'); $unitBuyPrice = price2num($buyprice / $qty, 'MU'); - $packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS'); + // We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50. + //$packaging = price2num(((empty($this->packaging) || $this->packaging < $qty) ? $qty : $this->packaging), 'MS'); + $packaging = price2num((empty($this->packaging) ? $qty : $this->packaging), 'MS'); $error = 0; $now = dol_now(); @@ -405,6 +407,7 @@ class ProductFournisseur extends Product $sql .= ", packaging = ".(empty($packaging) ? 1 : $packaging); } $sql .= " WHERE rowid = ".((int) $this->product_fourn_price_id); + //print $sql;exit; // TODO Add price_base_type and price_ttc dol_syslog(get_class($this).'::update_buyprice update knowing id of line = product_fourn_price_id = '.$this->product_fourn_price_id, LOG_DEBUG); @@ -593,13 +596,7 @@ class ProductFournisseur extends Product $this->supplier_barcode = $obj->barcode; $this->supplier_fk_barcode_type = $obj->fk_barcode_type; } - - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $this->packaging = $obj->packaging; - if ($this->packaging < $this->fourn_qty) { - $this->packaging = $this->fourn_qty; - } - } + $this->packaging = $obj->packaging; if (empty($ignore_expression) && !empty($this->fk_supplier_price_expression)) { $priceparser = new PriceParser($this->db); @@ -647,10 +644,7 @@ class ProductFournisseur extends Product $sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,"; $sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; - $sql .= " pfp.barcode, pfp.fk_barcode_type"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql .= ", pfp.packaging"; - } + $sql .= " pfp.barcode, pfp.fk_barcode_type, pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; $sql .= " AND pfp.fk_soc = s.rowid AND pfp.fk_product = p.rowid"; @@ -704,12 +698,7 @@ class ProductFournisseur extends Product $prodfourn->fourn_multicurrency_id = $record["fk_multicurrency"]; $prodfourn->fourn_multicurrency_code = $record["multicurrency_code"]; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $prodfourn->packaging = $record["packaging"]; - if ($prodfourn->packaging < $prodfourn->fourn_qty) { - $prodfourn->packaging = $prodfourn->fourn_qty; - } - } + $prodfourn->packaging = $record["packaging"]; if (!empty($conf->barcode->enabled)) { $prodfourn->supplier_barcode = $record["barcode"]; diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index e8a3880ff40..0b6d36d6743 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -84,8 +84,8 @@ UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'a UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'cameleo'; DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo'); -ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL; -ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL; +ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL; +ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL; -- For v14 diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index 2e9c88bd5ca..e5a0865ef68 100644 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -50,7 +50,7 @@ create table llx_product_fournisseur_price import_key varchar(14), -- Import key delivery_time_days integer, supplier_reputation varchar(10), - packaging varchar(64) DEFAULT NULL, + packaging real DEFAULT NULL, fk_multicurrency integer, multicurrency_code varchar(255), multicurrency_tx double(24,8) DEFAULT 1, diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index fecbe7450c2..7173d465ff2 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -345,7 +345,7 @@ UseProductFournDesc=Add a feature to define the descriptions of products defined ProductSupplierDescription=Vendor description for the product UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents) PackagingForThisProduct=Packaging -PackagingForThisProductDesc=On supplier order, you will automaticly order this quantity (or a multiple of this quantity). Cannot be less than minimum buying quantity +PackagingForThisProductDesc=You will automaticaly purchase a multiple of this quantity. QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging #Attributes diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 16917384460..17ccbc35f83 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -176,7 +176,7 @@ ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock cor ProductStockWarehouseUpdated=Stock limit for alert and desired optimal stock correctly updated ProductStockWarehouseDeleted=Stock limit for alert and desired optimal stock correctly deleted AddNewProductStockWarehouse=Set new limit for alert and desired optimal stock -AddStockLocationLine=Decrease quantity then click to add another warehouse for this product +AddStockLocationLine=Decrease quantity then click to split the line InventoryDate=Inventory date Inventories=Inventories NewInventory=New inventory diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index cec5c583ac9..54540b14109 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -346,7 +346,7 @@ UseProductFournDesc=Ajouter une fonctionnalité pour définir la description pro ProductSupplierDescription=Description du fournisseur du produit UseProductSupplierPackaging=Utiliser le conditionnement/emballage sur les prix fournisseur (recalculer les quantités en fonction de l'emballage défini sur le prix fournisseur lors de l'ajout / mise à jour de la ligne dans les documents fournisseurs) PackagingForThisProduct=Emballage -PackagingForThisProductDesc=Sur une commande fournisseur, vous commanderez automatiquement cette quantité ou un multiple. Vous ne pourrez pas saisir un montant inférieur +PackagingForThisProductDesc=Sur une commande fournisseur, vous commanderez automatiquement cette quantité ou un multiple. QtyRecalculatedWithPackaging=La quantité de la ligne a été recalculée en fonction de l'emballage du fournisseur #Attributes diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 9aaa0aa2c8c..ea11843b625 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -320,9 +320,10 @@ if (empty($reshook)) { if (empty($packaging)) { $packaging = 1; } + /* We can have a puchase ref that need to buy 100 min for a given price and with a packaging of 50. if ($packaging < $quantity) { $packaging = $quantity; - } + }*/ $object->packaging = $packaging; if (!empty($conf->multicurrency->enabled)) { diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 48b0953e399..fda5a3910b7 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -254,10 +254,10 @@ if (empty($reshook)) { $object->origin = $origin; $object->origin_id = $origin_id; $object->fk_project = GETPOST('projectid', 'int'); - $object->weight = GETPOST('weight', 'int') == '' ? "NULL" : GETPOST('weight', 'int'); - $object->sizeH = GETPOST('sizeH', 'int') == '' ? "NULL" : GETPOST('sizeH', 'int'); - $object->sizeW = GETPOST('sizeW', 'int') == '' ? "NULL" : GETPOST('sizeW', 'int'); - $object->sizeS = GETPOST('sizeS', 'int') == '' ? "NULL" : GETPOST('sizeS', 'int'); + $object->weight = GETPOST('weight', 'int') == '' ? null : GETPOST('weight', 'int'); + $object->sizeH = GETPOST('sizeH', 'int') == '' ? null : GETPOST('sizeH', 'int'); + $object->sizeW = GETPOST('sizeW', 'int') == '' ? null : GETPOST('sizeW', 'int'); + $object->sizeS = GETPOST('sizeS', 'int') == '' ? null : GETPOST('sizeS', 'int'); $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); @@ -1921,15 +1921,16 @@ if ($action == 'create') { // Warehouse source if (!empty($conf->stock->enabled)) { - print ''; - if ($lines[$i]->fk_entrepot > 0) { $entrepot = new Entrepot($db); $entrepot->fetch($lines[$i]->fk_entrepot); - print $entrepot->getNomUrl(1); - } - print ''; + print ''; + print $entrepot->getNomUrl(1); + print ''; + } else { + print ''; + } } // Batch number managment diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 5fb8e3b8af0..0a025973a6d 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -236,7 +236,6 @@ class Reception extends CommonObject $this->user = $user; - $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."reception ("; @@ -273,12 +272,12 @@ class Reception extends CommonObject $sql .= ", ".$this->fk_project; $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : "null"); $sql .= ", '".$this->db->escape($this->tracking_number)."'"; - $sql .= ", ".$this->weight; - $sql .= ", ".$this->sizeS; // TODO Should use this->trueDepth - $sql .= ", ".$this->sizeW; // TODO Should use this->trueWidth - $sql .= ", ".$this->sizeH; // TODO Should use this->trueHeight - $sql .= ", ".$this->weight_units; - $sql .= ", ".$this->size_units; + $sql .= ", ".(is_null($this->weight) ? "NULL" : ((double) $this->weight)); + $sql .= ", ".(is_null($this->sizeS) ? "NULL" : ((double) $this->sizeS)); // TODO Should use this->trueDepth + $sql .= ", ".(is_null($this->sizeW) ? "NULL" : ((double) $this->sizeW)); // TODO Should use this->trueWidth + $sql .= ", ".(is_null($this->sizeH) ? "NULL" : ((double) $this->sizeH)); // TODO Should use this->trueHeight + $sql .= ", ".(is_null($this->weight_units) ? "NULL" : ((double) $this->weight_units)); + $sql .= ", ".(is_null($this->size_units) ? "NULL" : ((double) $this->size_units)); $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null"); $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null"); $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null"); @@ -727,8 +726,14 @@ class Reception extends CommonObject $line->qty = $qty; $supplierorderline = new CommandeFournisseurLigne($this->db); - $supplierorderline->fetch($id); + $result = $supplierorderline->fetch($id); + if ($result <= 0) { + $this->error = $supplierorderline->error; + $this->errors = $supplierorderline->errors; + return -1; + } + $fk_product = 0; if (!empty($conf->stock->enabled) && !empty($supplierorderline->fk_product)) { $fk_product = $supplierorderline->fk_product; From 62ca286ac92c24ecbcf02c3b789599db1d382ec5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Mar 2022 12:07:00 +0100 Subject: [PATCH 051/177] Try a fix to solve backup that fails on large database --- htdocs/core/class/utils.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 17afecde14a..9907ae29834 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -356,10 +356,19 @@ class Utils dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_INFO); + + /* If value has been forced with a php_admin_value, this has no effect. Example of value: '512M' */ + $MemoryLimit = getDolGlobalString('MAIN_MEMORY_LIMIT_DUMP'); + if (!empty($MemoryLimit)) { + @ini_set('memory_limit', $MemoryLimit); + } + + // TODO Replace with executeCLI function if ($execmethod == 1) { $output_arr = array(); $retval = null; + exec($fullcommandclear, $output_arr, $retval); if ($retval != 0) { From 8ef55eae0734cfc71f80082a791dc08625333eeb Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:04:05 +0100 Subject: [PATCH 052/177] FIX: propal list: missing translation keys for transifex --- htdocs/langs/en_US/propal.lang | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 557df2f840f..afab92970ef 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -84,6 +84,17 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +IsNotADraft=is not a draft +PassedInOpenStatus=has been validated +CantBeSign=cannot be signed +Sign=Sign +Signed=signed +CantBeSign=cannot be signed +CantBeValidated=cannot be validated +ConfirmMassValidation=Bulk Validate confirmation +ConfirmMassSignature=Bulk Signature confirmation +ConfirmMassValidationQuestion=Are you sure you want to validate the selected records ? +ConfirmMassSignatureQuestion=Are you sure you want to sign the selected records ? IdProposal=Proposal ID IdProduct=Product ID PrParentLine=Proposal Parent Line From d4f55ae1167087452c177cdded0ae7b5973131af Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:11:10 +0100 Subject: [PATCH 053/177] FIX: propal list: bad error management in mass actions --- htdocs/comm/propal/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index d92ec87ca29..5b25fd89819 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -272,9 +272,9 @@ if ($action == 'validate') { $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) { - if ($tmpproposal->valid($user)) { + if ($tmpproposal->valid($user) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); } else { setEventMessage($langs->trans('CantBeValidated'), 'errors'); @@ -285,7 +285,7 @@ if ($action == 'validate') { $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } @@ -305,14 +305,14 @@ if ($action == "sign") { $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { $tmpproposal->statut = $tmpproposal::STATUS_SIGNED; - if ($tmpproposal->update($user)) { + if ($tmpproposal->update($user) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } else { @@ -320,7 +320,7 @@ if ($action == "sign") { $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } From cf64fc288d36fb1bbf2433949b3e831dcf3cf580 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:49:03 +0100 Subject: [PATCH 054/177] FIX: propal list: missing not signed massaction translation keys for transifex --- htdocs/langs/en_US/propal.lang | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index edbc08236d3..86ee94ceee3 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -85,6 +85,11 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +NoSign=Set not signed +NoSigned=set not signed +CantBeSign=cannot be set not signed +ConfirmMassNoSignature=Bulk Not signed confirmation +ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ? IdProposal=Proposal ID IdProduct=Product ID PrParentLine=Proposal Parent Line From 3aae8cc3bbc10f5f07333e54f3b7430146808a4b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 10:54:04 +0100 Subject: [PATCH 055/177] FIX: propal list: bad error management for set not ssigned mass action --- htdocs/comm/propal/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3e467539c88..16a754a61bb 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -405,27 +405,28 @@ if ($action == "sign" && $permissiontoclose) { } } } + if ($action == "nosign" && $permissiontoclose) { if (GETPOST('confirm') == 'yes') { $tmpproposal = new Propal($db); $db->begin(); $error = 0; foreach ($toselect as $checked) { - if ($tmpproposal->fetch($checked)) { + if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED; - if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) { + if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs'); } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } else { - setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors'); + setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors'); $error++; } } else { - dol_print_error($db); + setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors'); $error++; } } From 5914f2ac65622478c06d6f396e601e0a8c365f90 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 22 Mar 2022 11:17:27 +0100 Subject: [PATCH 056/177] FIX include discount price for PMP after a reception (Issue #20029) --- htdocs/reception/class/reception.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index ef12d844ddc..2b458f9d57c 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -554,7 +554,7 @@ class Reception extends CommonObject // Loop on each product line to add a stock movement // TODO in future, reception lines may not be linked to order line - $sql = "SELECT cd.fk_product, cd.subprice,"; + $sql = "SELECT cd.fk_product, cd.subprice, cd.remise_percent,"; $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; $sql .= " ed.eatby, ed.sellby, ed.batch"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; @@ -580,12 +580,18 @@ class Reception extends CommonObject $mouvS = new MouvementStock($this->db); $mouvS->origin = &$this; + // get unit price with discount + $up_ht_disc = $obj->subprice; + if (!empty($obj->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP)) { + $up_ht_disc = price2num($up_ht_disc * (100 - $obj->remise_percent) / 100, 'MU'); + } + if (empty($obj->batch)) { // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref)); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref)); if ($result < 0) { $error++; $this->errors[] = $mouvS->error; @@ -597,7 +603,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) - $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $up_ht_disc, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); if ($result < 0) { $error++; $this->errors[] = $mouvS->error; From 344c29ae151fa0c7cb1ba865802c4ce1a69966f7 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 11:35:37 +0100 Subject: [PATCH 057/177] FIX: trans --- htdocs/langs/en_US/propal.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 86ee94ceee3..c7332005f86 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -87,7 +87,7 @@ CaseFollowedBy=Case followed by SignedOnly=Signed only NoSign=Set not signed NoSigned=set not signed -CantBeSign=cannot be set not signed +CantBeNoSign=cannot be set not signed ConfirmMassNoSignature=Bulk Not signed confirmation ConfirmMassNoSignatureQuestion=Are you sure you want to set not signed the selected records ? IdProposal=Proposal ID From 100c48372b7f806dbac0a6e43725221ac306944a Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Mar 2022 17:13:48 +0100 Subject: [PATCH 058/177] FIX: permit access to medias when logged in a different entity --- htdocs/viewimage.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 69d0b38571c..fda4cdfbf20 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -186,6 +186,13 @@ $refname = basename(dirname($original_file)."/"); // Security check if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart', 0, 0, 1); +// When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output +// is not set on the requested entity, but they are public documents, so reset entity +if ($modulepart === 'medias' && $entity != $conf->entity) { + $conf->entity = $entity; + $conf->setValues($db); +} + $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; From 6abeb2804eefa77cc9b1bce8ebad1534c147147e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:47:12 +0100 Subject: [PATCH 059/177] Fix phpcs --- htdocs/comm/propal/list.php | 1 - htdocs/projet/card.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ae9ff62c5b0..f193a9ab87b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -382,7 +382,6 @@ if ($action == "sign" && $permissiontoclose) { foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { - $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;; if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6ce6e20e753..93344b39cd0 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -186,7 +186,7 @@ if (empty($reshook)) { // -3 means type not found (PROJECTLEADER renamed, de-activated or deleted), so don't prevent creation if it has been the case if ($result == -3) { setEventMessage('ErrorPROJECTLEADERRoleMissingRestoreIt', 'errors'); - $error++; + $error++; } elseif ($result < 0) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); From 6438a9996036f7e47e1c87e5d0761889fa91f947 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:48:51 +0100 Subject: [PATCH 060/177] Fix php syntax --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f193a9ab87b..7a8fe187570 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -382,7 +382,7 @@ if ($action == "sign" && $permissiontoclose) { foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked) > 0) { if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { - $tmpproposal->statut = $tmpproposal::STATUS_SIGNED;; + $tmpproposal->statut = $tmpproposal::STATUS_SIGNED; if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs'); } else { From 6c28426b3aacd6917f39196b3fe0eab83cdd037c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:49:34 +0100 Subject: [PATCH 061/177] Fix tab --- htdocs/viewimage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 45f46159aa8..db03a0a79e6 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -113,7 +113,7 @@ if (is_numeric($entity)) { * @ignore * @return void */ -function llxHeader() +function llxHeader()sql { } /** @@ -237,8 +237,8 @@ if (empty($modulepart)) { // When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output // is not set on the requested entity, but they are public documents, so reset entity if ($modulepart === 'medias' && $entity != $conf->entity) { - $conf->entity = $entity; - $conf->setValues($db); + $conf->entity = $entity; + $conf->setValues($db); } $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname); From 154069179b5958ccde7531e58c43f38bcfb4594d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Mar 2022 11:51:06 +0100 Subject: [PATCH 062/177] Fix php syntax --- htdocs/viewimage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index db03a0a79e6..feec8acf254 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -113,7 +113,7 @@ if (is_numeric($entity)) { * @ignore * @return void */ -function llxHeader()sql +function llxHeader() { } /** From 1c43617d9363eb26a4a65bb0c39bb87531fb103f Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 24 Mar 2022 17:34:50 +0100 Subject: [PATCH 063/177] FIX: contact card: single extrafield update failed --- htdocs/contact/card.php | 23 +++++++++++++++++++++++ htdocs/core/tpl/extrafields_view.tpl.php | 3 +++ 2 files changed, 26 insertions(+) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 0c95ecb7fd4..28a61ce5190 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -479,6 +479,29 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } + // Update extrafields + if ($action == 'update_extras' && ! empty($user->rights->societe->contact->creer)) { + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); + if ($ret < 0) { + $error++; + } + + if (!$error) { + $result = $object->insertExtraFields('CONTACT_MODIFY'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + if ($error) { + $action = 'edit_extras'; + } + } + // Actions to send emails $triggersendname = 'CONTACT_SENTBYMAIL'; $paramname = 'id'; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 40ea3e0ce50..7f1ee1f37cb 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -150,6 +150,9 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if ($object->element == 'mo') $permok = $user->rights->mrp->write; + if ($object->element == 'contact') { + $permok = $user->rights->societe->contact->creer; + } $isdraft = ((isset($object->statut) && $object->statut == 0) || (isset($object->status) && $object->status == 0)); if (($isdraft || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$tmpkeyextra])) From ab2e6ddf4359584ff1d33ecaccdd1d219c7536d2 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 25 Mar 2022 16:41:41 +0100 Subject: [PATCH 064/177] FIX : forgotten form confirm before various payment delete --- htdocs/compta/bank/various_payment/card.php | 8 +++++++- htdocs/langs/en_US/compta.lang | 4 +++- htdocs/langs/fr_FR/compta.lang | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index dd734074481..def2abba3a1 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -179,7 +179,7 @@ if (empty($reshook)) { $action = 'create'; } - if ($action == 'delete') { + if ($action == 'confirm_delete' && $confirm == 'yes') { $result = $object->fetch($id); if ($object->rappro == 0) { @@ -548,6 +548,12 @@ if ($id) { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); } + // Confirmation of the removal of the Social Contribution + if ($action == 'delete') { + $text = $langs->trans('ConfirmDeleteVariousPayment'); + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2); + } + print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); $morehtmlref = '
'; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index c5e1a58d243..efe1e51482b 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -146,9 +146,11 @@ ConfirmPaySalary=Are you sure you want to classify this salary card as paid? DeleteSocialContribution=Delete a social or fiscal tax payment DeleteVAT=Delete a VAT declaration DeleteSalary=Delete a salary card +DeleteVariousPayment=Delete a various payment ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fiscal tax payment ? ConfirmDeleteVAT=Are you sure you want to delete this VAT declaration ? -ConfirmDeleteSalary=Are you sure you want to delete this salary? +ConfirmDeleteSalary=Are you sure you want to delete this salary ? +ConfirmDeleteVariousPayment=Are you sure you want to delete this various payment ? ExportDataset_tax_1=Social and fiscal taxes and payments CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 280069f5cf9..be7a5f464ff 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -146,9 +146,11 @@ ConfirmPaySalary=Voulez-vous vraiment classer ce salaire comme payé ? DeleteSocialContribution=Effacer une charge fiscale ou sociale DeleteVAT=Supprimer une déclaration de TVA DeleteSalary=Supprimer un salaire +DeleteVariousPayment=Supprimer un paiement divers ConfirmDeleteSocialContribution=Voulez-vous vraiment supprimer ce paiement de taxe sociale / fiscale? ConfirmDeleteVAT=Voulez-vous vraiment supprimer cette déclaration de TVA ? ConfirmDeleteSalary=Êtes-vous sûr de vouloir supprimer ce salaire ? +ConfirmDeleteVariousPayment=Voulez-vous vraiment supprimer ce paiement divers ? ExportDataset_tax_1=Taxes sociales et fiscales et paiements CalcModeVATDebt=Mode %sTVA sur débit%s. CalcModeVATEngagement=Mode %sTVA sur encaissement%s. From fdf8a3f4adc655d9e51ac71e1e84f02e93170d82 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 25 Mar 2022 16:43:54 +0100 Subject: [PATCH 065/177] FIX : comment --- htdocs/compta/bank/various_payment/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index def2abba3a1..a2c6c2b21ae 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -548,7 +548,7 @@ if ($id) { print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); } - // Confirmation of the removal of the Social Contribution + // Confirmation of the removal of the Various Payment if ($action == 'delete') { $text = $langs->trans('ConfirmDeleteVariousPayment'); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2); From 8a7b97bed150e33f37e9601ef1b75e2fd42f644e Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 25 Mar 2022 16:47:41 +0100 Subject: [PATCH 066/177] FIX check thirdparty object loaded and properties exist --- htdocs/compta/facture/class/facture.class.php | 14 ++++++++++++++ htdocs/langs/en_US/errors.lang | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 00734ccb680..0269babd064 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2518,6 +2518,20 @@ class Facture extends CommonInvoice { $keymin = strtolower($key); $i = (int) preg_replace('/[^0-9]/', '', $key); + if ($i == 1) { + if (!is_object($this->thirdparty)) { + $langs->load('errors'); + $this->error = $langs->trans('ErrorInvoiceLoadThirdParty', $this->ref); + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } + if (!property_exists($this->thirdparty, $keymin)) { + $langs->load('errors'); + $this->error = $langs->trans('ErrorInvoiceLoadThirdPartyKey', $keymin, $this->ref); + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } $vallabel = $this->thirdparty->$keymin; if ($i > 0) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 087fcba9e56..94a1cf16a38 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -257,6 +257,8 @@ ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation ErrorYouMustFirstSetupYourChartOfAccount=You must first setup your chart of account +ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s" +ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s" # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. @@ -289,4 +291,4 @@ WarningFailedToAddFileIntoDatabaseIndex=Warning, failed to add file entry into E WarningTheHiddenOptionIsOn=Warning, the hidden option %s is on. WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection. -WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. \ No newline at end of file +WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. From d43b180115bacdbe6327975d3b070800d8f14a82 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 29 Mar 2022 10:26:38 +0200 Subject: [PATCH 067/177] FIX - Move delete task time trigger position --- htdocs/projet/class/task.class.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 87ef51daefd..8d9f91afaca 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1604,23 +1604,23 @@ class Task extends CommonObject $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; - $sql .= " WHERE rowid = ".$this->timespent_id; - - dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user); + if ($result < 0) { + $error++; + } + // End call triggers } if (!$error) { - if (!$notrigger) { - // Call trigger - $result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; + $sql .= " WHERE rowid = ".$this->timespent_id; + + dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } From a415711a66fffc7e3609a9b249351aa960954b88 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Mar 2022 15:47:54 +0200 Subject: [PATCH 068/177] Fix phpcs --- htdocs/accountancy/index.php | 9 ++++---- htdocs/compta/facture/class/facture.class.php | 21 +++++++------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 1277098fe69..8892c9af9f7 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -109,10 +109,10 @@ if ($conf->accounting->enabled) { print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); - print '
'; // hideobject is to start hidden - print "
\n"; - print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; - if (!empty($user->rights->accounting->chartofaccount)){ + print '
'; // hideobject is to start hidden + print "
\n"; + print ''.$langs->trans("AccountancyAreaDescIntro")."
\n"; + if (!empty($user->rights->accounting->chartofaccount)) { print "
\n"; print "
\n"; print load_fiche_titre(' '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; @@ -181,7 +181,6 @@ if ($conf->accounting->enabled) { print $s; print "
\n"; - print '
'; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 226af3a96ee..58da30ad205 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2660,8 +2660,7 @@ class Facture extends CommonInvoice // Check for mandatory fields in thirdparty (defined into setup) $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); - foreach ($array_to_check as $key) - { + foreach ($array_to_check as $key) { $keymin = strtolower($key); $i = (int) preg_replace('/[^0-9]/', '', $key); if ($i == 1) { @@ -2680,16 +2679,12 @@ class Facture extends CommonInvoice } $vallabel = $this->thirdparty->$keymin; - if ($i > 0) - { - if ($this->thirdparty->isACompany()) - { + if ($i > 0) { + if ($this->thirdparty->isACompany()) { // Check for mandatory prof id (but only if country is other than ours) - if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) - { + if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) { $idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; - if (!$vallabel && !empty($conf->global->$idprof_mandatory)) - { + if (!$vallabel && !empty($conf->global->$idprof_mandatory)) { $langs->load("errors"); $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); @@ -2698,11 +2693,9 @@ class Facture extends CommonInvoice } } } else { - if ($key == 'EMAIL') - { + if ($key == 'EMAIL') { // Check for mandatory - if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) - { + if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) { $langs->load("errors"); $this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); From b7e7c95d2a3e2549031dfef95699320c82c51b25 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 29 Mar 2022 16:02:39 +0200 Subject: [PATCH 069/177] FIX : ref_client doesn't exists on supplier invoice, then ref_fourn needs to have a default value when we want to bill several supplier orders --- htdocs/fourn/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 72fc7a7439c..2fb6f03607a 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -291,7 +291,7 @@ if (empty($reshook)) { $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; if (empty($createbills_onebythird)) { - $objecttmp->ref_client = $cmd->ref_client; + $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : dol_print_date(dol_now(), '%Y%m%d%H%M%S'); } $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); From 6480877b9900af10c17db64b05d9a240586ee434 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 30 Mar 2022 10:01:17 +0200 Subject: [PATCH 070/177] FIX : We need to have a different default_ref_supplier for each new fourn invoice --- htdocs/fourn/commande/list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 2fb6f03607a..b2b6484917d 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -274,6 +274,8 @@ if (empty($reshook)) { $db->begin(); + $default_ref_supplier=dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + foreach ($orders as $id_order) { $cmd = new CommandeFournisseur($db); if ($cmd->fetch($id_order) <= 0) { @@ -291,7 +293,7 @@ if (empty($reshook)) { $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; if (empty($createbills_onebythird)) { - $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier+1; } $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); From 7d3dbf1876ec3acc96301c410d2fbb0b8c3ebdbe Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 30 Mar 2022 11:20:01 +0200 Subject: [PATCH 071/177] FIX : "WHERE" clause missing on resource export --- htdocs/core/modules/modResource.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 944866d82e2..0478cdff2a7 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -249,7 +249,7 @@ class modResource extends DolibarrModules $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid'; - $this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')'; + $this->export_sql_end[$r] .= ' WHERE r.entity IN ('.getEntity('resource').')'; // Imports From e93f1cc5074c8efb50c47cf918dcfa78f0aa7f5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Mar 2022 12:15:33 +0200 Subject: [PATCH 072/177] Update card.php --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8c2c7e85e56..a88aec05618 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1000,7 +1000,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->client = 3; } } - if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS) && $object->client == 3) { $object->client = 1; } if (GETPOST("type", 'aZ') == 'p') { From 684e816ac32b305443c360d63be95fb0bb1fa73d Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 30 Mar 2022 14:12:16 +0200 Subject: [PATCH 073/177] FIX : incrementation --- htdocs/fourn/commande/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index b2b6484917d..de195504d39 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -293,7 +293,8 @@ if (empty($reshook)) { $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; if (empty($createbills_onebythird)) { - $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier+1; + $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier; + $default_ref_supplier+=1; } $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); From a22450391f9ac4cfd7c61cd1240cb29f430d708f Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 30 Mar 2022 15:50:36 +0200 Subject: [PATCH 074/177] FIX - Fix search by filters --- htdocs/compta/stats/casoc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 76dbc56beef..0bef7ff555a 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -57,6 +57,7 @@ $socid = GETPOST('socid', 'int'); // Category $selected_cat = (int) GETPOST('search_categ', 'int'); +if ($selected_cat == -1) $selected_cat = ''; $subcat = false; if (GETPOST('subcat', 'alpha') === 'yes') { $subcat = true; From ce83fa9f7e32621bd59eccd4dc8f1a34cc5fd299 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Thu, 31 Mar 2022 17:34:24 +0200 Subject: [PATCH 075/177] FIX missing call to executeHooks() --- htdocs/core/boxes/box_dolibarr_state_board.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 21bf58b859f..028547f7867 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -79,6 +79,9 @@ class box_dolibarr_state_board extends ModeleBoxes if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { $hookmanager = new HookManager($this->db); $hookmanager->initHooks(array('index')); + $object = new stdClass; + $action = ''; + $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); $boxstatItems = array(); $boxstatFromHook = ''; $boxstatFromHook = $hookmanager->resPrint; From e7db103b57d527a15f7a8fc4e52ee7e8077a3995 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 31 Mar 2022 18:55:54 +0200 Subject: [PATCH 076/177] fix: on update with action reminder in future there is user key error --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 0833929c82a..adfd3f34429 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -659,7 +659,7 @@ if (empty($reshook) && $action == 'update') { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); - $object->loadReminders(); + $object->loadReminders($remindertype,0,false); if (!empty($object->reminders) && $object->datep > dol_now()) { foreach ($object->reminders as $reminder) { $reminder->delete($user); From 5df5050418461383fbabb72fad6dac0eb5df1c04 Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Fri, 1 Apr 2022 09:14:04 +0200 Subject: [PATCH 077/177] Apply suggestions from code review replace spaces with tabs --- htdocs/core/boxes/box_dolibarr_state_board.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 028547f7867..9661b1d363e 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -79,9 +79,9 @@ class box_dolibarr_state_board extends ModeleBoxes if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { $hookmanager = new HookManager($this->db); $hookmanager->initHooks(array('index')); - $object = new stdClass; - $action = ''; - $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); + $object = new stdClass; + $action = ''; + $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); $boxstatItems = array(); $boxstatFromHook = ''; $boxstatFromHook = $hookmanager->resPrint; From fa0e7a641c7d2c0030e304f550ec1020584f41e0 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 1 Apr 2022 09:52:16 +0200 Subject: [PATCH 078/177] FIX : Missing unset fields after updateline expensereport --- htdocs/expensereport/card.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 240fdcfb73c..a1b26318a1b 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1282,6 +1282,16 @@ if (empty($reshook)) { $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } + + unset($qty); + unset($value_unit_ht); + unset($value_unit); + unset($vatrate); + unset($comments); + unset($fk_c_type_fees); + unset($fk_project); + unset($date); + } //header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); From d188f44a4c036e484bbfd740652163ccdfbbeb90 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 1 Apr 2022 07:58:41 +0000 Subject: [PATCH 079/177] Fixing style errors. --- htdocs/expensereport/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a1b26318a1b..50ee78b4097 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1291,7 +1291,6 @@ if (empty($reshook)) { unset($fk_c_type_fees); unset($fk_project); unset($date); - } //header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); From 106e3072dcbbe1415c9f4a34822b2843f305e451 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 13:20:40 +0200 Subject: [PATCH 080/177] Update card.php --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index adfd3f34429..a5a898ef7f2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -659,7 +659,7 @@ if (empty($reshook) && $action == 'update') { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); - $object->loadReminders($remindertype,0,false); + $object->loadReminders($remindertype, 0, false); if (!empty($object->reminders) && $object->datep > dol_now()) { foreach ($object->reminders as $reminder) { $reminder->delete($user); From 11d4e85a396e99d760a5faa5a7b9b301b3b48027 Mon Sep 17 00:00:00 2001 From: kamel Date: Fri, 1 Apr 2022 16:52:59 +0200 Subject: [PATCH 081/177] FIX - Fiw default options ($hidedetails, $hidedesc, $hideref) with globales when generate PDF in mass actions --- htdocs/core/actions_massactions.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 64578ad68bb..ab431a15442 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1246,9 +1246,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { $model = $objecttmp->model_pdf; $ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records // To be sure vars is defined - $hidedetails = !empty($hidedetails) ? $hidedetails : 0; - $hidedesc = !empty($hidedesc) ? $hidedesc : 0; - $hideref = !empty($hideref) ? $hideref : 0; + $hidedetails = !empty($hidedetails) ? $hidedetails : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0); + $hidedesc = !empty($hidedesc) ? $hidedesc : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0); + $hideref = !empty($hideref) ? $hideref : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0); $moreparams = !empty($moreparams) ? $moreparams : null; $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1378,13 +1378,13 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { // To be sure vars is defined if (empty($hidedetails)) { - $hidedetails = 0; + $hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0); } if (empty($hidedesc)) { - $hidedesc = 0; + $hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0); } if (empty($hideref)) { - $hideref = 0; + $hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0); } if (empty($moreparams)) { $moreparams = null; From 440b5350df6511f5076803fcdf1b696e6cfa90ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Apr 2022 17:12:45 +0200 Subject: [PATCH 082/177] # WARNING: head commit changed in the meantime Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 14.0 --- htdocs/compta/accounting-files.php | 368 ++++++++++++++++------------- 1 file changed, 199 insertions(+), 169 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index a06dd8dacaf..3942e7cb6dd 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -19,11 +19,11 @@ * along with this program. If not, see . */ - /** - * \file htdocs/compta/accounting-files.php - * \ingroup compta - * \brief Page to show portoflio and files of a thirdparty and download it - */ +/** + * \file htdocs/compta/accounting-files.php + * \ingroup compta + * \brief Page to show portoflio and files of a thirdparty and download it + */ if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file if (!defined('NOTOKENRENEWAL')) { @@ -499,7 +499,7 @@ if ($result && $action == "dl" && !$error) { $zip->addFromString('transactions.csv', $log); $zip->close(); - ///Then download the zipped file. + // Then download the zipped file. header('Content-Type: application/zip'); header('Content-disposition: attachment; filename='.basename($zipname)); header('Content-Length: '.filesize($zipname)); @@ -578,7 +578,7 @@ print '
'; foreach ($listofchoices as $choice => $val) { if (empty($val['enabled'])) { - continue; // list not qualified + continue; // list not qualified } $disabled = ''; if (empty($val['perms'])) { @@ -588,14 +588,13 @@ foreach ($listofchoices as $choice => $val) { print '
'; } -print ''; +print ''; print ''."\n"; print dol_get_fiche_end(); if (!empty($date_start) && !empty($date_stop)) { - $param = 'action=searchfiles'; $param .= '&date_startday='.GETPOST('date_startday', 'int'); $param .= '&date_startmonth='.GETPOST('date_startmonth', 'int'); $param .= '&date_startyear='.GETPOST('date_startyear', 'int'); @@ -603,25 +602,47 @@ if (!empty($date_start) && !empty($date_stop)) { $param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int'); $param .= '&date_stopyear='.GETPOST('date_stopyear', 'int'); foreach ($listofchoices as $choice => $val) { - $param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0); + if (GETPOST($choice, 'int')) { + $param .= '&'.$choice.'=1'; + } } - print '
'."\n"; - print ''; + + $TData = dol_sort_array($filesarray, $sortfield, $sortorder); + + + $filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip'; echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel'); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - foreach ($listofchoices as $choice => $val) { - print ''; + print ''."\n"; + print $langs->trans("Download"); + print '
'; - print ''; - print '
'."\n"; + $param .= '&action=searchfiles'; + + /* + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + foreach ($listofchoices as $choice => $val) { + print ''; + } + + print ''; + print ''."\n"; + */ print '
'; @@ -645,172 +666,181 @@ if (!empty($date_start) && !empty($date_stop)) { print ''.$langs->trans("Currency").''; } print ''; - if ($result) { - $TData = dol_sort_array($filesarray, $sortfield, $sortorder); - if (empty($TData)) { - print ''.$langs->trans("NoItem").''; - if (!empty($conf->multicurrency->enabled)) { - print ''; + if (empty($TData)) { + print ''.$langs->trans("NoRecordFound").''; + if (!empty($conf->multicurrency->enabled)) { + print ''; + } + print ''; + } else { + // Sort array by date ASC to calculate balance + + $totalET_debit = 0; + $totalIT_debit = 0; + $totalVAT_debit = 0; + $totalET_credit = 0; + $totalIT_credit = 0; + $totalVAT_credit = 0; + + // Display array + foreach ($TData as $data) { + $html_class = ''; + //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; + //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; + print ''; + + // Type + print ''.$langs->trans($data['item']).''; + + // Date + print ''; + print dol_print_date($data['date'], 'day'); + print "\n"; + + // Date due + print ''; + print dol_print_date($data['date_due'], 'day'); + print "\n"; + + // Ref + print ''; + + if ($data['item'] == 'Invoice') { + $invoice->id = $data['id']; + $invoice->ref = $data['ref']; + $invoice->total_ht = $data['amount_ht']; + $invoice->total_ttc = $data['amount_ttc']; + $invoice->total_tva = $data['amount_vat']; + $invoice->multicurrency_code = $data['currency']; + print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'SupplierInvoice') { + $supplier_invoice->id = $data['id']; + $supplier_invoice->ref = $data['ref']; + $supplier_invoice->total_ht = $data['amount_ht']; + $supplier_invoice->total_ttc = $data['amount_ttc']; + $supplier_invoice->total_tva = $data['amount_vat']; + $supplier_invoice->multicurrency_code = $data['currency']; + print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); + } elseif ($data['item'] == 'ExpenseReport') { + $expensereport->id = $data['id']; + $expensereport->ref = $data['ref']; + print $expensereport->getNomUrl(1, 0, 0, '', 0, 0); + } elseif ($data['item'] == 'SalaryPayment') { + $salary_payment->id = $data['id']; + $salary_payment->ref = $data['ref']; + print $salary_payment->getNomUrl(1); + } elseif ($data['item'] == 'Donation') { + $don->id = $data['id']; + $don->ref = $data['ref']; + print $don->getNomUrl(1, 0, '', 0); + } elseif ($data['item'] == 'SocialContributions') { + $charge_sociales->id = $data['id']; + $charge_sociales->ref = $data['ref']; + print $charge_sociales->getNomUrl(1, 0, 0, 0, 0); + } elseif ($data['item'] == 'VariousPayment') { + $various_payment->id = $data['id']; + $various_payment->ref = $data['ref']; + print $various_payment->getNomUrl(1, '', 0, 0); + } elseif ($data['item'] == 'LoanPayment') { + $payment_loan->id = $data['id']; + $payment_loan->ref = $data['ref']; + print $payment_loan->getNomUrl(1, 0, 0, '', 0); + } else { + print $data['ref']; } - print ''; - } else { - // Sort array by date ASC to calculate balance + print ''; - $totalET_debit = 0; - $totalIT_debit = 0; - $totalVAT_debit = 0; - $totalET_credit = 0; - $totalIT_credit = 0; - $totalVAT_credit = 0; - - // Display array - foreach ($TData as $data) { - $html_class = ''; - //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; - //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; - print ''; - - // Type - print ''.$langs->trans($data['item']).''; - - // Date - print ''; - print dol_print_date($data['date'], 'day'); - print "\n"; - - // Date due - print ''; - print dol_print_date($data['date_due'], 'day'); - print "\n"; - - // Ref - print ''; - - if ($data['item'] == 'Invoice') { - $invoice->id = $data['id']; - $invoice->ref = $data['ref']; - $invoice->total_ht = $data['amount_ht']; - $invoice->total_ttc = $data['amount_ttc']; - $invoice->total_tva = $data['amount_vat']; - $invoice->multicurrency_code = $data['currency']; - print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'SupplierInvoice') { - $supplier_invoice->id = $data['id']; - $supplier_invoice->ref = $data['ref']; - $supplier_invoice->total_ht = $data['amount_ht']; - $supplier_invoice->total_ttc = $data['amount_ttc']; - $supplier_invoice->total_tva = $data['amount_vat']; - $supplier_invoice->multicurrency_code = $data['currency']; - print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0); - } elseif ($data['item'] == 'ExpenseReport') { - $expensereport->id = $data['id']; - $expensereport->ref = $data['ref']; - print $expensereport->getNomUrl(1, 0, 0, '', 0, 0); - } elseif ($data['item'] == 'SalaryPayment') { - $salary_payment->id = $data['id']; - $salary_payment->ref = $data['ref']; - print $salary_payment->getNomUrl(1); - } elseif ($data['item'] == 'Donation') { - $don->id = $data['id']; - $don->ref = $data['ref']; - print $don->getNomUrl(1, 0, '', 0); - } elseif ($data['item'] == 'SocialContributions') { - $charge_sociales->id = $data['id']; - $charge_sociales->ref = $data['ref']; - print $charge_sociales->getNomUrl(1, 0, 0, 0, 0); - } elseif ($data['item'] == 'VariousPayment') { - $various_payment->id = $data['id']; - $various_payment->ref = $data['ref']; - print $various_payment->getNomUrl(1, '', 0, 0); - } elseif ($data['item'] == 'LoanPayment') { - $payment_loan->id = $data['id']; - $payment_loan->ref = $data['ref']; - print $payment_loan->getNomUrl(1, 0, 0, '', 0); - } else { - print $data['ref']; - } - print ''; - - // File link - print ''; - if (!empty($data['files'])) { - foreach ($data['files'] as $id => $filecursor) { - print ''.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).' '.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'
'; + // File link + print ''; + if (!empty($data['files'])) { + foreach ($data['files'] as $id => $filecursor) { + $tmppreview = $formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name'], 0); + if ($tmppreview) { + print $tmppreview; } + $filename = ($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']); + print ''; + if (empty($tmppreview)) { + print img_picto('', 'generic', '', false, 0, 0, '', 'pictonopreview pictofixedwidth paddingright'); + } + print $filename; + print '
'; } - print "\n"; + } + print "\n"; - // Paid - print ''.$data['paid'].''; + // Paid + print ''.($data['paid'] ? yn($data['paid']) : '').''; - // Total ET - print ''.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."\n"; - // Total IT - print ''.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."\n"; - // Total VAT - print ''.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."\n"; + // Total ET + print ''.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."\n"; + // Total IT + print ''.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."\n"; + // Total VAT + print ''.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."\n"; - print ''.dol_escape_htmltag($data['thirdparty_name'])."\n"; + print ''.dol_escape_htmltag($data['thirdparty_name'])."\n"; - print ''.$data['thirdparty_code']."\n"; + print ''.$data['thirdparty_code']."\n"; - print ''.$data['country_code']."\n"; + print ''.$data['country_code']."\n"; - print ''.dol_escape_htmltag($data['vatnum'])."\n"; + // VAT number + print ''.dol_escape_htmltag($data['vatnum'])."\n"; - if ($data['sens']) { - $totalET_credit += $data['amount_ht']; - $totalIT_credit += $data['amount_ttc']; - $totalVAT_credit += $data['amount_vat']; - } else { - $totalET_debit -= $data['amount_ht']; - $totalIT_debit -= $data['amount_ttc']; - $totalVAT_debit -= $data['amount_vat']; - } - - if (!empty($conf->multicurrency->enabled)) { - print ''.$data['currency']."\n"; - } - - print "\n"; + if ($data['sens']) { + $totalET_credit += $data['amount_ht']; + $totalIT_credit += $data['amount_ttc']; + $totalVAT_credit += $data['amount_vat']; + } else { + $totalET_debit -= $data['amount_ht']; + $totalIT_debit -= $data['amount_ttc']; + $totalVAT_debit -= $data['amount_vat']; } - // Total credits - print ''; - print ''.$langs->trans('Total').' '.$langs->trans('Income').''; - print ''.price(price2num($totalET_credit, 'MT')).''; - print ''.price(price2num($totalIT_credit, 'MT')).''; - print ''.price(price2num($totalVAT_credit, 'MT')).''; - print ''; if (!empty($conf->multicurrency->enabled)) { - print ''; - } - print "\n"; - // Total debits - print ''; - print ''.$langs->trans('Total').' '.$langs->trans('Outcome').''; - print ''.price(price2num($totalET_debit, 'MT')).''; - print ''.price(price2num($totalIT_debit, 'MT')).''; - print ''.price(price2num($totalVAT_debit, 'MT')).''; - print ''; - if (!empty($conf->multicurrency->enabled)) { - print ''; - } - print "\n"; - // Balance - print ''; - print ''.$langs->trans('Total').''; - print ''.price(price2num($totalET_credit + $totalET_debit, 'MT')).''; - print ''.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).''; - print ''.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).''; - print ''; - if (!empty($conf->multicurrency->enabled)) { - print ''; + print ''.$data['currency']."\n"; } + print "\n"; } + + // Total credits + print ''; + print ''.$langs->trans('Total').' '.$langs->trans('Income').''; + print ''.price(price2num($totalET_credit, 'MT')).''; + print ''.price(price2num($totalIT_credit, 'MT')).''; + print ''.price(price2num($totalVAT_credit, 'MT')).''; + print ''; + if (!empty($conf->multicurrency->enabled)) { + print ''; + } + print "\n"; + // Total debits + print ''; + print ''.$langs->trans('Total').' '.$langs->trans('Outcome').''; + print ''.price(price2num($totalET_debit, 'MT')).''; + print ''.price(price2num($totalIT_debit, 'MT')).''; + print ''.price(price2num($totalVAT_debit, 'MT')).''; + print ''; + if (!empty($conf->multicurrency->enabled)) { + print ''; + } + print "\n"; + // Balance + print ''; + print ''.$langs->trans('Total').''; + print ''.price(price2num($totalET_credit + $totalET_debit, 'MT')).''; + print ''.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).''; + print ''.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).''; + print ''; + if (!empty($conf->multicurrency->enabled)) { + print ''; + } + print "\n"; } + print ""; print '
'; } From 53b185ce9c987f4dbd8b0aae80e380c8f78f8f17 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Mon, 4 Apr 2022 10:19:51 +0200 Subject: [PATCH 083/177] fix condition on remx --- htdocs/comm/remx.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index f8a4c12fba7..1e3f56c30db 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -62,7 +62,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { exit; } -if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user->rights->societe->creer) { +if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) @@ -153,7 +153,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user- } } -if ($action == 'setremise' && $user->rights->societe->creer) { +if ($action == 'setremise' && ($user->rights->societe->creer || $user->rights->facture->creer)) { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) @@ -192,7 +192,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) { } } -if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && $user->rights->societe->creer) { +if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) From 2009cc96e0e7d31a2e1cf3a422cd850a59112198 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Mon, 4 Apr 2022 10:21:06 +0200 Subject: [PATCH 084/177] clean branch --- htdocs/core/lib/security.lib.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index b26c723a014..3ea554a4a8f 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -615,9 +615,6 @@ function checkUserAccessToObject($user, array $featuresarray, $objectid = 0, $ta if ($feature == 'task') { $feature = 'projet_task'; } - if ($feature == 'banque') { - $feature = 'fk_account@bank_account'; - } $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object From 6cac982507056f0c401b63bf8894cd6bf7679ba4 Mon Sep 17 00:00:00 2001 From: kamel Date: Mon, 4 Apr 2022 10:32:17 +0200 Subject: [PATCH 085/177] FIX - Fix the adding of lines in the create invoice functions --- htdocs/compta/facture/class/facture.class.php | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 58da30ad205..fab80677c25 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -800,6 +800,10 @@ class Facture extends CommonInvoice $fk_parent_line = 0; } + // Complete vat rate with code + $vatrate = $newinvoiceline->tva_tx; + if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$newinvoiceline->vat_src_code.')'; + $newinvoiceline->fk_parent_line = $fk_parent_line; if ($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) { @@ -810,7 +814,37 @@ class Facture extends CommonInvoice $newinvoiceline->fk_remise_except = $discountId; } - $result = $newinvoiceline->insert(); + $result = $this->addline( + $newinvoiceline->desc, + $newinvoiceline->subprice, + $newinvoiceline->qty, + $vatrate, + $newinvoiceline->localtax1_tx, + $newinvoiceline->localtax2_tx, + $newinvoiceline->fk_product, + $newinvoiceline->remise_percent, + $newinvoiceline->date_start, + $newinvoiceline->date_end, + $newinvoiceline->fk_code_ventilation, + $newinvoiceline->info_bits, + $newinvoiceline->fk_remise_except, + 'HT', + 0, + $newinvoiceline->product_type, + $newinvoiceline->rang, + $newinvoiceline->special_code, + $newinvoiceline->element, + $newinvoiceline->id, + $fk_parent_line, + $newinvoiceline->fk_fournprice, + $newinvoiceline->pa_ht, + $newinvoiceline->label, + $newinvoiceline->array_options, + $newinvoiceline->situation_percent, + $newinvoiceline->fk_prev_id, + $newinvoiceline->fk_unit, + $newinvoiceline->pu_ht_devise + ); // Defined the new fk_parent_line if ($result > 0 && $newinvoiceline->product_type == 9) { From 71012a7933bfd44570377563546c4135fa6451e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Mar 2022 13:21:32 +0100 Subject: [PATCH 086/177] FIX #19777 #20281 --- htdocs/compta/paiement/cheque/card.php | 50 ++++++++++++------- .../cheque/class/remisecheque.class.php | 1 + htdocs/core/class/html.formfile.class.php | 6 +-- .../modules/cheque/modules_chequereceipts.php | 3 +- htdocs/ecm/class/ecmfiles.class.php | 6 ++- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 32f81532ecf..2fcd4d780ff 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -41,12 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); -// Security check -$fieldname = (!empty($ref) ? 'ref' : 'rowid'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname); +$object = new RemiseCheque($db); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -63,11 +58,22 @@ if (empty($page) || $page == -1) { $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $offset = $limit * $page; -$dir = $conf->bank->dir_output.'/checkdeposits/'; +$upload_dir = $conf->bank->multidir_output[$object->entity ? $object->entity : $conf->entity]."/checkdeposits"; + $filterdate = dol_mktime(0, 0, 0, GETPOST('fdmonth'), GETPOST('fdday'), GETPOST('fdyear')); $filteraccountid = GETPOST('accountid', 'int'); -$object = new RemiseCheque($db); +// Security check +$fieldname = (!empty($ref) ? 'ref' : 'rowid'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque', '', 'fk_user_author', $fieldname); + +$usercanread = $user->rights->banque->cheque; +$usercancreate = $user->rights->banque->cheque; +$usercandelete = $user->rights->banque->cheque; + /* @@ -242,7 +248,9 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) { $langs->load("other"); - $file = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'cheque').GETPOST('file'); + $filetodelete = GETPOST('file', 'alpha'); + $file = $upload_dir.'/'.$filetodelete; + $ret = dol_delete_file($file, 0, 0, 0, $object); if ($ret) { setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); @@ -633,6 +641,12 @@ if ($action == 'new') { $i = 1; if ($num > 0) { while ($objp = $db->fetch_object($resql)) { + $paymentstatic->id = $objp->pid; + $paymentstatic->ref = $objp->pref; + + $accountlinestatic->id = $objp->rowid; + $accountlinestatic->ref = $objp->ref; + print ''; print ''.$i.''; print ''.dol_print_date($db->jdate($objp->date), 'day').''; // Operation date @@ -642,8 +656,6 @@ if ($action == 'new') { print ''.price($objp->amount).''; // Link to payment print ''; - $paymentstatic->id = $objp->pid; - $paymentstatic->ref = $objp->pref; if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); } else { @@ -652,8 +664,6 @@ if ($action == 'new') { print ''; // Link to bank transaction print ''; - $accountlinestatic->id = $objp->rowid; - $accountlinestatic->ref = $objp->ref; if ($accountlinestatic->id > 0) { print $accountlinestatic->getNomUrl(1); } else { @@ -663,10 +673,10 @@ if ($action == 'new') { // Action button print ''; if ($object->statut == 0) { - print 'rowid.'">'.img_delete().''; + print 'rowid.'">'.img_delete().''; } if ($object->statut == 1 && $objp->statut != 2) { - print 'rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').''; + print 'rowid.'">'.img_picto($langs->trans("RejectCheck"), 'disable').''; } if ($objp->statut == 2) { print '   '.img_picto($langs->trans('CheckRejected'), 'statut8').''; @@ -722,11 +732,13 @@ print '
'; if ($action != 'new') { if ($object->statut == 1) { - $filename = dol_sanitizeFileName($object->ref); - $filedir = $dir.get_exdir($object->ref, 0, 1, 0, $object, 'checkdeposits'); + // Documents + $objref = dol_sanitizeFileName($object->ref); + $filedir = $upload_dir.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - - print $formfile->showdocuments('remisecheque', $filename, $filedir, $urlsource, 1, 1); + $genallowed = $usercancreate; + $delallowed = $usercandelete; + print $formfile->showdocuments('remisecheque', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); print '
'; } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 683b2fd0423..559697bf495 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -615,6 +615,7 @@ class RemiseCheque extends CommonObject // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charseSupprimert_output = $outputlangs->charset_output; + $result = $docmodel->write_file($this, $conf->bank->dir_output.'/checkdeposits', $this->ref, $outputlangs); if ($result > 0) { //$outputlangs->charset_output=$sav_charset_output; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index fcca60dad78..349b05416aa 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -359,9 +359,9 @@ class FormFile * Return a string to show the box with list of available documents for object. * This also set the property $this->numoffiles * - * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:myobject', 'mymodule_temp', ...) - * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. - * @param string $filedir Directory to scan + * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...) + * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into a subdir of module. + * @param string $filedir Directory to scan (must not end with a /). Example: '/mydolibarrdocuments/facture/FAYYMM-1234' * @param string $urlsource Url of origin page (for return) * @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates) * @param int $delallowed Remove is allowed (1/0) diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index dfdf0fbe363..e50a6877848 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -126,8 +126,7 @@ abstract class ModeleNumRefChequeReceipts } /** - * \class ModeleChequeReceipts - * \brief Classe mere des modeles de + * Class parent for templates of document generation */ abstract class ModeleChequeReceipts extends CommonDocGenerator { diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 035a7aee9c6..a451a462ea3 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -327,7 +327,11 @@ class EcmFiles extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; - $this->errors[] = 'Error '.$this->db->lasterror(); + if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $this->errors[] = 'Error DB_ERROR_RECORD_ALREADY_EXISTS : '.$this->db->lasterror(); + } else { + $this->errors[] = 'Error '.$this->db->lasterror(); + } dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); } From 1fec350ccc42daf13415ed366bc191f9d8626381 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 4 Apr 2022 22:51:30 +0200 Subject: [PATCH 087/177] fix: Bad dirthday displayed date (d-1) in the Bithday Widget --- htdocs/core/boxes/box_birthdays.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index 62cfaa590ab..be0abcdfdde 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -119,7 +119,7 @@ class box_birthdays extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="center nowraponall"', - 'text' => dol_print_date($dateb, "day", 'gmt').' - '.$age.' '.$langs->trans('DurationYears') + 'text' => dol_print_date($dateb, "day").' - '.$age.' '.$langs->trans('DurationYears') ); /*$this->info_box_contents[$line][] = array( From b199234afe1d9c7371a6ce35c789a95b0fee1893 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 5 Apr 2022 12:01:09 +0200 Subject: [PATCH 088/177] FIX : each time we create a supplier order, we need to give it a ref_supplier --- htdocs/fourn/commande/list.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index de195504d39..56ebfb5cbf7 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -292,10 +292,8 @@ if (empty($reshook)) { $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; - if (empty($createbills_onebythird)) { - $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier; - $default_ref_supplier+=1; - } + $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier; + $default_ref_supplier+=1; $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($datefacture)) { From c4f0c60a11804662916cb84fb5a075b27d87267c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 6 Apr 2022 09:19:56 +0200 Subject: [PATCH 089/177] FIX: Filter on Object Referent page give CRSF page --- htdocs/product/stats/bom.php | 1 + htdocs/product/stats/commande_fournisseur.php | 1 + htdocs/product/stats/contrat.php | 2 +- htdocs/product/stats/facture.php | 1 + htdocs/product/stats/facture_fournisseur.php | 1 + htdocs/product/stats/mo.php | 1 + htdocs/product/stats/propal.php | 1 + htdocs/product/stats/supplier_proposal.php | 1 + 8 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index 52eec409185..5ab7a8f40a8 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -247,6 +247,7 @@ if ($id > 0 || !empty($ref)) { } print '
'."\n"; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index fd64a1c0572..c7283399a43 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -198,6 +198,7 @@ if ($id > 0 || !empty($ref)) { } print ''."\n"; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index cb7c84fc863..4c958a20370 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -183,7 +183,7 @@ if ($id > 0 || !empty($ref)) { } print ''."\n"; - + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index b3e5571ac5a..da81f915b45 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -214,6 +214,7 @@ if ($id > 0 || !empty($ref)) { } print ''."\n"; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 212674582f9..e85801c8642 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -197,6 +197,7 @@ if ($id > 0 || !empty($ref)) { } print ''."\n"; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index 5a5c33312ca..adfe989289e 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -176,6 +176,7 @@ if ($id > 0 || !empty($ref)) { } print ''."\n"; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index b83d0368b75..096848d6205 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -199,6 +199,7 @@ if ($id > 0 || !empty($ref)) { } print ''."\n"; + print ''; if (!empty($sortfield)) { print ''; } diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index d583d58bff8..a60261af115 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -198,6 +198,7 @@ if ($id > 0 || !empty($ref)) { } print ''."\n"; + print ''; if (!empty($sortfield)) { print ''; } From c3ae63f587f76670c113746f0d2f1e62b129548a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 11:34:49 +0200 Subject: [PATCH 090/177] FIX out of memory when more than 100 000 invoices. --- htdocs/compta/facture/list.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ccf3c2f3f0c..f2cc5943e7a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -757,12 +757,28 @@ $sql .= ' f.rowid DESC '; $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + /* This old and fast method to get and count full list returns all record so use a high amount of memory. $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + */ + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + if ($sall || $search_product_category > 0 || $search_user > 0) { + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql); + } else { + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql); + $sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid/', '', $sqlforcount); + } + $sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount); + + $resql = $db->query($sqlforcount); + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + + if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } $sql .= $db->plimit($limit + 1, $offset); From 798c7a8a0bdb1bba11c802b24d08a964d14b3431 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 6 Apr 2022 14:09:44 +0200 Subject: [PATCH 091/177] try with tzserver --- htdocs/core/boxes/box_birthdays.php | 2 +- htdocs/user/card.php | 8 ++++---- htdocs/user/class/user.class.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index be0abcdfdde..02c39c2f625 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -119,7 +119,7 @@ class box_birthdays extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="center nowraponall"', - 'text' => dol_print_date($dateb, "day").' - '.$age.' '.$langs->trans('DurationYears') + 'text' => dol_print_date($dateb, "day", 'tzserver').' - '.$age.' '.$langs->trans('DurationYears') ); /*$this->info_box_contents[$line][] = array( diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 23437a7564c..ebb001e6ca9 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1255,7 +1255,7 @@ if ($action == 'create' || $action == 'adduserldap') { // Date birth print ''.$langs->trans("DateOfBirth").''; print ''; - print $form->selectDate($dateofbirth, 'dateofbirth', 0, 0, 1, 'createuser', 1, 0); + print $form->selectDate($dateofbirth, 'dateofbirth', 0, 0, 1, 'createuser', 1, 0, 0, '', 0, '', '', 1, '', '', 'tzserver'); print ''; print "\n"; @@ -1565,7 +1565,7 @@ if ($action == 'create' || $action == 'adduserldap') { // Date of birth print ''.$langs->trans("DateOfBirth").''; print ''; - print dol_print_date($object->birth, 'day'); + print dol_print_date($object->birth, 'day', 'tzserver'); print ''; print "\n"; @@ -2712,9 +2712,9 @@ if ($action == 'create' || $action == 'adduserldap') { print ''.$langs->trans("DateOfBirth").''; print ''; if ($caneditfield) { - echo $form->selectDate($dateofbirth ? $dateofbirth : $object->birth, 'dateofbirth', 0, 0, 1, 'updateuser', 1, 0); + echo $form->selectDate($dateofbirth ? $dateofbirth : $object->birth, 'dateofbirth', 0, 0, 1, 'updateuser', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); } else { - print dol_print_date($object->birth, 'day'); + print dol_print_date($object->birth, 'day', 'tzserver'); } print ''; print "\n"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 2b284f6878e..04eebd6b6c9 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1731,7 +1731,7 @@ class User extends CommonObject $sql .= ", login = '".$this->db->escape($this->login)."'"; $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null"); $sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' - $sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth)."'" : 'null'); + $sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth, 'tzserver')."'" : 'null'); if (!empty($user->admin)) { $sql .= ", admin = ".(int) $this->admin; // admin flag can be set/unset only by an admin user } From 9ffe82e25937983ca5f2c2ed14699b7c8857fd65 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 7 Apr 2022 10:32:23 +0200 Subject: [PATCH 092/177] FIX : originproductline array td identification --- htdocs/core/class/commonobject.class.php | 16 ++++++++-------- htdocs/core/tpl/originproductline.tpl.php | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1064d34561d..02421ea9157 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4805,18 +4805,18 @@ abstract class CommonObject global $langs, $hookmanager, $conf, $form; print ''; - print ''.$langs->trans('Ref').''; - print ''.$langs->trans('Description').''; - print ''.$langs->trans('VATRate').''; - print ''.$langs->trans('PriceUHT').''; + print ''.$langs->trans('Ref').''; + print ''.$langs->trans('Description').''; + print ''.$langs->trans('VATRate').''; + print ''.$langs->trans('PriceUHT').''; if (!empty($conf->multicurrency->enabled)) { - print ''.$langs->trans('PriceUHTCurrency').''; + print ''.$langs->trans('PriceUHTCurrency').''; } - print ''.$langs->trans('Qty').''; + print ''.$langs->trans('Qty').''; if (!empty($conf->global->PRODUCT_USE_UNITS)) { - print ''.$langs->trans('Unit').''; + print ''.$langs->trans('Unit').''; } - print ''.$langs->trans('ReductionShort').''; + print ''.$langs->trans('ReductionShort').''; print ''.$form->showCheckAddButtons('checkforselect', 1).''; print ''; $i = 0; diff --git a/htdocs/core/tpl/originproductline.tpl.php b/htdocs/core/tpl/originproductline.tpl.php index d4943ac454d..93c2bd3a8df 100644 --- a/htdocs/core/tpl/originproductline.tpl.php +++ b/htdocs/core/tpl/originproductline.tpl.php @@ -27,20 +27,20 @@ if (empty($conf) || !is_object($conf)) { tpl['strike']) ? '' : ' strikefordisabled').'">'; -print ''.$this->tpl['label'].''; -print ''.$this->tpl['description'].''; -print ''.$this->tpl['vat_rate'].''; -print ''.$this->tpl['price'].''; +print ''.$this->tpl['label'].''; +print ''.$this->tpl['description'].''; +print ''.$this->tpl['vat_rate'].''; +print ''.$this->tpl['price'].''; if (!empty($conf->multicurrency->enabled)) { - print ''.$this->tpl['multicurrency_price'].''; + print ''.$this->tpl['multicurrency_price'].''; } -print ''.$this->tpl['qty'].''; +print ''.$this->tpl['qty'].''; if (!empty($conf->global->PRODUCT_USE_UNITS)) { - print ''.$langs->trans($this->tpl['unit']).''; + print ''.$langs->trans($this->tpl['unit']).''; } -print ''.$this->tpl['remise_percent'].''; +print ''.$this->tpl['remise_percent'].''; $selected = 1; if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) { From f1771af53cab8827e849c6053369ef692d6c6132 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 7 Apr 2022 11:03:25 +0200 Subject: [PATCH 093/177] FIX : originproductline array td identification data-id --- htdocs/core/tpl/originproductline.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/originproductline.tpl.php b/htdocs/core/tpl/originproductline.tpl.php index 93c2bd3a8df..6929b23fcad 100644 --- a/htdocs/core/tpl/originproductline.tpl.php +++ b/htdocs/core/tpl/originproductline.tpl.php @@ -26,7 +26,7 @@ if (empty($conf) || !is_object($conf)) { tpl['strike']) ? '' : ' strikefordisabled').'">'; +print ''; print ''.$this->tpl['label'].''; print ''.$this->tpl['description'].''; print ''.$this->tpl['vat_rate'].''; From 41ee9739db45a74f3731b0e215db13ed9d50d16f Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 7 Apr 2022 17:16:02 +0200 Subject: [PATCH 094/177] FIX: Add 'recruitment' into check array --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 3ea554a4a8f..c0c540754fc 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -616,7 +616,7 @@ function checkUserAccessToObject($user, array $featuresarray, $objectid = 0, $ta $feature = 'projet_task'; } - $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company) + $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object $checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object From 6e0888ca0ec5118e7094b24e2364ec740ee6c32e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 7 Apr 2022 17:17:20 +0200 Subject: [PATCH 095/177] FIX: action comm list: holiday last day not included + handle duration with halfdays --- htdocs/comm/action/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 722423c0cd9..51d0f99b6b8 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -979,8 +979,8 @@ if ($resql) { $event->type = 'holiday'; $event->type_picto = 'holiday'; - $event->datep = $db->jdate($obj->date_start); - $event->datef = $db->jdate($obj->date_end); + $event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1); + $event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1; $event->date_start_in_calendar = $event->datep; $event->date_end_in_calendar = $event->datef; From de737b6b23d94c34bc36fb654b9778e2a65042fd Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 7 Apr 2022 18:07:30 +0200 Subject: [PATCH 096/177] FIX: holiday/leave requests: write status change emails in HTML --- htdocs/holiday/card.php | 73 +++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 3ca389176e7..42b7a7313f0 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -449,10 +449,9 @@ if (empty($reshook)) $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate"); // Content - $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; - $message .= "\n"; + $message = "

".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",

\n"; - $message .= $langs->transnoentities("HolidaysToValidateBody")."\n"; + $message .= "

".$langs->transnoentities("HolidaysToValidateBody")."

\n"; $delayForRequest = $object->getConfCP('delayForRequest'); //$delayForRequest = $delayForRequest * (60*60*24); @@ -464,8 +463,7 @@ if (empty($reshook)) { if ($object->date_debut < $nextMonth) { - $message .= "\n"; - $message .= $langs->transnoentities("HolidaysToValidateDelay", $object->getConfCP('delayForRequest'))."\n"; + $message .= "

".$langs->transnoentities("HolidaysToValidateDelay", $object->getConfCP('delayForRequest'))."

\n"; } } @@ -475,20 +473,21 @@ if (empty($reshook)) $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) { - $message .= "\n"; - $message .= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n"; + $message .= "

".$langs->transnoentities("HolidaysToValidateAlertSolde")."

\n"; } } - $message .= "\n"; - $message .= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; - $message .= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."\n"; - $message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; - $message .= "\n"; + $link = dol_buildpath("/holiday/card.php", 3) . '?id='.$object->id; + + $message .= "
    "; + $message .= "
  • ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."
  • \n"; + $message .= "
  • ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."
  • \n"; + $message .= "
  • ".$langs->transnoentitiesnoconv("Link").' : '.$link."
  • \n"; + $message .= "
\n"; $trackid = 'leav'.$object->id; - $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); + $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid); // Envoi du mail $result = $mail->sendfile(); @@ -603,19 +602,20 @@ if (empty($reshook)) $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated"); // Content - $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; - $message .= "\n"; + $message = "

".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",

\n"; - $message .= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n"; + $message .= "

".$langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."

\n"; - $message .= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; + $link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id; - $message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; - $message .= "\n"; + $message .= "
    \n"; + $message .= "
  • ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."
  • \n"; + $message .= "
  • ".$langs->transnoentitiesnoconv("Link").' : '.$link."
  • \n"; + $message .= "
\n"; $trackid = 'leav'.$object->id; - $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); + $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid); // Envoi du mail $result = $mail->sendfile(); @@ -689,20 +689,21 @@ if (empty($reshook)) $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused"); // Content - $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; - $message .= "\n"; + $message = "

".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",

\n"; - $message .= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n"; - $message .= GETPOST('detail_refuse', 'alpha')."\n\n"; + $message .= "

".$langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."

\n"; + $message .= "

".GETPOST('detail_refuse', 'alpha')."

"; - $message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; + $link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id; - $message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; - $message .= "\n"; + $message .= "
    \n"; + $message .= "
  • ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."
  • \n"; + $message .= "
  • ".$langs->transnoentitiesnoconv("Link").' : '.$link."
  • \n"; + $message .= "
"; $trackid = 'leav'.$object->id; - $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); + $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid); // Envoi du mail $result = $mail->sendfile(); @@ -838,18 +839,20 @@ if (empty($reshook)) $subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled"); // Content - $message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n"; - $message .= "\n"; + $message = "

".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",

\n"; - $message .= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n"; - $message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n"; + $message .= "

".$langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."

\n"; - $message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n"; - $message .= "\n"; + $link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id; + + $message .= "
    \n"; + $message .= "
  • ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."
  • \n"; + $message .= "
  • ".$langs->transnoentitiesnoconv("Link").' : '.$link."
  • \n"; + $message .= "
\n"; $trackid = 'leav'.$object->id; - $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid); + $mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid); // Envoi du mail $result = $mail->sendfile(); From 68d11f2e892468037b6aa5e18a866de4d29845bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Apr 2022 02:42:32 +0200 Subject: [PATCH 097/177] Fix phpunit regression --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fab80677c25..b1eb8656645 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -843,7 +843,7 @@ class Facture extends CommonInvoice $newinvoiceline->situation_percent, $newinvoiceline->fk_prev_id, $newinvoiceline->fk_unit, - $newinvoiceline->pu_ht_devise + $newinvoiceline->multicurrency_subprice ); // Defined the new fk_parent_line From 18488cf1dde807699899ca6c95c2e87482a4d285 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 11 Apr 2022 13:53:35 +0200 Subject: [PATCH 098/177] FIX replenish and manage product stock by warhouse --- htdocs/product/stock/replenish.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 0f13770d3b3..a4ce5577361 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -904,10 +904,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } // Desired stock - print ''.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).''; + print ''.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $desiredstockwarehouse : $desiredstock).''; // Limit stock for alert - print ''.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).''; + print ''.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $alertstockwarehouse : $alertstock).''; // Current stock (all warehouses) print ''.$warning.$stock; @@ -923,7 +923,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''.$ordered.' '.$picto.''; // To order - print ''; + print ''; // Supplier print ''; From 89b7c8298b4f7f27b4d3b08079014826437677a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alo=C3=AFs=20Micard?= Date: Mon, 11 Apr 2022 17:25:45 +0200 Subject: [PATCH 099/177] Module builder: Translate permissions label --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index f3922aa6342..f8abd703bf0 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3008,7 +3008,7 @@ if ($module == 'initmodule') print ''; print ''; - print $perm[1]; + print $langs->trans($perm[1]); print ''; print ''; From 62b74962535ed38c424e569d9dbd79b25653ab16 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Mon, 11 Apr 2022 18:26:49 +0200 Subject: [PATCH 100/177] Fix: Direct download don't work with multicompany --- htdocs/document.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/document.php b/htdocs/document.php index 060722e8d5b..fc894091615 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Pierre Morin * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2022 Ferran Marcet * * 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 @@ -140,6 +141,11 @@ if (!empty($hashp)) $modulepart = $moduleparttocheck; $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir } + $entity = $ecmfile->entity; + if ($entity != $conf->entity) { + $conf->entity = $entity; + $conf->setValues($db); + } } else { $langs->load("errors"); accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1); From f4023b4e44160e0861eb09a0d0d407e5420575e3 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 12 Apr 2022 11:08:50 +0200 Subject: [PATCH 101/177] Add missing entity on salary's payment --- htdocs/salaries/class/paymentsalary.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 76236bb88aa..506e9b73ea5 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -164,9 +164,9 @@ class PaymentSalary extends CommonObject $this->db->begin(); if ($totalamount != 0) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_salary, datec, datep, amount,"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (entity, fk_salary, datec, datep, amount,"; $sql .= " fk_typepayment, num_payment, note, fk_user_author, fk_bank)"; - $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',"; + $sql .= " VALUES (".$conf->entity.", ".$this->chid.", '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datepaye)."',"; $sql .= " ".price2num($totalamount).","; $sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".((int) $user->id).","; From c51aff99af711f0a7a04fcd2de99ab243ad2175c Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 12 Apr 2022 14:38:17 +0200 Subject: [PATCH 102/177] Add missing entity on adding new VAT --- htdocs/compta/tva/class/tva.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 45d3d2e74b4..ce5ff657eca 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -125,6 +125,7 @@ class Tva extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva("; + $sql .= "entity,"; $sql .= "datec,"; $sql .= "datep,"; $sql .= "datev,"; @@ -136,6 +137,7 @@ class Tva extends CommonObject $sql .= "fk_user_creat,"; $sql .= "fk_user_modif"; $sql .= ") VALUES ("; + $sql .= " '".$conf->entity."',"; $sql .= " '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datep)."',"; $sql .= " '".$this->db->idate($this->datev)."',"; From adda436dab9acc806ff33c5ea25e9f21df41f90d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 12 Apr 2022 12:45:05 +0000 Subject: [PATCH 103/177] Fixing style errors. --- htdocs/compta/tva/class/tva.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index ce5ff657eca..c9fcf18d587 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -125,7 +125,7 @@ class Tva extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."tva("; - $sql .= "entity,"; + $sql .= "entity,"; $sql .= "datec,"; $sql .= "datep,"; $sql .= "datev,"; @@ -137,7 +137,7 @@ class Tva extends CommonObject $sql .= "fk_user_creat,"; $sql .= "fk_user_modif"; $sql .= ") VALUES ("; - $sql .= " '".$conf->entity."',"; + $sql .= " '".$conf->entity."',"; $sql .= " '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datep)."',"; $sql .= " '".$this->db->idate($this->datev)."',"; From 1bfd9c695fda90db19047a04305877bf809580e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Apr 2022 16:29:25 +0200 Subject: [PATCH 104/177] Update tva.class.php --- htdocs/compta/tva/class/tva.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index c9fcf18d587..a6828587763 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -137,7 +137,7 @@ class Tva extends CommonObject $sql .= "fk_user_creat,"; $sql .= "fk_user_modif"; $sql .= ") VALUES ("; - $sql .= " '".$conf->entity."',"; + $sql .= " ".((int) $conf->entity.", "; $sql .= " '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datep)."',"; $sql .= " '".$this->db->idate($this->datev)."',"; @@ -146,8 +146,8 @@ class Tva extends CommonObject $sql .= " '".$this->db->escape($this->note)."',"; $sql .= " '".$this->db->escape($this->fk_account)."',"; $sql .= " '".$this->db->escape($this->type_payment)."',"; - $sql .= " '".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id)."',"; - $sql .= " '".$this->db->escape($this->fk_user_modif)."'"; + $sql .= " ".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id).","; + $sql .= " ".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id); $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); From 6a7212a48df1a03baeed55960379992303141ad6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Apr 2022 22:02:46 +0200 Subject: [PATCH 105/177] Fix sql error --- htdocs/compta/tva/class/tva.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index a6828587763..1b71cb261e1 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -137,7 +137,7 @@ class Tva extends CommonObject $sql .= "fk_user_creat,"; $sql .= "fk_user_modif"; $sql .= ") VALUES ("; - $sql .= " ".((int) $conf->entity.", "; + $sql .= " ".((int) $conf->entity).", "; $sql .= " '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datep)."',"; $sql .= " '".$this->db->idate($this->datev)."',"; From 0fcfb7c5fd3988fb362ee550dd7edc6beb185c97 Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Thu, 14 Apr 2022 12:08:06 +0200 Subject: [PATCH 106/177] FIX intervention entity missing --- htdocs/fichinter/class/fichinter.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 371853dc70c..92b628b9aab 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -426,7 +426,7 @@ class Fichinter extends CommonObject $sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,"; $sql .= " f.date_valid as datev,"; $sql .= " f.tms as datem,"; - $sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat"; + $sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat, f.entity as entity"; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; if ($ref) { $sql .= " WHERE f.entity IN (".getEntity('intervention').")"; @@ -459,6 +459,7 @@ class Fichinter extends CommonObject $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; // deprecated $this->fk_contrat = $obj->fk_contrat; + $this->entity = $obj->entity; $this->user_creation = $obj->fk_user_author; From 02a3cfbb5f16672f2fff6c65f0fe6a0a3386d56b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Apr 2022 21:43:55 +0200 Subject: [PATCH 107/177] Update paymentsalary.class.php --- htdocs/salaries/class/paymentsalary.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 506e9b73ea5..08e850c259a 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -166,7 +166,7 @@ class PaymentSalary extends CommonObject if ($totalamount != 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (entity, fk_salary, datec, datep, amount,"; $sql .= " fk_typepayment, num_payment, note, fk_user_author, fk_bank)"; - $sql .= " VALUES (".$conf->entity.", ".$this->chid.", '".$this->db->idate($now)."',"; + $sql .= " VALUES (".((int) $conf->entity).", ".((int) $this->chid).", '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datepaye)."',"; $sql .= " ".price2num($totalamount).","; $sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".((int) $user->id).","; From 81f0aedc8f55b02297e62bf2b0d936a668b52db9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 15 Apr 2022 16:17:03 +0200 Subject: [PATCH 108/177] FIX SEPA ICS is not mandatory for bank transfer --- htdocs/compta/prelevement/create.php | 35 ++++++++++++++++------- htdocs/compta/prelevement/fiche-rejet.php | 6 ++-- htdocs/compta/prelevement/fiche-stat.php | 6 ++-- htdocs/compta/prelevement/list.php | 18 +++++++----- htdocs/compta/prelevement/orders_list.php | 18 +++++++----- htdocs/compta/prelevement/rejets.php | 18 +++++++----- htdocs/compta/prelevement/stats.php | 8 ++++-- 7 files changed, 69 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 172cf020e34..6416468fd63 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -39,12 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills')); -// Security check -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $type = GETPOST('type', 'aZ09'); // Get supervariables @@ -54,6 +48,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected $mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real'; $format = GETPOST('format', 'aZ09'); $id_bankaccount = GETPOST('id_bankaccount', 'int'); +$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { @@ -63,6 +59,17 @@ $offset = $limit * $page; $hookmanager->initHooks(array('directdebitcreatecard', 'globalcard')); +// Security check +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + +$error = 0; /* * Actions @@ -95,13 +102,15 @@ if (empty($reshook)) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $bank = new Account($db); $bank->fetch($conf->global->{$default_account}); - if ((empty($bank->ics) && $type !== 'bank-transfer') + // ICS is not mandatory with payment by bank transfer + /*if ((empty($bank->ics) && $type !== 'bank-transfer') || (empty($bank->ics_transfer) && $type === 'bank-transfer') - ) { + ) {*/ + if (empty($bank->ics) && $type !== 'bank-transfer') { $errormessage = str_replace('{url}', $bank->getNomUrl(1, '', '', -1, 1), $langs->trans("ErrorICSmissing", '{url}')); setEventMessages($errormessage, null, 'errors'); - header("Location: ".DOL_URL_ROOT.'/compta/prelevement/create.php'); - exit; + $action = ''; + $error++; } @@ -136,12 +145,16 @@ if (empty($reshook)) { setEventMessages($texttoshow, null); } - header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$bprev->id); + header("Location: ".DOL_URL_ROOT.'/compta/prelevement/card.php?id='.urlencode($bprev->id).'&type='.urlencode($type)); exit; } } $objectclass = "BonPrelevement"; + if ($type == 'bank-transfer') { + $uploaddir = $conf->paymentbybanktransfer->dir_output; + } else { $uploaddir = $conf->prelevement->dir_output; + } include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 8711f663d55..e1850575dc0 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -40,7 +40,7 @@ if ($user->socid > 0) { } // Get supervariables -$prev_id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $type = GETPOST('type', 'aZ09'); @@ -77,8 +77,8 @@ if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transf llxHeader('', $langs->trans("WithdrawalsReceipts")); -if ($prev_id > 0 || $ref) { - if ($object->fetch($prev_id, $ref) >= 0) { +if ($id > 0 || $ref) { + if ($object->fetch($id, $ref) >= 0) { $head = prelevement_prepare_head($object); print dol_get_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 4a9bfbf6345..9336ad51370 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -38,7 +38,7 @@ if ($user->socid > 0) { } // Get supervariables -$prev_id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $type = GETPOST('type', 'aZ09'); @@ -76,8 +76,8 @@ if (!$user->rights->paymentbybanktransfer->read && $object->type == 'bank-transf llxHeader('', $langs->trans("WithdrawalsReceipts")); -if ($prev_id > 0 || $ref) { - if ($object->fetch($prev_id, $ref) >= 0) { +if ($id > 0 || $ref) { + if ($object->fetch($id, $ref) >= 0) { $head = prelevement_prepare_head($object); print dol_get_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment'); diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index feb69bdc7fb..095d07460b9 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -42,13 +42,6 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'di $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $type = GETPOST('type', 'aZ09'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; @@ -80,6 +73,17 @@ $company = new Societe($db); $hookmanager->initHooks(array('withdrawalsreceiptslineslist')); +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * Actions diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 3ca9ce32fbe..2733223b5b5 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -33,13 +33,6 @@ $langs->loadLangs(array('banks', 'categories', 'withdrawals')); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'directdebitcredittransferlist'; // To manage different context of search -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $type = GETPOST('type', 'aZ09'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -72,6 +65,17 @@ if ($type == 'bank-transfer') { $usercancreate = $user->rights->paymentbybanktransfer->create; } +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * Actions diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index ed8c704bcfa..3aa57a6f3e0 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -33,13 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $type = GETPOST('type', 'aZ09'); // Get supervariables @@ -54,6 +47,17 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); +} + /* * View diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index ae1dd54a13c..7c7bce9f2ef 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -31,14 +31,18 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies')); +$type = GETPOST('type', 'aZ09'); + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) { $socid = $user->socid; } +if ($type == 'bank-transfer') { + $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); +} else { $result = restrictedArea($user, 'prelevement', '', '', 'bons'); - -$type = GETPOST('type', 'aZ09'); +} /* From cc9c49afc911e80b0ee407b9fbe1f5ca65f9cd89 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 15 Apr 2022 16:40:41 +0200 Subject: [PATCH 109/177] TODO ICS is not used with bank transfer --- htdocs/compta/bank/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 62b97f6d100..a6e8a3824e7 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -759,6 +759,7 @@ if ($action == 'create') { print ''; } + // TODO ICS is not used with bank transfer ! if ($conf->paymentbybanktransfer->enabled) { print ''.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')'; print ''.$object->ics_transfer.''; From ca0f98d09f65f7aa107ca30bab815388d2ebb410 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 22 Apr 2022 13:50:39 +0200 Subject: [PATCH 110/177] FIX : label tax cat trad --- htdocs/expensereport/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 50ee78b4097..31cf21c34ae 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2068,7 +2068,8 @@ if ($action == 'create') { // IK if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''; - print dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label'); + $exp_tax_cat_label = dol_getIdFromCode($db, $line->fk_c_exp_tax_cat, 'c_exp_tax_cat', 'rowid', 'label'); + print $langs->trans($exp_tax_cat_label); print ''; } From 694bcda3bbdbac9b79a74cf6b51df477be5660a7 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 25 Apr 2022 22:26:25 +0200 Subject: [PATCH 111/177] Fix #20712 - No more empty wrong line added in bookkeeping confirme_create mode --- htdocs/accountancy/bookkeeping/card.php | 63 ++++++++++++++----------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index c156a388735..0aa57dde3c6 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -260,7 +260,7 @@ if ($action == "confirm_update") { if ($mode != '_tmp') { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } - $action = 'update'; + $action = ''; $id = $object->id; $piece_num = $object->piece_num; } @@ -642,6 +642,12 @@ if ($action == 'create') { } print "\n"; + + // Empty line is the first line of $object->linesmvt + // So we must get the first line (the empty one) and pu it at the end of the array + // in order to display it correctly to the user + $empty_line = array_shift($object->linesmvt); + $object->linesmvt[]= $empty_line; foreach ($object->linesmvt as $line) { print ''; @@ -673,7 +679,33 @@ if ($action == 'create') { print ''."\n"; print ''; print ''; + } elseif (empty($line->numero_compte) || (empty($line->debit) &&empty($line->creit))) { + if ($action == "" || $action == 'add') { + print ''; + print ''; + print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, ''); + print ''; + print ''; + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: + // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. + // Also, it is not possible to use a value that is not in the list. + // Also, the label is not automatically filled when a value is selected. + if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + } else { + print ''; + } + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } } else { + print ''; $accountingaccount->fetch(null, $line->numero_compte, true); print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 0).''; print ''.length_accounta($line->subledger_account); @@ -715,33 +747,8 @@ if ($action == 'create') { setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); } - if (empty($object->date_export) && empty($object->date_validation)) { - if ($action == "" || $action == 'add') { - print ''; - print ''; - print ''; - print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, ''); - print ''; - print ''; - // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: - // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. - // Also, it is not possible to use a value that is not in the list. - // Also, the label is not automatically filled when a value is selected. - if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1); - } else { - print ''; - } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - print ''; - } + print ''; + print '
'; if ($mode == '_tmp' && $action == '') { print '
'; From 6a1d4c2255a0ac9fa77a97960f7315511dd893ce Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 25 Apr 2022 20:36:34 +0000 Subject: [PATCH 112/177] Fixing style errors. --- htdocs/accountancy/bookkeeping/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 0aa57dde3c6..0eff932fd19 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -642,7 +642,7 @@ if ($action == 'create') { } print "\n"; - + // Empty line is the first line of $object->linesmvt // So we must get the first line (the empty one) and pu it at the end of the array // in order to display it correctly to the user @@ -703,7 +703,7 @@ if ($action == 'create') { print ''; print ''; print ''; - } + } } else { print ''; $accountingaccount->fetch(null, $line->numero_compte, true); From c00a56bee3ce475fa268ea3cb707465702f6b4eb Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 26 Apr 2022 16:39:06 +0200 Subject: [PATCH 113/177] fix: truncate too long Ref Customer in PDF Header --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 6486306d9ed..96966606e1c 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1504,7 +1504,7 @@ class pdf_eratosthene extends ModelePDFCommandes $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R'); } if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 3134bbc63f5..1bbbb2c9f3f 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1961,7 +1961,7 @@ class pdf_sponge extends ModelePDFFactures $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R'); } if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 5fb9949acd3..cb2df1a5ed9 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1595,7 +1595,7 @@ class pdf_cyan extends ModelePDFPropales $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R'); } if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { From 399addfb033e07924ec988a65b87329d925b8a7e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 26 Apr 2022 16:40:27 +0200 Subject: [PATCH 114/177] mor docs --- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- .../doc/pdf_standard_recruitmentjobposition.modules.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 7e1b1105452..f2d2a473145 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1336,7 +1336,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R'); } /* PHFAVRE $posy+=4; diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 50e978aceab..cc215a855ff 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -919,7 +919,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R'); } if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { From 3d4bd1e1553a76c87bcf172d3f8640f86de09cf2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 26 Apr 2022 16:53:40 +0200 Subject: [PATCH 115/177] FIX: truncate Customer Reference too long on PDF header (PR #20718) --- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index f2d2a473145..aba01f51742 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1336,7 +1336,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R'); } /* PHFAVRE $posy+=4; From 5387a8e9530b19d4bdc32127196478c8673cba47 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 26 Apr 2022 19:07:31 +0200 Subject: [PATCH 116/177] FiX miss spelling --- htdocs/accountancy/bookkeeping/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 0eff932fd19..f9ec739e63d 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -679,7 +679,7 @@ if ($action == 'create') { print ''."\n"; print ''; print ''; - } elseif (empty($line->numero_compte) || (empty($line->debit) &&empty($line->creit))) { + } elseif (empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) { if ($action == "" || $action == 'add') { print ''; print ''; From fb7f0545e4a08dd5c835e2d1fe816c3003f839d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alo=C3=AFs=20Micard?= Date: Wed, 27 Apr 2022 17:56:31 +0200 Subject: [PATCH 117/177] Fix error reporting in getLinesArray() --- htdocs/modulebuilder/template/class/myobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index e7da913f39c..51992ada8ee 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -937,8 +937,8 @@ class MyObject extends CommonObject if (is_numeric($result)) { - $this->error = $this->error; - $this->errors = $this->errors; + $this->error = $objectline->error; + $this->errors = $objectline->errors; return $result; } else { $this->lines = $result; From 900caf5a443910fa4d3f98ff329b30115909c853 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Thu, 28 Apr 2022 12:12:20 +0200 Subject: [PATCH 118/177] Fix missing budget export --- htdocs/core/modules/modProjet.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 791442dab1c..b97aad1b149 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -222,7 +222,7 @@ class modProjet extends DolibarrModules 's.phone'=>'Text', 's.email'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 'p.rowid'=>"List:projet:ref::project", 'p.ref'=>"Text", 'p.title'=>"Text", 'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean', - 'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric', + 'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric', 'p.budget_amount'=>'Numeric', 'pt.rowid'=>'Numeric', 'pt.ref'=>'Text', 'pt.label'=>'Text', 'pt.dateo'=>"Date", 'pt.datee'=>"Date", 'pt.duration_effective'=>"Duree", 'pt.planned_workload'=>"Numeric", 'pt.progress'=>"Numeric", 'pt.description'=>"Text", 'ptt.rowid'=>'Numeric', 'ptt.task_date'=>'Date', 'ptt.task_duration'=>"Duree", 'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)", 'ptt.note'=>"Text" ); @@ -235,7 +235,7 @@ class modProjet extends DolibarrModules 's.phone'=>'Phone', 's.email'=>'Email', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 'p.rowid'=>"ProjectId", 'p.ref'=>"RefProject", 'p.title'=>'ProjectLabel', 'p.usage_opportunity'=>'ProjectFollowOpportunity', 'p.usage_task'=>'ProjectFollowTasks', 'p.usage_bill_time'=>'BillTime', - 'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.description'=>"Description" + 'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.budget_amount'=>'Budget', 'p.description'=>"Description" ); // Add multicompany field if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) From 971714f8e3a6dad07fe01fddf20eeaeac390414c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 1 May 2022 20:46:23 +0200 Subject: [PATCH 119/177] phpcs --- htdocs/compta/prelevement/create.php | 2 +- htdocs/compta/prelevement/stats.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 6416468fd63..4cf238b65f5 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -153,7 +153,7 @@ if (empty($reshook)) { if ($type == 'bank-transfer') { $uploaddir = $conf->paymentbybanktransfer->dir_output; } else { - $uploaddir = $conf->prelevement->dir_output; + $uploaddir = $conf->prelevement->dir_output; } include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 7c7bce9f2ef..9c30db6e08a 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -41,7 +41,7 @@ if ($user->socid) { if ($type == 'bank-transfer') { $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); } else { -$result = restrictedArea($user, 'prelevement', '', '', 'bons'); + $result = restrictedArea($user, 'prelevement', '', '', 'bons'); } From b5f887b3e484f95de3c5ceb1f637e8690894092e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 May 2022 11:52:32 +0200 Subject: [PATCH 120/177] Fix DEBUGBAR_USE_LOG_FILE --- htdocs/debugbar/class/DataCollector/DolLogsCollector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index dd6fabd508f..d74b0aa5275 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -72,7 +72,7 @@ class DolLogsCollector extends MessagesCollector { global $conf; - $uselogfile=$conf->global->DEBUGBAR_USE_LOGFILE; + $uselogfile=$conf->global->DEBUGBAR_USE_LOG_FILE; if ($uselogfile) { From affde5516901286ea9d100e2cb24ac0dd9831fbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 May 2022 12:08:24 +0200 Subject: [PATCH 121/177] FIX deprecated module are not more viewed as external modules Trans debugbar --- htdocs/admin/debugbar.php | 16 +++++++++------- htdocs/core/js/lib_head.js.php | 2 ++ htdocs/core/modules/DolibarrModules.class.php | 4 +++- htdocs/core/modules/modCashDesk.class.php | 2 +- htdocs/langs/en_US/admin.lang | 2 ++ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php index 19a440520b1..ce3c43bd69d 100644 --- a/htdocs/admin/debugbar.php +++ b/htdocs/admin/debugbar.php @@ -93,15 +93,17 @@ print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; print "\n"; -print ''.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").''; -print ''; // This slow seriously output -print ' '.$langs->trans("WarningValueHigherSlowsDramaticalyOutput"); +print ''.$langs->trans("DEBUGBAR_USE_LOG_FILE").''; +print ''; +print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1); +print ''; +print ' '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower").''; print ''; -print ''.$langs->trans("DEBUGBAR_USE_LOG_FILE").''; -print ''; -print $form->selectyesno('DEBUGBAR_USE_LOG_FILE', $conf->global->DEBUGBAR_USE_LOG_FILE, 1); -print ' '.$langs->trans("UsingLogFileShowAllRecordOfSubrequestButIsSlower"); +print ''.$langs->trans("DEBUGBAR_LOGS_LINES_NUMBER").''; +print ''; // This slow seriously output +print ''; +print ''.$langs->trans("WarningValueHigherSlowsDramaticalyOutput").''; print ''; print ''; diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index b3236ab1dcd..f75018fbdaf 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -963,6 +963,7 @@ function document_preview(file, type, title) img.src = file; } + function show_preview(mode) { /* console.log("mode="+mode+" file="+file+" type="+type+" width="+width+" height="+height); */ var newElem = ''; @@ -977,6 +978,7 @@ function document_preview(file, type, title) } $("#dialogforpopup").html(newElem); + $("#dialogforpopup").dialog({ closeOnEscape: true, resizable: true, diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 3b7cc0d1184..09ba25ce911 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -819,7 +819,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } /** - * Tells if module is core or external + * Tells if module is core or external. + * 'dolibarr' and 'dolibarr_deprecated' is core + * 'experimental' and 'development' is core * * @return string 'core', 'external' or 'unknown' */ diff --git a/htdocs/core/modules/modCashDesk.class.php b/htdocs/core/modules/modCashDesk.class.php index a128b92ee29..0128a51c0b8 100644 --- a/htdocs/core/modules/modCashDesk.class.php +++ b/htdocs/core/modules/modCashDesk.class.php @@ -51,7 +51,7 @@ class modCashDesk extends DolibarrModules $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "CashDesk module"; - $this->version = 'deprecated'; + $this->version = 'dolibarr_deprecated'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->picto = 'cash-register'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2e8d847ad11..bd4b4d8f7a6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2158,3 +2158,5 @@ YouShouldSetThisToOff=You should set this to 0 or off InstallAndUpgradeLockedBy=Install and upgrades are locked by the file %s IfYouUseASecondTaxYouMustSetYouUseTheMainTax=If you want to use a second tax, you must enable also the first sales tax IfYouUseAThirdTaxYouMustSetYouUseTheMainTax=If you want to use a third tax, you must enable also the first sales tax +DEBUGBAR_USE_LOG_FILE=Use the dolibarr.log file to trap Logs +UsingLogFileShowAllRecordOfSubrequestButIsSlower=Use the dolibarr.log file to trap Logs instead of live memory catching. It allows to catch all logs instead of only log of current process (so including the one of ajax subrequests pages) but will make your instance very very slow. Not recommended. From 29d1424413f56414b07536f461aca77862223d3a Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 5 May 2022 11:05:34 +0200 Subject: [PATCH 122/177] fix merge conflict Add missing error translation key --- htdocs/langs/en_US/errors.lang | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 37cc7a1b6fd..66c5d0e240d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -274,6 +274,7 @@ ErrorExecIdFailed=Can't execute command "id" ErrorBadCharIntoLoginName=Unauthorized character in the login name ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s" ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s" +ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by actual object status # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. @@ -307,8 +308,5 @@ WarningTheHiddenOptionIsOn=Warning, the hidden option %s is on. WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection. WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. -<<<<<<< HEAD WarningPaypalPaymentNotCompatibleWithStrict=The value 'Strict' makes the online payment features not working correctly. Use 'Lax' instead. -======= ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git From 10e13286d376d3c263e3f1cae5ecedba8027abad Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 5 May 2022 11:04:27 +0200 Subject: [PATCH 123/177] Add missing reception back to draft error handling --- htdocs/reception/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index fda5a3910b7..9a679c067f8 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -197,6 +197,8 @@ if (empty($reshook)) { $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } + } else { + setEventMessages($object->error, $object->errors, 'errors'); } } From f3a630fd3090a701a344b7ccee62e243074f9d72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 May 2022 05:08:54 +0200 Subject: [PATCH 124/177] Clean code --- htdocs/install/mysql/tables/llx_product.sql | 4 +- .../mysql/tables/llx_product_price.sql | 4 +- htdocs/langs/fr_FR/main.lang | 2 +- htdocs/product/price.php | 65 ++++++++++++++----- 4 files changed, 55 insertions(+), 20 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 4aad3393137..809ef5fbd65 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -40,8 +40,8 @@ create table llx_product customcode varchar(32), -- Optionnal custom code fk_country integer DEFAULT NULL, -- Optionnal id of original country fk_state integer DEFAULT NULL, -- Optionnal id of original state/province - price double(24,8) DEFAULT 0, - price_ttc double(24,8) DEFAULT 0, + price double(24,8) DEFAULT 0, -- price without tax + price_ttc double(24,8) DEFAULT 0, -- price inc vat (but not localtax1 nor localtax2) price_min double(24,8) DEFAULT 0, price_min_ttc double(24,8) DEFAULT 0, price_base_type varchar(3) DEFAULT 'HT', diff --git a/htdocs/install/mysql/tables/llx_product_price.sql b/htdocs/install/mysql/tables/llx_product_price.sql index ff862e427e0..690476e17b7 100644 --- a/htdocs/install/mysql/tables/llx_product_price.sql +++ b/htdocs/install/mysql/tables/llx_product_price.sql @@ -29,8 +29,8 @@ create table llx_product_price fk_product integer NOT NULL, date_price datetime NOT NULL, price_level smallint NULL DEFAULT 1, - price double(24,8) DEFAULT NULL, - price_ttc double(24,8) DEFAULT NULL, + price double(24,8) DEFAULT NULL, -- price without tax + price_ttc double(24,8) DEFAULT NULL, -- price inc vat (but not localtax1 nor localtax2) price_min double(24,8) default NULL, price_min_ttc double(24,8) default NULL, price_base_type varchar(3) DEFAULT 'HT', diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 448cc597a48..3b427a05341 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -415,7 +415,7 @@ TotalLT2IN=Total SGST HT=HT TTC=TTC INCVATONLY=TVA incluse -INCT=TTC +INCT=TVA+Taxes locales incluses VAT=TVA VATIN=IGST VATs=TVA diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 674b0a19cab..226ace2df9d 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1482,6 +1482,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul } $sql .= " ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC"; // $sql .= $db->plimit(); + //print $sql; $result = $db->query($sql); if ($result) { @@ -1520,8 +1521,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul print_barre_liste($langs->trans("PriceByCustomerLog"), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, $num, 'title_accountancy.png'); } - print '
'; - print ''; + print ''."\n"; + print '
'."\n"; + print '
'."\n"; print ''; print ''; @@ -1539,6 +1541,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul } print ''; print ''; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { + print ''; + } if (!empty($conf->dynamicprices->enabled)) { print ''; } @@ -1605,6 +1610,24 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul print ""; } + // Line for default price + if ($object->price_base_type == 'HT') { + $pu = $objp->price; + } else { + $pu = $objp->price_ttc; + } + + // Local tax was not saved into table llx_product on old version. So we will use value linked to VAT code. + $localtaxarray = getLocalTaxesFromRate($objp->tva_tx.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), 0, $mysoc, $mysoc); + // Define part of HT, VAT, TTC + $resultarray = calcul_price_total(1, $pu, 0, $objp->tva_tx, 1, 1, 0, $objp->price_base_type, $objp->recuperableonly, $object->type, $mysoc, $localtaxarray); + // Calcul du total ht sans remise + $total_ht = $resultarray[0]; + $total_vat = $resultarray[1]; + $total_localtax1 = $resultarray[9]; + $total_localtax2 = $resultarray[10]; + $total_ttc = $resultarray[2]; + // Price if (!empty($objp->fk_price_expression) && !empty($conf->dynamicprices->enabled)) { $price_expression = new PriceExpression($db); @@ -1612,32 +1635,46 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul $title = $price_expression->title; print ''; print ''; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { + print ''; + } print '"; } else { + // Price HT print '"; + // Price TTC print '"; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { + print ''; + } if (!empty($conf->dynamicprices->enabled)) { //Only if module is enabled print ''; } } + // Price min print ''; + // Price min inc tax print ''; @@ -2040,12 +2077,15 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; - print '
'; - print '
'.$langs->trans("AppliedPricesFrom").''.$langs->trans("HT").''.$langs->trans("TTC").''.$langs->trans("INCT").''.$langs->trans("PriceExpressionSelected").''.$title."'; if (empty($objp->price_by_qty)) { print price($objp->price); } print "'; if (empty($objp->price_by_qty)) { - print price($objp->price_ttc); + $price_ttc = $objp->price_ttc; + print price($price_ttc); } print "'; + print $resultarray[2]; + print ''; if (empty($objp->price_by_qty)) { print price($objp->price_min); } print ''; if (empty($objp->price_by_qty)) { - print price($objp->price_min_ttc); + $price_min_ttc = $objp->price_min_ttc; + print price($price_min_ttc); } print '
'; + print ''."\n"; + print '
'."\n"; + print '
'."\n"; if (count($prodcustprice->lines) > 0 || $search_soc) { $colspan = 9; - //if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") $colspan++; + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { + $colspan++; + } print ''; print ''; @@ -2065,13 +2105,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; + print ''; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - //print ''; print ''; - } else { - print ''; } - print ''; print ''; print ''; @@ -2085,7 +2122,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $pu = $object->price_ttc; } - // Local tax is not saved into table of product. We use value linked to VAT code. + // Local tax was not saved into table llx_product on old version. So we will use value linked to VAT code. $localtaxarray = getLocalTaxesFromRate($object->tva_tx.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), 0, $mysoc, $mysoc); // Define part of HT, VAT, TTC $resultarray = calcul_price_total(1, $pu, 0, $object->tva_tx, 1, 1, 0, $object->price_base_type, $object->recuperableonly, $object->type, $mysoc, $localtaxarray); @@ -2123,14 +2160,12 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '"; + print '"; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { //print '"; print ''; - } else { - print '"; } - print ''; print ''; print ''; // Year print ''; print ''; print ''; + print ''; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - //print ''; print ''; - } else { - print ''; } print ''; print ''; @@ -2030,11 +2065,9 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ""; print '"; + print '"; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { - //print '"; print ''; - } else { - print '"; } print ''; @@ -2236,11 +2269,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ""; print '"; + print '"; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { //print '"; print ''; - } else { - print '"; } print ''; From ec00c6fef2e939532b4a87ff35ba9832d245e133 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Mon, 9 May 2022 09:49:07 +0200 Subject: [PATCH 128/177] line deleted when updated after rapproched Fix an issue that deletes line when we update data after its rappro. --- htdocs/compta/bank/line.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index b3675feb63e..ce8644afe9b 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -607,7 +607,11 @@ if ($result) { print dol_get_fiche_end(); - print '

'; + if (!$objp->rappro) { + print '

'; + }else{ + print '

'; + } print ""; From 017eb99e8603302eeb8c96b3ca73d4feb4b911a7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 9 May 2022 07:53:37 +0000 Subject: [PATCH 129/177] Fixing style errors. --- htdocs/compta/bank/line.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index ce8644afe9b..d1750a0bb94 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -609,9 +609,9 @@ if ($result) { if (!$objp->rappro) { print '

'; - }else{ - print '

'; - } + } else { + print '

'; + } print ""; From 8ef75ecc7c1dd5f47e59c7af5f676cf2870e8ff3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 May 2022 15:27:43 +0200 Subject: [PATCH 130/177] Better fix fox #20807 --- htdocs/compta/bank/line.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index d1750a0bb94..90a35b30c86 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -52,11 +52,12 @@ if (!empty($conf->salaries->enabled)) { $id = GETPOST('rowid', 'int'); -$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int')); +$rowid = GETPOST("rowid", 'int'); +$accountoldid = GETPOST('account', 'int'); // GETPOST('account') is old account id +$accountid = GETPOST('accountid', 'int'); // GETPOST('accountid') is new account id $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); -$rowid = GETPOST("rowid", 'int'); $orig_account = GETPOST("orig_account"); $backtopage = GETPOST('backtopage', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); @@ -68,7 +69,7 @@ if ($user->socid) { $socid = $user->socid; } -$result = restrictedArea($user, 'banque', $accountid, 'bank_account'); +$result = restrictedArea($user, 'banque', $accountoldid, 'bank_account'); if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) { accessforbidden(); } @@ -126,15 +127,19 @@ if ($user->rights->banque->modifier && $action == "update") { $acline->fetch($rowid); $acsource = new Account($db); - $acsource->fetch($id); + $acsource->fetch($accountoldid); $actarget = new Account($db); if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account $actarget->fetch(GETPOST('accountid', 'int')); } else { - $actarget->fetch($id); + $actarget->fetch($accountoldid); } + if (!($actarget->id > 0)) { + setEventMessages($langs->trans("ErrorFailedToLoadBankAccount"), null, 'errors'); + $error++; + } if ($actarget->courant == Account::TYPE_CASH && GETPOST('value', 'alpha') != 'LIQ') { setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors'); $error++; @@ -228,7 +233,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == $db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."bank"; - $sql .= " SET num_releve=".($num_rel ? "'".$db->escape($num_rel)."'" : "null"); + $sql .= " SET num_releve = ".($num_rel ? "'".$db->escape($num_rel)."'" : "null"); if (empty($num_rel)) { $sql .= ", rappro = 0"; } else { @@ -302,7 +307,6 @@ if ($result) { print ''; print ''; print ''; - print ''; print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0); @@ -607,11 +611,7 @@ if ($result) { print dol_get_fiche_end(); - if (!$objp->rappro) { - print '

'; - } else { - print '

'; - } + print '

'; print ""; From aee6f408b255d40db1d46ad87a33ff88e6c15fe5 Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 11 May 2022 09:30:39 +0200 Subject: [PATCH 131/177] FIX: Set datec when add time spent on a project task --- htdocs/projet/class/task.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 8d9f91afaca..cda8494682b 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1144,6 +1144,7 @@ class Task extends CommonObject dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); $ret = 0; + $now = dol_now(); // Check parameters if (!is_object($user)) { @@ -1169,6 +1170,7 @@ class Task extends CommonObject $sql .= ", task_duration"; $sql .= ", fk_user"; $sql .= ", note"; + $sql .= ", datec"; $sql .= ") VALUES ("; $sql .= $this->id; $sql .= ", '".$this->db->idate($this->timespent_date)."'"; @@ -1177,6 +1179,7 @@ class Task extends CommonObject $sql .= ", ".$this->timespent_duration; $sql .= ", ".$this->timespent_fk_user; $sql .= ", ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null"); + $sql .= ", '".$this->db->idate($now)."'"; $sql .= ")"; $resql = $this->db->query($sql); From 978db41f37cd61ef59b0d4a8f383b6c024d899b1 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 17 May 2022 15:50:45 +0200 Subject: [PATCH 132/177] FIX qty received label in Squille PDF model --- .../reception/doc/pdf_squille.modules.php | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 38344a5f486..d81a01bea92 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -523,9 +523,9 @@ class pdf_squille extends ModelePdfReception while ($pagenb < $pageposafter) { $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object); } $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; @@ -534,9 +534,9 @@ class pdf_squille extends ModelePdfReception } if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object); } $this->_pagefoot($pdf, $object, $outputlangs, 1); // New page @@ -550,10 +550,10 @@ class pdf_squille extends ModelePdfReception // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -719,9 +719,10 @@ class pdf_squille extends ModelePdfReception * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param Object|NULL $object Object reception to generate * @return void */ - protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) + protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $object = null) { global $conf; @@ -767,7 +768,18 @@ class pdf_squille extends ModelePdfReception $pdf->line($this->posxqtytoship - 1, $tab_top, $this->posxqtytoship - 1, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxqtytoship, $tab_top + 1); - $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToReceive"), '', 'C'); + $statusreceived = Reception::STATUS_CLOSED; + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION")) { + $statusreceived = Reception::STATUS_VALIDATED; + } + if (getDolGlobalInt("STOCK_CALCULATE_ON_RECEPTION_CLOSE")) { + $statusreceived = Reception::STATUS_CLOSED; + } + if ($object && $object->statut < $statusreceived) { + $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyToReceive'), '', 'C'); + } else { + $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities('QtyReceived'), '', 'C'); + } } if (!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) { From 180d94b43c93a5d165f6d7a9d326e84ad9aa8fa3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 May 2022 20:31:50 +0200 Subject: [PATCH 133/177] More log --- htdocs/website/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0e192ff0212..b7062b4f599 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2741,6 +2741,7 @@ if (!GETPOST('hide_websitemenu')) { $htmltext .= '
'.$langs->trans("GoTo").' '.$virtualurl.'

'; } if (!empty($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER)) { + $htmltext .= ''; $htmltext .= '
'.$langs->trans($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER); } else { $htmltext .= $langs->trans("SetHereVirtualHost", $dataroot); From 25196fa7092b561ab14cd3f0c670aed31a2de2cc Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 19 May 2022 10:20:31 +0200 Subject: [PATCH 134/177] FIX: new member subscription: bank account and payment mode might be hidden --- htdocs/adherents/subscription.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 799f043c4df..c069f0d12e2 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -960,12 +960,12 @@ if ($rowid > 0) { // Bank account print '
\n"; // Payment mode print '\n"; // Date of payment From 3d734e8d34aec40ea22051f99b5e9bad79c67ffa Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 20 May 2022 09:22:16 +0200 Subject: [PATCH 135/177] FIX regression PR #20713 Please do not revert with PR #20900 --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5635df3c8e7..5f3def1d3ee 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1857,7 +1857,7 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; From a2fe72225f61054db1f58342d5f1f00177f70595 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Fri, 20 May 2022 10:06:28 +0200 Subject: [PATCH 136/177] NEW : hook for dol_format_address --- htdocs/core/lib/functions.lib.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e891904e39e..19fa4cd5c63 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2154,7 +2154,7 @@ function dol_bc($var, $moreclass = '') */ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs = '', $mode = 0, $extralangcode = '') { - global $conf, $langs; + global $conf, $langs, $hookmanager; $ret = ''; $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS @@ -2220,6 +2220,14 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $langs->load("dict"); $ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code))); } + if ($hookmanager) { + $parameters = array('withcountry' => $withcountry, 'sep' => $sep, 'outputlangs' => $outputlangs,'mode' => $mode, 'extralangcode' => $extralangcode); + $reshook = $hookmanager->executeHooks('formatAddress', $parameters, $object); + if ($reshook > 0) { + $ret = ''; + } + $ret .= $hookmanager->resPrint; + } return $ret; } From c08c86a9d8bcb5891e8f142f07f8f4d5735b3062 Mon Sep 17 00:00:00 2001 From: IC-Ilies Date: Fri, 20 May 2022 17:52:53 +0200 Subject: [PATCH 137/177] FIX #20828 --- htdocs/fichinter/card-rec.php | 7 ++++--- htdocs/fichinter/class/fichinter.class.php | 1 - htdocs/fichinter/class/fichinterrec.class.php | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 260bff00016..0dd1c4c2d4d 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -166,7 +166,7 @@ if ($action == 'add') { // on récupère les enregistrements $object->fetch($id); - + $res = $object->fetch_lines(); // on transfert les données de l'un vers l'autre if ($object->socid > 0) { $newinter->socid = $object->socid; @@ -178,6 +178,7 @@ if ($action == 'add') { $newinter->entity = $object->entity; $newinter->duree = $object->duree; + $newinter->datei = $object->date; $newinter->description = $object->description; $newinter->note_private = $object->note_private; @@ -194,7 +195,7 @@ if ($action == 'add') { if ($newfichinterid > 0) { // Now we add line of details foreach ($object->lines as $line) { - $newinter->addline($user, $newfichinterid, $line->desc, '', $line->duree, ''); + $newinter->addline($user, $newfichinterid, $line->desc, $line->datei, $line->duree, ''); } // on update le nombre d'inter crée à partir du modèle @@ -743,7 +744,7 @@ if ($action == 'create') { print ''; + print $langs->trans("AddIntervention").''; } if ($user->rights->ficheinter->supprimer) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 92b628b9aab..000b654bf72 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1347,7 +1347,6 @@ class Fichinter extends CommonObject $line->fetch_optionals(); $this->lines[$i] = $line; - $i++; } $this->db->free($resql); diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 4fe35c32a2c..ed43bae8377 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -349,7 +349,7 @@ class FichinterRec extends Fichinter { // phpcs:enable $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, '; - $sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, '; + $sql .= ' l.price, l.qty, l.tva_tx, l.remise, l.remise_percent, l.subprice, l.duree, l.date, '; $sql .= ' l.total_ht, l.total_tva, l.total_ttc,'; $sql .= ' l.rang, l.special_code,'; $sql .= ' l.fk_unit, p.ref as product_ref, p.fk_product_type as fk_product_type,'; @@ -366,7 +366,6 @@ class FichinterRec extends Fichinter while ($i < $num) { $objp = $this->db->fetch_object($result); $line = new FichinterLigne($this->db); - $line->id = $objp->rowid; $line->label = $objp->custom_label; // Label line $line->desc = $objp->description; // Description line @@ -386,8 +385,6 @@ class FichinterRec extends Fichinter $line->fk_product = $objp->fk_product; $line->date_start = $objp->date_start; $line->date_end = $objp->date_end; - $line->date_start = $objp->date_start; - $line->date_end = $objp->date_end; $line->info_bits = $objp->info_bits; $line->total_ht = $objp->total_ht; $line->total_tva = $objp->total_tva; From 8231a9ea0fab852d3c9268c29a97833d7f3f49f2 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 20 May 2022 23:29:35 +0200 Subject: [PATCH 138/177] Fix wrong right test to show button --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 07d3e018390..acd6a60f0f9 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2648,7 +2648,7 @@ if ($action != 'create' && $action != 'edit') } // If bank module is not used - if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->status == ExpenseReport::STATUS_APPROVED) + if (($user->rights->expensereport->to_paid && empty($conf->banque->enabled)) && $object->status == ExpenseReport::STATUS_APPROVED) { //if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) if ($object->paid == 0) From 4c10ef8f4c913cca2c16b3be2cfda25c5687ea22 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 21 May 2022 15:36:04 +0200 Subject: [PATCH 139/177] Fix labels in tickets widgets --- htdocs/core/boxes/box_graph_nb_tickets_type.php | 2 +- htdocs/core/boxes/box_graph_ticket_by_severity.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_graph_nb_tickets_type.php b/htdocs/core/boxes/box_graph_nb_tickets_type.php index 2da54d84e7a..f4efce23797 100644 --- a/htdocs/core/boxes/box_graph_nb_tickets_type.php +++ b/htdocs/core/boxes/box_graph_nb_tickets_type.php @@ -131,7 +131,7 @@ class box_graph_nb_tickets_type extends ModeleBoxes } foreach ($listofoppcode as $rowid => $code) { $dataseries[] = array( - 'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_category', 'code', 'label', $code), + 'label' => $langs->getLabelFromKey($this->db, 'TicketTypeShort' . $code, 'c_ticket_type', 'code', 'label', $code), 'data' => (empty($data[$code]) ? 0 : $data[$code]) ); } diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index 13cd0c40c86..a7fa571b6c7 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -152,7 +152,7 @@ class box_graph_ticket_by_severity extends ModeleBoxes } foreach ($listofoppcode as $rowid => $code) { $dataseries[] = array( - 'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_category', 'code', 'label', $code), + 'label' => $langs->getLabelFromKey($this->db, 'TicketSeverityShort' . $code, 'c_ticket_severity', 'code', 'label', $code), 'data' => (empty($data[$code]) ? 0 : $data[$code]) ); } From 4932f86a2d2f5cc04d065417cc5eccdff7eb4899 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 21 May 2022 15:41:34 +0200 Subject: [PATCH 140/177] Fix default value for boolean extrafield --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 02421ea9157..14c91ccd19a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7518,7 +7518,7 @@ abstract class CommonObject } // HTML, text, select, integer and varchar: take into account default value in database if in create mode - if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int'))) { + if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'varchar', 'select', 'int', 'boolean'))) { if ($action == 'create') { $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) || $value) ? $value : $extrafields->attributes[$this->table_element]['default'][$key]; } From 9b2a54317090025c0dc5151b0f12c25a1abd46ef Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 21 May 2022 15:49:27 +0200 Subject: [PATCH 141/177] Fix phpcs too long line --- htdocs/core/class/commonobject.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 14c91ccd19a..a706583c7cc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7503,14 +7503,16 @@ abstract class CommonObject if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility $datenotinstring = $this->db->jdate($datenotinstring); } - $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(12, 0, 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3)) : $datenotinstring; + $datekey = $keyprefix.'options_'.$key.$keysuffix; + $value = (GETPOSTISSET($datekey)) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring; } if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) { $datenotinstring = $this->array_options['options_'.$key]; if (!is_numeric($this->array_options['options_'.$key])) { // For backward compatibility $datenotinstring = $this->db->jdate($datenotinstring); } - $value = (GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)) ? dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."sec", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."month", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day", 'int', 3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year", 'int', 3), 'tzuserrel') : $datenotinstring; + $timekey = $keyprefix.'options_'.$key.$keysuffix; + $value = (GETPOSTISSET($timekey)) ? dol_mktime(GETPOST($timekey.'hour', 'int', 3), GETPOST($timekey.'min', 'int', 3), GETPOST($timekey.'sec', 'int', 3), GETPOST($timekey.'month', 'int', 3), GETPOST($timekey.'day', 'int', 3), GETPOST($timekey.'year', 'int', 3), 'tzuserrel') : $datenotinstring; } // Convert float submited string into real php numeric (value in memory must be a php numeric) if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('price', 'double'))) { From d8a68d280ee197729dfc700acf05d9d1f301e0a5 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sat, 21 May 2022 17:06:36 +0200 Subject: [PATCH 142/177] FIX missing morecss for multiselectarray --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 02421ea9157..bbca87fe125 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6760,7 +6760,7 @@ abstract class CommonObject $out .= ''; } elseif ($type == 'checkbox') { $value_arr = explode(',', $value); - $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%'); + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, $morecss, 0, '100%'); } elseif ($type == 'radio') { $out = ''; foreach ($param['options'] as $keyopt => $val) { From e5c38572d196bb38ae0f3bedbba784f55ed2ce94 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 22 May 2022 00:23:16 +0200 Subject: [PATCH 143/177] Fix no document available on job candidature --- htdocs/core/modules/modRecruitment.class.php | 12 +++++------- .../recruitment/modules_recruitmentcandidature.php | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php index 3d4e88872ef..41679c19a1c 100644 --- a/htdocs/core/modules/modRecruitment.class.php +++ b/htdocs/core/modules/modRecruitment.class.php @@ -423,7 +423,7 @@ class modRecruitment extends DolibarrModules $sql = array(); // Document template - $moduledir = 'mymodule'; + $moduledir = 'recruitment'; $myTmpObjects = array(); $myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration'=>1, 'includedocgeneration'=>1); @@ -431,10 +431,10 @@ class modRecruitment extends DolibarrModules if ($myTmpObjectKey == 'MyObject') { continue; } - if ($myTmpObjectArray['includerefgeneration']) { - $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule'; - $dest = $dirodt.'/template_myobjects.odt'; + if ($myTmpObjectArray['includedocgeneration']) { + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_recruitmentjobposition.odt'; + $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; + $dest = $dirodt.'/template_recruitmentjobposition.odt'; if (file_exists($src) && !file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -450,8 +450,6 @@ class modRecruitment extends DolibarrModules $sql = array_merge($sql, array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")", - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")" )); } } diff --git a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php index 84bfd30401c..089aa720fa7 100644 --- a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php +++ b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php @@ -51,7 +51,7 @@ abstract class ModelePDFRecruitmentCandidature extends CommonDocGenerator // phpcs:enable global $conf; - $type = 'recruitmentjobposition'; + $type = 'recruitmentjobcandidature'; $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; From c1473b55149d6ae578a75712dded5ee7668662dc Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sun, 22 May 2022 01:21:52 +0200 Subject: [PATCH 144/177] fix #18338: Undefined property $ficheinter --- htdocs/comm/propal/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a77e242379f..bf0c63e5b11 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -121,7 +121,9 @@ $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights-> $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; -$usercancreateintervention = $user->rights->ficheinter->creer; +if ($conf->ficheinter->enabled) { + $usercancreateintervention = $user->rights->ficheinter->creer; +} $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php From 4a222fe5d5e91c946abb92ffe6bf2acb76c31e01 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sun, 22 May 2022 01:38:32 +0200 Subject: [PATCH 145/177] fix potential warning ($conf->ficheinter->enabled) --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/ticket/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index bf0c63e5b11..3e9c2cb4eeb 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -121,7 +121,7 @@ $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights-> $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; -if ($conf->ficheinter->enabled) { +if (!empty($conf->ficheinter->enabled)) { $usercancreateintervention = $user->rights->ficheinter->creer; } $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3ed5ede556c..3e5ec08a0f3 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2525,7 +2525,7 @@ if ($action == 'create' && $usercancreate) { } // Create intervention - if ($conf->ficheinter->enabled) { + if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index ab2c2794e38..9c1a7c709b7 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1047,7 +1047,7 @@ if ($action == 'create' || $action == 'presend') { print ''; // Timing (Duration sum of linked fichinter) - if ($conf->ficheinter->enabled) { + if (!empty($conf->ficheinter->enabled)) { $object->fetchObjectLinked(); $num = count($object->linkedObjects); $timing = 0; From 45bc1ff28748b8f4193bd0cba6acf32538f824c5 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sun, 22 May 2022 01:50:01 +0200 Subject: [PATCH 146/177] fix #18339 : Attempt to read property creer --- htdocs/comm/propal/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a77e242379f..501be1bbca1 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -121,7 +121,9 @@ $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights-> $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; -$usercancreateintervention = $user->rights->ficheinter->creer; +if (!empty($conf->ficheinter->enabled)) { + $usercancreateintervention = $user->rights->ficheinter->creer; +} $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php From 1ca1afd73402b5e57167583c8c1b1f39c2d790f3 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sun, 22 May 2022 01:50:10 +0200 Subject: [PATCH 147/177] fix #18339 : Attempt to read property creer --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 501be1bbca1..3e9c2cb4eeb 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -122,7 +122,7 @@ $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; if (!empty($conf->ficheinter->enabled)) { - $usercancreateintervention = $user->rights->ficheinter->creer; + $usercancreateintervention = $user->rights->ficheinter->creer; } $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); From c3fb7647c5f8cf4d4cd8d744af1fecc2f5e2cbed Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 22 May 2022 02:30:35 +0200 Subject: [PATCH 148/177] Fix delete customer payment --- htdocs/compta/paiement/card.php | 2 +- htdocs/core/lib/security.lib.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index b53debd79ba..47897902a9c 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -48,7 +48,7 @@ $object = new Paiement($db); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$result = restrictedArea($user, $object->element, $object->id, 'paiement', ''); +$result = restrictedArea($user, $object->element, $object->id, 'paiement'); // Security check if ($user->socid) $socid = $user->socid; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index f8bde1ce489..c1eda701604 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -185,7 +185,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft"); //print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid; - //print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select; + //print ", dbtablename=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select; //print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."
"; $parentfortableentity = ''; @@ -374,6 +374,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f } elseif ($feature == 'salaries') { if (!$user->rights->salaries->delete) $deleteok = 0; + } elseif ($feature == 'payment') { + if (!$user->rights->facture->paiement) $deleteok = 0; } elseif ($feature == 'payment_supplier') { if (!$user->rights->fournisseur->facture->creer) { $deleteok = 0; } From a193474fa38046605fdca8cfabcad92a315242f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 May 2022 17:15:43 +0200 Subject: [PATCH 149/177] Update card.php --- htdocs/comm/propal/card.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3e9c2cb4eeb..cb7e512bc36 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -121,9 +121,7 @@ $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights-> $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; -if (!empty($conf->ficheinter->enabled)) { - $usercancreateintervention = $user->rights->ficheinter->creer; -} +$usercancreateintervention = empty($conf->ficheinter->enabled) ? 0 : $user->rights->ficheinter->creer; $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php From 460687504cb1b1973a04e6c0aa490883afd35bc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 May 2022 17:16:48 +0200 Subject: [PATCH 150/177] Update card.php --- htdocs/comm/propal/card.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3e9c2cb4eeb..cb7e512bc36 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -121,9 +121,7 @@ $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights-> $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; -if (!empty($conf->ficheinter->enabled)) { - $usercancreateintervention = $user->rights->ficheinter->creer; -} +$usercancreateintervention = empty($conf->ficheinter->enabled) ? 0 : $user->rights->ficheinter->creer; $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php From 192f273e27dca33865cad196c6b041556bca1e56 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 24 May 2022 15:02:35 +0200 Subject: [PATCH 151/177] FIX: Fix show errors in card --- htdocs/contrat/card.php | 7 +++---- htdocs/fichinter/card.php | 10 ++++++++-- htdocs/projet/tasks/task.php | 3 +++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 1466f595b3d..624d59b0d94 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -236,10 +236,6 @@ if (empty($reshook)) { } $id = $object->create($user); - if ($id < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - if ($id > 0) { dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); @@ -351,6 +347,9 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; } + if ($error) { + $action = 'create'; + } } else { $result = $object->create($user); if ($result > 0) { diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 225f9ebacb8..8fb73d1b780 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -375,11 +375,15 @@ if (empty($reshook)) { } } } else { - $mesg = $srcobject->error; + $langs->load("errors"); + setEventMessages($srcobject->error, $srcobject->errors, 'errors'); + $action = 'create'; $error++; } } else { - $mesg = $object->error; + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create'; $error++; } } else { @@ -403,12 +407,14 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; + $error++; } } } } else { $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")); $action = 'create'; + $error++; } } elseif ($action == 'update' && $user->rights->ficheinter->creer) { $object->socid = $socid; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index bec61ec0f48..86ac5b3caab 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -116,7 +116,10 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { $result = $object->update($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); + $action='edit'; } + } else { + $action = 'edit'; } } else { $action = 'edit'; From 79462c43fa57d754ddb02746a376275f14ebe2b8 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 24 May 2022 15:13:19 +0200 Subject: [PATCH 152/177] FIX: Fix get origin from other than supplier proposal when add a new supplier proposal --- htdocs/supplier_proposal/card.php | 32 +++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 1500f00ba91..4ad5fa9ff56 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -303,8 +303,20 @@ if (empty($reshook)) { if (!$error) { if ($origin && $originid) { - $element = 'supplier_proposal'; - $subelement = 'supplier_proposal'; + $element = $subelement = $origin; + if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { + $element = $regs[1]; + $subelement = $regs[2]; + } + + // For compatibility + if ($element == 'order') { + $element = $subelement = 'commande'; + } + if ($element == 'propal') { + $element = 'comm/propal'; + $subelement = 'propal'; + } $object->origin = $origin; $object->origin_id = $originid; @@ -1063,8 +1075,20 @@ if ($action == 'create') { // Load objectsrc if (!empty($origin) && !empty($originid)) { - $element = 'supplier_proposal'; - $subelement = 'supplier_proposal'; + $element = $subelement = GETPOST('origin'); + if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin'), $regs)) { + $element = $regs[1]; + $subelement = $regs[2]; + } + + // For compatibility + if ($element == 'order' || $element == 'commande') { + $element = $subelement = 'commande'; + } + if ($element == 'propal') { + $element = 'comm/propal'; + $subelement = 'propal'; + } dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); From 8213756c37c00c9f11bcf15d1d11ae371bb4776f Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 24 May 2022 16:49:55 +0200 Subject: [PATCH 153/177] fix sql to avoid getting product_stock of another product with same batch --- htdocs/product/class/productbatch.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 05cfd7523e0..f81cf8f326a 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -534,6 +534,7 @@ class Productbatch extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock AS ps ON ps.rowid = pb.fk_product_stock"; $sql .= " WHERE p.entity IN (".getEntity('product').")"; $sql .= " AND pl.fk_product = ".$fk_product; + $sql .= " AND ps.fk_product = ".$fk_product; if ($fk_warehouse > 0) { $sql .= " AND ps.fk_entrepot = ".$fk_warehouse; } From 6f83c8c6f33480ea5c6772e54ad998298ac8b64e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 May 2022 21:22:14 +0200 Subject: [PATCH 154/177] Update productbatch.class.php --- htdocs/product/class/productbatch.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index f81cf8f326a..3093403d813 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -531,12 +531,11 @@ class Productbatch extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."product_lot as pl"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pl.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_batch AS pb ON pl.batch = pb.batch"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock AS ps ON ps.rowid = pb.fk_product_stock"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock AS ps ON ps.rowid = pb.fk_product_stock AND ps.fk_product = ".((int) $fk_product); $sql .= " WHERE p.entity IN (".getEntity('product').")"; - $sql .= " AND pl.fk_product = ".$fk_product; - $sql .= " AND ps.fk_product = ".$fk_product; + $sql .= " AND pl.fk_product = ".((int) $fk_product); if ($fk_warehouse > 0) { - $sql .= " AND ps.fk_entrepot = ".$fk_warehouse; + $sql .= " AND ps.fk_entrepot = ".((int) $fk_warehouse); } if ($qty_min !== null) { $sql .= " AND pb.qty > ".$qty_min; From 4e289741f9bc0c0e6cc057bfa8c01847107d5a4b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 25 May 2022 16:59:23 +0200 Subject: [PATCH 155/177] fix: extrafields chkbxlst or checkbox or badly displayed in line object --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/theme/eldy/global.inc.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8df70054d11..9dad6b49279 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7571,7 +7571,7 @@ abstract class CommonObject if ($display_type == 'card') { $out .= '
'; - print ''; + print ''; } // Revenue stamp From ed5b8df385082b5a8d2e6eb32c1c079ff7dfea9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jun 2022 19:34:16 +0200 Subject: [PATCH 159/177] FIX Bank account not set when creating invoice from order --- htdocs/compta/facture/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5ef3079ae03..049ea5c3f88 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2843,7 +2843,8 @@ if ($action == 'create') { } $currency_code = $conf->currency; - + $fk_account = 0; + // Load objectsrc $remise_absolue = 0; if (!empty($origin) && !empty($originid)) { @@ -3580,7 +3581,7 @@ if ($action == 'create') { if (!empty($conf->banque->enabled)) { print ''; } From f53060fec38aea4fc6888b11b8d437fecc0bdb54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jun 2022 19:43:41 +0200 Subject: [PATCH 160/177] FIX selection of type of invoice --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a4ad571867d..f807871c508 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3158,7 +3158,7 @@ if ($action == 'create') { // Standard invoice print '
'; - $tmp = ' '; + $tmp = ' '; $tmp = $tmp.''; $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); print '
'.$langs->trans("PriceBase").''.$langs->trans("DefaultTaxRate").''.$langs->trans("HT").''.$langs->trans("TTC").'' . $langs->trans("INCVATONLY") . ''.$langs->trans("INCT").''.$langs->trans("TTC").''.$langs->trans("MinPrice").' '.$langs->trans("HT").''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''.$langs->trans("ChangedBy").''.price($object->price)."'.price($object->price_ttc)."' . price($object->price_ttc) . "'.price($resultarray[2]).''.price($object->price_ttc)."'.price($object->price_min).''.price($object->price_min_ttc).''; From 2256f8811dffc6d0046e8968dae105b9efe332db Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 6 May 2022 11:24:53 +0200 Subject: [PATCH 125/177] FIX : in salary stats and payment list, we must check right perms as well as salary list --- htdocs/salaries/class/salariesstats.class.php | 20 +++++++++---------- htdocs/salaries/payments.php | 2 +- htdocs/salaries/stats/index.php | 6 +++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/salaries/class/salariesstats.class.php b/htdocs/salaries/class/salariesstats.class.php index b3e6c20a0ca..41898bb7341 100644 --- a/htdocs/salaries/class/salariesstats.class.php +++ b/htdocs/salaries/class/salariesstats.class.php @@ -23,7 +23,7 @@ * \brief Fichier de la classe de gestion des stats des salaires */ include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php'; -include_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; +include_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; /** * Classe permettant la gestion des stats des salaires @@ -58,7 +58,7 @@ class SalariesStats extends Stats $this->socid = $socid; $this->userid = $userid; - $object = new PaymentSalary($this->db); + $object = new Salary($this->db); $this->from = MAIN_DB_PREFIX.$object->table_element; $this->field = 'amount'; @@ -81,7 +81,7 @@ class SalariesStats extends Stats */ public function getNbByYear() { - $sql = "SELECT YEAR(datep) as dm, count(*)"; + $sql = "SELECT YEAR(dateep) as dm, count(*)"; $sql .= " FROM ".$this->from; $sql .= " WHERE ".$this->where; $sql .= " GROUP BY dm DESC"; @@ -99,9 +99,9 @@ class SalariesStats extends Stats */ public function getNbByMonth($year, $format = 0) { - $sql = "SELECT MONTH(datep) as dm, count(*)"; + $sql = "SELECT MONTH(dateep) as dm, count(*)"; $sql .= " FROM ".$this->from; - $sql .= " WHERE YEAR(datep) = ".((int) $year); + $sql .= " WHERE YEAR(dateep) = ".((int) $year); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -121,9 +121,9 @@ class SalariesStats extends Stats */ public function getAmountByMonth($year, $format = 0) { - $sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")"; + $sql = "SELECT date_format(dateep,'%m') as dm, sum(".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= " WHERE date_format(datep,'%Y') = '".$this->db->escape($year)."'"; + $sql .= " WHERE date_format(dateep,'%Y') = '".$this->db->escape($year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -141,9 +141,9 @@ class SalariesStats extends Stats */ public function getAverageByMonth($year) { - $sql = "SELECT date_format(datep,'%m') as dm, avg(".$this->field.")"; + $sql = "SELECT date_format(dateep,'%m') as dm, avg(".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= " WHERE date_format(datep,'%Y') = '".$this->db->escape($year)."'"; + $sql .= " WHERE date_format(dateep,'%Y') = '".$this->db->escape($year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -158,7 +158,7 @@ class SalariesStats extends Stats */ public function getAllByYear() { - $sql = "SELECT date_format(datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; + $sql = "SELECT date_format(dateep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql .= " FROM ".$this->from; $sql .= " WHERE ".$this->where; $sql .= " GROUP BY year"; diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index f129e6304ab..964c2521f3c 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -234,7 +234,7 @@ $sql .= " ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = sal.fk_user"; $sql .= " AND s.entity IN (".getEntity('payment_salaries').")"; if (empty($user->rights->salaries->readall)) { - $sql .= " AND s.fk_user IN (".$db->sanitize(join(',', $childids)).")"; + $sql .= " AND sal.fk_user IN (".$db->sanitize(join(',', $childids)).")"; } // Search criteria diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index ecc62c2a237..bfacd908c12 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -74,6 +74,10 @@ dol_mkdir($dir); $useridtofilter = $userid; // Filter from parameters +if (empty($user->rights->salaries->readall) && empty($useridtofilter)) { + $useridtofilter = $user->getAllChildIds(1); +} + $stats = new SalariesStats($db, $socid, $useridtofilter); @@ -204,7 +208,7 @@ print '
'.$langs->tra // User print '
'.$langs->trans("Employee").''; print img_picto('', 'user', 'class="pictofixedwidth"'); -print $form->select_dolusers(($userid ? $userid : -1), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); +print $form->select_dolusers(($userid ? $userid : -1), 'userid', 1, '', 0, empty($user->rights->salaries->readall) ? 'hierarchyme' : '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); print '
'.$langs->trans("Year").''; From 203c4e808282cdd11f0813f14cce0c5c29fe91a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 May 2022 11:48:15 +0200 Subject: [PATCH 126/177] Fix bad test --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 226ace2df9d..565240743d7 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1611,7 +1611,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul } // Line for default price - if ($object->price_base_type == 'HT') { + if ($objp->price_base_type == 'HT') { $pu = $objp->price; } else { $pu = $objp->price_ttc; From 0426be5059f4bc6729486c273f2dd8f7d2abe7bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 May 2022 12:37:18 +0200 Subject: [PATCH 127/177] FIX Update of sale price (log not correctly updated) Conflicts: htdocs/product/class/product.class.php htdocs/product/price.php --- htdocs/product/class/product.class.php | 2 +- htdocs/product/price.php | 60 ++++++++++++++++++++------ 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f77cd00ac8f..b6e512d25c2 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2020,7 +2020,7 @@ class Product extends CommonObject /** - * Modify customer price of a product/Service + * Modify customer price of a product/Service for a given level * * @param double $newprice New price * @param string $newpricebase HT or TTC diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 565240743d7..458f2ce7a02 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -172,13 +172,50 @@ if (empty($reshook)) { } if (!$error) { - //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2); - $localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them. - $ret = $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode); + if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { + // Force the update of the price of the product using the new VAT + if ($object->multiprices_base_type[$i] == 'HT') { + $oldprice = $object->multiprices[$i]; + $oldminprice = $object->multiprices_min[$i]; + } else { + $oldprice = $object->multiprices_ttc[$i]; + $oldminprice = $object->multiprices_min_ttc[$i]; + } + $oldpricebasetype = $object->multiprices_base_type[$i]; + $oldnpr = $object->multiprices_recuperableonly[$i]; - if ($ret < 0) { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); + //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2); + $localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them. + $level = $i; + $ret = $object->updatePrice($oldprice, $oldpricebasetype, $user, $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode); + + if ($ret < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } else { + // Force the update of the price of the product using the new VAT + if ($object->price_base_type == 'HT') { + $oldprice = $object->price; + $oldminprice = $object->price_min; + } else { + $oldprice = $object->price_ttc; + $oldminprice = $object->price_min_ttc; + } + $oldpricebasetype = $object->price_base_type; + $oldnpr = $object->tva_npr; + + //$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2); + $localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them. + $level = 0; + $ret = $object->updatePrice($oldprice, $oldpricebasetype, $user, $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode); + + if ($ret < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } } @@ -1965,11 +2002,9 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''.$langs->trans("PriceBase").''.$langs->trans("DefaultTaxRate").''.$langs->trans("HT").''.$langs->trans("TTC").'' . $langs->trans("INCVATONLY") . ''.$langs->trans("INCT").''.$langs->trans("TTC").''.$langs->trans("MinPrice").' '.$langs->trans("HT").''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''.price($line->price)."'.price($line->price_ttc)."' . price($line->price_ttc) . "'.price($resultarray[2]).''.price($line->price_ttc)."'.price($line->price_min).''.price($line->price)."'.price($line->price_ttc)."' . price($line->price_ttc) . "'.price($resultarray[2]).''.price($line->price_ttc)."'.price($line->price_min).'
'.$langs->trans("FinancialAccount").''; - $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2); + $form->select_comptes(GETPOST('accountid'), 'accountid', 0, '', 2, '', 0, 'minwidth200'); print "
'.$langs->trans("PaymentMode").''; - $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2); + $form->select_types_paiements(GETPOST('operation'), 'operation', '', 2, 1, 0, 0, 1, 'minwidth200'); print "
'; } elseif ($display_type == 'line') { - $out .= '
'; + $out .= '
'; } switch ($mode) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 9eb479d93ad..61b60a00644 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7104,6 +7104,11 @@ if (!empty($conf->global->THEME_CUSTOM_CSS)) { ?> + div.extra_inline_chkbxlst, + div.extra_inline_checkbox { + min-width:150px; + } + /* Must be at end */ div.flot-text .flot-tick-label .tickLabel { color: unset; From f1914ff66f248ac20bee36eb96bd891a15427f14 Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 25 May 2022 18:02:18 +0200 Subject: [PATCH 156/177] FIX: Show sellist type of extrafield when none category selected --- htdocs/core/class/extrafields.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 7a449f3e7ea..6e4f6892e05 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1766,15 +1766,18 @@ class ExtraFields } } } else { - require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - $toprint = array(); $obj = $this->db->fetch_object($resql); - $c = new Categorie($this->db); - $c->fetch($obj->rowid); - $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text - foreach ($ways as $way) { - $toprint[] = '
  • color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.img_object('', 'category').' '.$way.'
  • '; + if ($obj->rowid) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $c = new Categorie($this->db); + $result = $c->fetch($obj->rowid); + if ($result > 0) { + $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text + foreach ($ways as $way) { + $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . img_object('', 'category') . ' ' . $way . '
  • '; + } + } } $value = '
      '.implode(' ', $toprint).'
    '; } From 4696cd33d5afd45cdb137280345996e7cbc449a4 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 1 Jun 2022 10:42:29 +0200 Subject: [PATCH 157/177] fix for issue #16985 --- htdocs/supplier_proposal/contact.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index ce76b9d8bf7..56bc73903e4 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -58,7 +58,8 @@ if ($action == 'addcontact' && $permissiontoedit) if ($result > 0 && $id > 0) { $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); + $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); + $result = $object->add_contact($contactid, $typeid, GETPOST("source")); } if ($result >= 0) From 1dcd4d0ab6f6c47cd4b4c89cf30150fc81ac2276 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 1 Jun 2022 23:11:20 +0200 Subject: [PATCH 158/177] Typo in CSS class --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0cfa5a93309..10a6c0ce32b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4612,7 +4612,7 @@ if ($action == 'create') { } if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2 print '
    '.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'
    '.price($sign * $object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'
    '.$langs->trans('BankAccount').''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print $form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print '
    '; From 309eccc426bab636b5c00b69b2abeb0b16dfbf47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jun 2022 14:08:04 +0200 Subject: [PATCH 161/177] Fix phpcs --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f807871c508..6f9d7398324 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2844,7 +2844,7 @@ if ($action == 'create') { $currency_code = $conf->currency; $fk_account = 0; - + // Load objectsrc $remise_absolue = 0; if (!empty($origin) && !empty($originid)) { From b6724f60616413527aaf274c369c3aea3f898ac7 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 7 Jun 2022 16:43:49 +0200 Subject: [PATCH 162/177] FIX #20696 --- htdocs/accountancy/bookkeeping/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f9ec739e63d..0eaeed73d9e 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -533,23 +533,23 @@ if ($action == 'create') { print ''; print ''; print ''; print ''; - // Date document creation + // Date document export print ''; print ''; print ''; print ''; - // Date document creation + // Date document validation print ''; print ''; print ''; print ''; From f872585ea26cba4d86dcc11dd2798798e3ba1d87 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 8 Jun 2022 01:02:02 +0200 Subject: [PATCH 163/177] Fix #21150 - Regression Can't insert manual lines Fix #21150 - Regression Can not insert manual lines for automatically created transactions to the general ledger, this was possible before. --- .../accountancy/class/bookkeeping.class.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5f3def1d3ee..dc4c4992bc0 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1722,6 +1722,38 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { + // Add an empty line when transaction is validated to permit to add new line manually + if ($mode != "_tmp") { + $line = new BookKeepingLine(); + + $line->id = $obj->rowid; + + $line->doc_date = $this->db->jdate($obj->doc_date); + $line->doc_type = $obj->doc_type; + $line->doc_ref = $obj->doc_ref; + $line->fk_doc = $obj->fk_doc; + $line->fk_docdet = $obj->fk_docdet; + $line->thirdparty_code = $obj->thirdparty_code; + $line->subledger_account = $obj->subledger_account; + $line->subledger_label = $obj->subledger_label; + $line->numero_compte = $obj->numero_compte; + $line->label_compte = $obj->label_compte; + $line->label_operation = $obj->label_operation; + $line->debit = $obj->debit; + $line->credit = $obj->credit; + $line->montant = $obj->amount; + $line->amount = $obj->amount; + $line->sens = $obj->sens; + $line->code_journal = $obj->code_journal; + $line->journal_label = $obj->journal_label; + $line->piece_num = $obj->piece_num; + $line->date_creation = $obj->date_creation; + $line->date_modification = $obj->date_modification; + $line->date_export = $obj->date_export; + $line->date_validation = $obj->date_validation; + + $this->linesmvt[] = $line; + } while ($obj = $this->db->fetch_object($result)) { $line = new BookKeepingLine(); From 0641b661183654eaf57e498df590a1410581c125 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 8 Jun 2022 01:39:53 +0200 Subject: [PATCH 164/177] Clean code --- .../accountancy/class/bookkeeping.class.php | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index dc4c4992bc0..000ac06f3c6 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1725,33 +1725,6 @@ class BookKeeping extends CommonObject // Add an empty line when transaction is validated to permit to add new line manually if ($mode != "_tmp") { $line = new BookKeepingLine(); - - $line->id = $obj->rowid; - - $line->doc_date = $this->db->jdate($obj->doc_date); - $line->doc_type = $obj->doc_type; - $line->doc_ref = $obj->doc_ref; - $line->fk_doc = $obj->fk_doc; - $line->fk_docdet = $obj->fk_docdet; - $line->thirdparty_code = $obj->thirdparty_code; - $line->subledger_account = $obj->subledger_account; - $line->subledger_label = $obj->subledger_label; - $line->numero_compte = $obj->numero_compte; - $line->label_compte = $obj->label_compte; - $line->label_operation = $obj->label_operation; - $line->debit = $obj->debit; - $line->credit = $obj->credit; - $line->montant = $obj->amount; - $line->amount = $obj->amount; - $line->sens = $obj->sens; - $line->code_journal = $obj->code_journal; - $line->journal_label = $obj->journal_label; - $line->piece_num = $obj->piece_num; - $line->date_creation = $obj->date_creation; - $line->date_modification = $obj->date_modification; - $line->date_export = $obj->date_export; - $line->date_validation = $obj->date_validation; - $this->linesmvt[] = $line; } while ($obj = $this->db->fetch_object($result)) { From f0a8765ee6d62fe94d0e2830561174b5726c2a83 Mon Sep 17 00:00:00 2001 From: Faustin Date: Wed, 8 Jun 2022 16:05:44 +0200 Subject: [PATCH 165/177] FIX #20696 --- htdocs/accountancy/bookkeeping/card.php | 6 +++--- htdocs/accountancy/class/bookkeeping.class.php | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 0eaeed73d9e..148608116e7 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -533,7 +533,7 @@ if ($action == 'create') { print ''; print ''; print ''; print ''; @@ -541,7 +541,7 @@ if ($action == 'create') { print ''; print ''; print ''; print ''; @@ -549,7 +549,7 @@ if ($action == 'create') { print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5f3def1d3ee..5d2a9d63f9a 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1649,11 +1649,10 @@ class BookKeeping extends CommonObject $this->doc_date = $this->db->jdate($obj->doc_date); $this->doc_ref = $obj->doc_ref; $this->doc_type = $obj->doc_type; - $this->date_creation = $obj->date_creation; - $this->date_modification = $obj->date_modification; - $this->date_export = $obj->date_export; - $this->date_validation = $obj->date_validated; - $this->date_validation = $obj->date_validation; + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_modification = $this->db->jdate($obj->date_modification); + $this->date_export = $this->db->jdate($obj->date_export); + $this->date_validation = $this->db->jdate($obj->date_validation); } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(__METHOD__.$this->error, LOG_ERR); From 7a20b3dceccdc5476b4b4ffec00ee60067b49575 Mon Sep 17 00:00:00 2001 From: bagtaib Date: Wed, 8 Jun 2022 15:35:07 +0200 Subject: [PATCH 166/177] FIX #21140 Conflicts: htdocs/societe/class/societe.class.php --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3d1637019e9..7c5773363c4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -890,7 +890,7 @@ class Societe extends CommonObject $sql .= ", accountancy_code_buy"; $sql .= ", accountancy_code_sell"; } - $sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".$this->db->escape($this->entity).", '".$this->db->idate($now)."'"; + $sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".((int) $this->entity).", '".$this->db->idate($now)."'"; $sql .= ", ".(!empty($user->id) ? ((int) $user->id) : "null"); $sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null"); $sql .= ", ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null"); From e10d89dd369b901662f91e3cf9ef011b45a2354d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Jun 2022 03:00:51 +0200 Subject: [PATCH 167/177] Fix regression --- htdocs/accountancy/class/bookkeeping.class.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 000ac06f3c6..5f3def1d3ee 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1722,11 +1722,6 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - // Add an empty line when transaction is validated to permit to add new line manually - if ($mode != "_tmp") { - $line = new BookKeepingLine(); - $this->linesmvt[] = $line; - } while ($obj = $this->db->fetch_object($result)) { $line = new BookKeepingLine(); From 900c71b5d6a5e32696a89981672bcb82ae7be3fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Jun 2022 03:07:11 +0200 Subject: [PATCH 168/177] Fix can add an empty line in tmp edit mode of transation --- htdocs/accountancy/bookkeeping/card.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f9ec739e63d..b05fe8588bc 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -643,11 +643,9 @@ if ($action == 'create') { print "\n"; - // Empty line is the first line of $object->linesmvt - // So we must get the first line (the empty one) and pu it at the end of the array - // in order to display it correctly to the user - $empty_line = array_shift($object->linesmvt); - $object->linesmvt[]= $empty_line; + // Add an empty line + $line = new BookKeepingLine(); + $object->linesmvt[] = $line; foreach ($object->linesmvt as $line) { print ''; From a4ca81d4ceb2e4c1ea3360ae8e327f84eb9a597c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Jun 2022 12:46:13 +0200 Subject: [PATCH 169/177] FIX #21174 --- htdocs/accountancy/bookkeeping/card.php | 12 +++++++++--- htdocs/accountancy/class/bookkeeping.class.php | 4 ++++ htdocs/core/lib/functions.lib.php | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index b05fe8588bc..ad30e232334 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -604,6 +604,7 @@ if ($action == 'create') { print '
    '; $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -643,9 +644,14 @@ if ($action == 'create') { print "
    \n"; - // Add an empty line - $line = new BookKeepingLine(); - $object->linesmvt[] = $line; + // Add an empty line if there is not yet + if (!empty($object->linesmvt[0])) { + $tmpline = $object->linesmvt[0]; + if (!empty($tmpline->numero_compte)) { + $line = new BookKeepingLine(); + $object->linesmvt[] = $line; + } + } foreach ($object->linesmvt as $line) { print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5f3def1d3ee..32bc27565fc 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -597,9 +597,13 @@ class BookKeeping extends CommonObject if (empty($this->credit)) { $this->credit = 0; } + if (empty($this->montant)) { + $this->montant = 0; + } $this->debit = price2num($this->debit, 'MT'); $this->credit = price2num($this->credit, 'MT'); + $this->montant = price2num($this->montant, 'MT'); $now = dol_now(); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 19fa4cd5c63..2f9cb532708 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -290,7 +290,7 @@ function dol_shutdown() $depth = $db->transaction_opened; $disconnectdone = $db->close(); } - dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ?LOG_WARNING:LOG_INFO)); + dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO)); } /** From 793e95d88c96c85df10d2a432136df55740e4943 Mon Sep 17 00:00:00 2001 From: NASDAMI Quatadah Date: Thu, 9 Jun 2022 14:04:32 +0200 Subject: [PATCH 170/177] fixing bug (colspan should be int) --- htdocs/core/class/commonobject.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9dad6b49279..4d09b8ae769 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7410,7 +7410,7 @@ abstract class CommonObject $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); } - $colspan = ''; + $colspan = 0; if (is_array($params) && count($params) > 0 && $display_type=='card') { if (array_key_exists('cols', $params)) { $colspan = $params['cols']; @@ -7423,6 +7423,7 @@ abstract class CommonObject } } } + $colspan = intval($colspan); switch ($mode) { case "view": @@ -7468,7 +7469,7 @@ abstract class CommonObject } } - $out .= $extrafields->showSeparator($key, $this, ($colspan + 1), $display_type); + $out .= $extrafields->showSeparator($key, $this, ($colspan ? $colspan + 1 : 2), $display_type); } else { $class = (!empty($extrafields->attributes[$this->table_element]['hidden'][$key]) ? 'hideobject ' : ''); $csstyle = ''; @@ -7489,7 +7490,7 @@ abstract class CommonObject $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); if ($display_type=='card') { if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { - $colspan = '0'; + $colspan = 0; } if ($action == 'selectlines') { From 82d1cb468229597944beecc44a2d3c5b323915b5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 9 Jun 2022 17:30:16 +0200 Subject: [PATCH 171/177] FIX #20527 Accountancy Unbalanced entry proposed when an employee are declared on social contribution --- htdocs/accountancy/journal/bankjournal.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index bdda4583d54..19a9ca63c07 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -288,8 +288,16 @@ if ($result) { // get_url may return -1 which is not traversable if (is_array($links) && count($links) > 0) { + $is_sc = false; + foreach ($links as $v) { + if ($v['type'] == 'sc') { + $is_sc = true; + break; + } + } // Now loop on each link of record in bank (code similar to bankentries_list.php) foreach ($links as $key => $val) { + if ($links[$key]['type'] == 'user' && !$is_sc) continue; if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { // So we excluded 'company' and 'user' here. We want only payment lines From 5decd0014931649221ae3e8a4f3ea4034ce5ec9c Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Mon, 13 Jun 2022 10:40:41 +0000 Subject: [PATCH 172/177] fix: remove duplication bank transaction do not duplicate previous bank transaction when value is 0 --- htdocs/compta/paiement/list.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 20f69401fd6..8fcc4474909 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -441,9 +441,15 @@ while ($i < min($num, $limit)) { // Bank transaction if (!empty($arrayfields['transaction']['checked'])) { - $bankline->fetch($objp->fk_bank); - print ''; - if (!$i) $totalarray['nbfield']++; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Bank account From a2c2ca20740f4c93a4f02e19ecc833f4f47bc4a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Jun 2022 15:10:35 +0200 Subject: [PATCH 173/177] Fix phpcs --- htdocs/compta/paiement/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 4e36890c5da..59d5e701f8c 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -517,14 +517,14 @@ while ($i < min($num, $limit)) { // Bank transaction if (!empty($arrayfields['transaction']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; + print ''; + if (!$i) { + $totalarray['nbfield']++; } } From df009a6365a443356be8b819a3421a08a4f26b83 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 16 Jun 2022 15:13:56 +0200 Subject: [PATCH 174/177] FIX: trash icon on crontask list to do not work --- htdocs/cron/list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 686bb8a52a9..152b947430c 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -353,6 +353,10 @@ if ($action == 'execute') { print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1); } +if ($action == 'delete') { + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1); +} + // List of mass actions available $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), From 3fcaae5ae35227d9e4dc400484c9e0149a94cce2 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 16 Jun 2022 15:31:07 +0200 Subject: [PATCH 175/177] fix private notes not being registered on credit/replacement invoices --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6f9d7398324..81112e3c22e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -996,7 +996,7 @@ if (empty($reshook)) { $object->date = $dateinvoice; $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'restricthtml')); - // We do not copy the private note + $object->note_private = trim(GETPOST('note_private', 'restricthtml')); $object->ref_client = GETPOST('ref_client', 'alphanohtml'); $object->model_pdf = GETPOST('model', 'alphanohtml'); $object->fk_project = GETPOST('projectid', 'int'); @@ -1049,7 +1049,7 @@ if (empty($reshook)) { $object->date = $dateinvoice; $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'restricthtml')); - // We do not copy the private note + $object->note_private = trim(GETPOST('note_private', 'restricthtml')); $object->ref_client = GETPOST('ref_client'); $object->model_pdf = GETPOST('model'); $object->fk_project = GETPOST('projectid', 'int'); From 54a5967a711a2b641dd690dc05a2d00cabc442f4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 17 Jun 2022 04:37:56 +0200 Subject: [PATCH 176/177] FIX Accountancy - Partitioning of the entity on an automatic binding --- htdocs/accountancy/customer/index.php | 3 ++- htdocs/accountancy/supplier/index.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index c233134f562..af8aedd758c 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * @@ -158,6 +158,7 @@ if ($action == 'validatehistory') { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; + $sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; } diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 9ea8fd0a307..037f2cfbb38 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -166,6 +166,7 @@ if ($action == 'validatehistory') { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; + $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; } From a49062338f51b0c03f437ecedaa6888ec440fe71 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 17 Jun 2022 04:41:15 +0200 Subject: [PATCH 177/177] Copyright --- htdocs/accountancy/customer/index.php | 10 +++++----- htdocs/accountancy/supplier/index.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index af8aedd758c..33d94a34636 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -1,9 +1,9 @@ - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2022 Alexandre Spangaro - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry +/* Copyright (C) 2013 Olivier Geffroy + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2013-2022 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry * * 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 diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 037f2cfbb38..48462c38365 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -1,8 +1,8 @@ - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2022 Alexandre Spangaro - * Copyright (C) 2014 Juanjo Menent +/* Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2013-2022 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent * * 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
    '.$langs->trans("DateCreation").''; - print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; + print $object->date_creation ? dol_print_date($db->jdate($object->date_creation), 'day') : ' '; print '
    '.$langs->trans("DateExport").''; - print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; + print $object->date_export ? dol_print_date($db->jdate($object->date_export), 'dayhour') : ' '; print '
    '.$langs->trans("DateValidation").''; - print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print $object->date_validation ? dol_print_date($db->jdate($object->date_validation), 'dayhour') : ' '; print '
    '.$langs->trans("DateCreation").''; - print $object->date_creation ? dol_print_date($db->jdate($object->date_creation), 'day') : ' '; + print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; print '
    '.$langs->trans("DateExport").''; - print $object->date_export ? dol_print_date($db->jdate($object->date_export), 'dayhour') : ' '; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; print '
    '.$langs->trans("DateValidation").''; - print $object->date_validation ? dol_print_date($db->jdate($object->date_validation), 'dayhour') : ' '; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; print '
    '.$bankline->getNomUrl(1, 0).''; + if ($objp->fk_bank) { + $bankline->fetch($objp->fk_bank); + print $bankline->getNomUrl(1, 0); + } + print ''; - if ($objp->fk_bank > 0) { - $bankline->fetch($objp->fk_bank); - print $bankline->getNomUrl(1, 0); - } - print ''; + if ($objp->fk_bank > 0) { + $bankline->fetch($objp->fk_bank); + print $bankline->getNomUrl(1, 0); + } + print '