From f783dd56a4c3f73e85d1db40c9ef9e0c40225308 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 15:54:23 +0200 Subject: [PATCH 01/20] fix: scrutinizer --- htdocs/accountancy/customer/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 7c3cc2cf0e2..aa1abde5fa5 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -214,7 +214,7 @@ if ($action == 'validatehistory') { $facture_static->ref = $objp->ref; $facture_static->id = $objp->facid; $facture_static->type = $objp->ftype; - $facture_static->datef = $objp->datef; + $facture_static->date = $objp->datef; $facture_static_det->id = $objp->rowid; $facture_static_det->total_ht = $objp->total_ht; From 0589c9c3caefc581227028950bdfd15fbb391d00 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 15:55:11 +0200 Subject: [PATCH 02/20] fix: scrutinizer --- htdocs/accountancy/customer/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 9a942bc3eaa..97a885f97b9 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -559,7 +559,7 @@ if ($result) { $facture_static->ref = $objp->ref; $facture_static->id = $objp->facid; $facture_static->type = $objp->ftype; - $facture_static->datef = $objp->datef; + $facture_static->date = $objp->datef; $facture_static_det->id = $objp->rowid; $facture_static_det->total_ht = $objp->total_ht; From 2e260d75d92a40f0c0baea4913ee2a66e371d3a7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 15:57:54 +0200 Subject: [PATCH 03/20] fix: scrutinizer --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 8ebb9f43b1e..7ccd80eb4bd 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -770,7 +770,7 @@ if ($type == Categorie::TYPE_CONTACT) { print ''."\n"; print ''."\n"; - if (count($contacts) > 0) { + if (is_array($contacts) && count($contacts) > 0) { $i = 0; foreach ($contacts as $key => $contact) { $i++; From 258d0c3a6906ab59670a7edf7aaed0222d838b2e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 16:05:37 +0200 Subject: [PATCH 04/20] fix: scrutinizer --- htdocs/commande/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index decabedc2e8..6cb9441b31b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1494,13 +1494,13 @@ if ($action == 'create' && $usercancreate) { $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); // TODO maybe add default value option $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); - $availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0)); + $availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : 0); $shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0)); $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); $demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0)); $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0)); $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); - $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; + $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ? -1 : ''; $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); if (empty($date_delivery)) { @@ -1526,7 +1526,7 @@ if ($action == 'create' && $usercancreate) { $cond_reglement_id = $soc->cond_reglement_id; $mode_reglement_id = $soc->mode_reglement_id; $fk_account = $soc->fk_account; - $availability_id = $soc->availability_id; + $availability_id = 0; $shipping_method_id = $soc->shipping_method_id; $warehouse_id = $soc->warehouse_id; $demand_reason_id = $soc->demand_reason_id; From 10a518749d42380b1e6eb2b193b3728fc45bb6ba Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 16:46:04 +0200 Subject: [PATCH 05/20] fix: scrutinizer --- htdocs/compta/facture/class/facture-rec.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 92615658a58..4888656b9c7 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -303,8 +303,8 @@ class FactureRec extends CommonInvoice $sql .= ", ".((int) $facsrc->socid); $sql .= ", ".((int) $conf->entity); $sql .= ", '".$this->db->idate($now)."'"; - $sql .= ", ".(!empty($facsrc->amount) ? ((float) $facsrc->amount) : '0'); - $sql .= ", ".(!empty($facsrc->remise) ? ((float) $this->remise) : '0'); + $sql .= ", ".(!empty($facsrc->total_ttc) ? ((float) $facsrc->total_ttc) : '0'); + $sql .= ", ".(!empty($facsrc->remise_absolue) ? ((float) $this->remise_absolue) : '0'); $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"); From e9fe668725229fe25e075562509cf8eedba87f66 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 16:48:04 +0200 Subject: [PATCH 06/20] fix: scrutinizer --- htdocs/core/class/commonobjectline.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 40bcf3aa529..2856b535a3e 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -51,6 +51,11 @@ abstract class CommonObjectLine extends CommonObject */ public $fk_unit; + public $date_debut_prevue; + public $date_debut_reel; + public $date_fin_prevue; + public $date_fin_reel; + /** * Constructor From 4795190a75739a79c28c0fb75d4c3cdd8fdab10d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 17:09:48 +0200 Subject: [PATCH 07/20] fix: scrutinizer --- htdocs/core/class/commonobject.class.php | 6 +++--- htdocs/core/class/extrafields.class.php | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 37083cdf5f8..abb9f05baa8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6488,7 +6488,7 @@ abstract class CommonObject $out = ''; $type = ''; - $isDependList=0; + $isDependList = 0; $param = array(); $param['options'] = array(); $reg = array(); @@ -6796,7 +6796,7 @@ abstract class CommonObject if (!empty($InfoFieldList[3]) && $parentField) { $parent = $parentName.':'.$obj->{$parentField}; - $isDependList=1; + $isDependList = 1; } $out .= '
'.$langs->trans("Ref").'
'; - } - - if (!empty($object->lines)) { - $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1); - } - - // Form to add new line - if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { - if ($action != 'editline') { - // Add products/services form - - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) - $object->formAddObjectLine(1, $mysoc, $soc); - } - } - - if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { - print '
'; - } - print ''; - - print "\n"; - } - - // Buttons for actions if ($action != 'presend' && $action != 'editline') { From b1be1ceff1660b686f73edc15e8783d95ca4b0aa Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 18:07:02 +0200 Subject: [PATCH 12/20] fix scrutinizer --- .../lib/eventorganization_conferenceorbooth.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php index 3951cc25df7..c26a0f8611c 100644 --- a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php +++ b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php @@ -127,6 +127,7 @@ function conferenceorboothProjectPrepareHead($object) $head[$h][2] = 'conferenceorbooth'; // Enable caching of conf or booth count attendees $nbAttendees = 0; + $nbConferenceOrBooth= 0; require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_conferenceorbooth_project_'.$object->id; $dataretrieved = dol_getcache($cachekey); From 85ec2c408c55f95b88eea408fb9bca5286642355 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 18:15:15 +0200 Subject: [PATCH 13/20] fix scrutinizer --- htdocs/core/class/html.formmail.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 823e90fcac3..a375a7223a3 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -157,6 +157,8 @@ class FormMail extends Form public $lines_model; + public $withoptiononeemailperrecipient; + /** * Constructor From d4690ddbdd3d45c0620de163faac990a7f1c8c91 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 18:20:07 +0200 Subject: [PATCH 14/20] fix scrutinizer --- htdocs/product/class/productcustomerprice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 61cba58c374..d3c23b17c4a 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -871,7 +871,7 @@ class Productcustomerprice extends CommonObject $resultupd = $prodsocpricenew->create($user, 0, $forceupdateaffiliate); if ($result < 0) { $error++; - $this->error = $prodsocpriceupd->error; + $this->error = $prodsocpricenew->error; } } } From 24cc74cd3abff12d84de22e810fbe4370e7cdc06 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 19:00:48 +0200 Subject: [PATCH 15/20] fix scrutinizer --- htdocs/projet/class/project.class.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 368fb3c2982..5d56f6a295d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1601,17 +1601,18 @@ class Project extends CommonObject foreach (array('internal', 'external') as $source) { $tab = $origin_project->liste_contact(-1, $source); - - foreach ($tab as $contacttoadd) { - $clone_project->add_contact($contacttoadd['id'], $contacttoadd['code'], $contacttoadd['source'], $notrigger); - if ($clone_project->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $langs->load("errors"); - $this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); - $error++; - } else { - if ($clone_project->error != '') { - $this->error .= $clone_project->error; + if (is_array($tab) && count($tab)>0) { + foreach ($tab as $contacttoadd) { + $clone_project->add_contact($contacttoadd['id'], $contacttoadd['code'], $contacttoadd['source'], $notrigger); + if ($clone_project->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $langs->load("errors"); + $this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); $error++; + } else { + if ($clone_project->error != '') { + $this->error .= $clone_project->error; + $error++; + } } } } @@ -1660,7 +1661,7 @@ class Project extends CommonObject foreach ($tasksarray as $tasktoclone) { $result_clone = $taskstatic->createFromClone($user, $tasktoclone->id, $clone_project_id, $tasktoclone->fk_parent, $move_date, true, false, $clone_task_file, true, false); if ($result_clone <= 0) { - $this->error .= $result_clone->error; + $this->error .= $taskstatic->error; $error++; } else { $new_task_id = $result_clone; @@ -1714,6 +1715,7 @@ class Project extends CommonObject global $user, $langs, $conf; $error = 0; + $result = 0; $taskstatic = new Task($this->db); From ac27532d62448c55b9a149ced2bad37cdc9499e5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 19:06:40 +0200 Subject: [PATCH 16/20] fix scrutinzer --- htdocs/projet/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 1af3488bf5c..ce9674dfd0a 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -94,7 +94,7 @@ if ($action == 'addcontact') { foreach ($task_array as $task) { $task_already_affected=false; $personsLinked = $task->liste_contact(-1, $source); - if (!is_array($personsLinked) && coun($personsLinked) < 0) { + if (!is_array($personsLinked) && count($personsLinked) < 0) { setEventMessage($object->error, 'errors'); } else { foreach ($personsLinked as $person) { From 3bdec20364ceeaf41bb295787ee65dce38c5e184 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 19:09:13 +0200 Subject: [PATCH 17/20] fix scrutinzer --- htdocs/projet/tasks/task.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 2ae9bb7cc80..54e238ab0c7 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -403,8 +403,8 @@ if ($id > 0 || !empty($ref)) { // Third party print ''.$langs->trans("ThirdParty").''; - if ($projectstatic->societe->id) { - print $projectstatic->societe->getNomUrl(1); + if ($projectstatic->thirdparty->id) { + print $projectstatic->thirdparty->getNomUrl(1); } else { print ' '; } From 96722d55efa2395bff07d808f9b2eea05dca2083 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 19:13:05 +0200 Subject: [PATCH 18/20] fix scrutinzer --- htdocs/categories/class/categorie.class.php | 6 ++++-- htdocs/core/class/commonobject.class.php | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index d5c135279bf..e7c361322bc 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -728,8 +728,6 @@ class Categorie extends CommonObject } } - - // Call trigger $this->context = array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger $result = $this->call_trigger('CATEGORY_LINK', $user); @@ -755,6 +753,8 @@ class Categorie extends CommonObject } return -1; } + + return 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -810,6 +810,8 @@ class Categorie extends CommonObject $this->error = $this->db->lasterror(); return -1; } + + return 0; } /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index abb9f05baa8..9383759fb8e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9461,7 +9461,7 @@ abstract class CommonObject } $error = 0; - $ok=0; + $ok = 0; // Process foreach ($to_del as $del) { @@ -9473,7 +9473,7 @@ abstract class CommonObject $this->errors = $c->errors; break; } else { - $ok+=$result; + $ok += $result; } } } @@ -9486,7 +9486,7 @@ abstract class CommonObject $this->errors = $c->errors; break; } else { - $ok+=$result; + $ok += $result; } } } From df25880d5560dc8b27f437e4e9df18066d6640f2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 19:18:01 +0200 Subject: [PATCH 19/20] fix scrutinzer --- htdocs/societe/price.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index bf19fc0385b..a24b6a4776c 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -326,22 +326,14 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $text = $langs->trans('SellingPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); print ''; - if ($object->price_base_type == 'TTC') { - print ''; - } else { - print ''; - } + print ''; print ''; // Price minimum print ''; $text = $langs->trans('MinPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); - if ($object->price_base_type == 'TTC') { - print ''; - } else { - print ''; - } + print ''; print ''; // Update all child soc From 7970f4ba5c0f1bbe94f8ce27fa155d4bcab67a2e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 22:24:35 +0200 Subject: [PATCH 20/20] fix scrutinzer --- htdocs/projet/class/project.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 5d56f6a295d..622098240c8 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1615,6 +1615,9 @@ class Project extends CommonObject } } } + } elseif ($tab < 0) { + $this->error .= $origin_project->error; + $error++; } } }