From 64a59b3a4b9ec48b5e0bbb294c046833baee48c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Jan 2023 11:56:43 +0100 Subject: [PATCH 01/12] fix warnings --- htdocs/core/modules/DolibarrModules.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index afc19a12e92..24fa4437a36 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -219,6 +219,19 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $descriptionlong; + /** + * dictionaries + * + * @var array + */ + public $dictionaries; + + /** + * tabs + * + * @var array + */ + public $tabs; // For exports From baeff3710cc26c30f7f2dd9ecb1032fab5e3f341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Jan 2023 12:09:16 +0100 Subject: [PATCH 02/12] Update DolibarrModules.class.php --- htdocs/core/modules/DolibarrModules.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 24fa4437a36..d6baed78c46 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2018 Josep Lluís Amador - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2022 Frédéric France * * 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 @@ -180,6 +180,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $error; + /** + * @var string[] Array of Errors messages + */ + public $errors; + /** * @var string Module version * @see http://semver.org @@ -220,16 +225,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public $descriptionlong; /** - * dictionaries - * - * @var array + * @var array dictionaries description */ public $dictionaries; /** - * tabs - * - * @var array + * @var array tabs description */ public $tabs; From 0935094385db55f242302918f0964c6b735b5a33 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 11 Jan 2023 18:22:46 +0100 Subject: [PATCH 03/12] kanban mode for list of loan --- htdocs/loan/class/loan.class.php | 35 ++++++++++++++++++ htdocs/loan/list.php | 62 +++++++++++++++++++++++--------- 2 files changed, 80 insertions(+), 17 deletions(-) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 1c6913035e8..6dd0f5fe92b 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -721,4 +721,39 @@ class Loan extends CommonObject return -1; } } + + /** + * Return clicable link of object (with eventually picto) + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).''; + if (property_exists($this, 'capital')) { + $return .= ' | '.$langs->trans("Amount").' : '.price($this->capital).''; + } + if (property_exists($this, 'datestart')) { + $return .= '
'.$langs->trans("DateStart").' : '.dol_print_date($this->db->jdate($this->datestart), 'day').''; + } + if (property_exists($this, 'dateend')) { + $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->db->jdate($this->dateend), 'day').''; + } + + if (method_exists($this, 'LibStatut')) { + $return .= '
'.$this->LibStatut($this->totalpaid, 5, $this->alreadypaid).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 1324876a98c..5acd2532bef 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -66,6 +66,8 @@ $search_amount = GETPOST('search_amount', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'alpha'); // mode view result + /* @@ -171,6 +173,9 @@ if ($resql) { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -194,7 +199,10 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $user->rights->loan->write); + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $user->rights->loan->write); print '
'."\n"; if ($optioncss != '') { @@ -206,6 +214,8 @@ if ($resql) { print ''; print ''; print ''; + print ''; + print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'money-bill-alt', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -256,31 +266,49 @@ if ($resql) { $loan_static->label = $obj->label; $loan_static->paid = $obj->paid; - print ''; - // Ref - print ''.$loan_static->getNomUrl(1).''; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + // Output Kanban + $loan_static->datestart= $obj->datestart; + $loan_static->dateend = $obj->dateend; + $loan_static->capital = $obj->capital; + $loan_static->totalpaid = $obj->paid; - // Label - print ''.dol_trunc($obj->label, 42).''; + print $loan_static->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; + } + } else { + print ''; - // Capital - print ''.price($obj->capital).''; + // Ref + print ''.$loan_static->getNomUrl(1).''; - // Date start - print ''.dol_print_date($db->jdate($obj->datestart), 'day').''; + // Label + print ''.dol_trunc($obj->label, 42).''; - // Date end - print ''.dol_print_date($db->jdate($obj->dateend), 'day').''; + // Capital + print ''.price($obj->capital).''; - print ''; - print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid); - print ''; + // Date start + print ''.dol_print_date($db->jdate($obj->datestart), 'day').''; - print ''; + // Date end + print ''.dol_print_date($db->jdate($obj->dateend), 'day').''; - print "\n"; + print ''; + print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid); + print ''; + print ''; + + print "\n"; + } $i++; } From c52fab09e608d7eede0ece3f314304db147234d8 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 13 Jan 2023 09:01:31 +0100 Subject: [PATCH 04/12] FIX re-open supplier order should not be allowed when there is a reception. --- htdocs/fourn/commande/card.php | 46 ++++++++++++++++++++-------------- htdocs/langs/en_US/orders.lang | 1 + 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 644469a257d..ffb2e834db7 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2440,6 +2440,19 @@ if ($action == 'create') { if (empty($reshook)) { $object->fetchObjectLinked(); // Links are used to show or not button, so we load them now. + // check if reception + $hasreception = 0; + if ($conf->reception->enabled) { + if (!empty($object->linkedObjects['reception'])) { + foreach ($object->linkedObjects['reception'] as $element) { + if ($element->statut >= 0) { + $hasreception = 1; + break; + } + } + } + } + // Validate if ($object->statut == 0 && $num > 0) { if ($usercanvalidate) { @@ -2515,17 +2528,21 @@ if ($action == 'create') { // Reopen if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED))) { $buttonshown = 0; - if (!$buttonshown && $usercanapprove) { - if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) - || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) { - print ''.$langs->trans("Disapprove").''; - $buttonshown++; + if ($hasreception) { + print ''.$langs->trans("Disapprove").''; + } else { + if (!$buttonshown && $usercanapprove) { + if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) + || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) { + print ''.$langs->trans("Disapprove").''; + $buttonshown++; + } } - } - if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) { - if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) - || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) { - print ''.$langs->trans("Disapprove").''; + if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) { + if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) + || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) { + print ''.$langs->trans("Disapprove").''; + } } } } @@ -2536,19 +2553,10 @@ if ($action == 'create') { } // Ship - $hasreception = 0; if (isModEnabled('stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { $labelofbutton = $langs->trans('ReceiveProducts'); if ($conf->reception->enabled) { $labelofbutton = $langs->trans("CreateReception"); - if (!empty($object->linkedObjects['reception'])) { - foreach ($object->linkedObjects['reception'] as $element) { - if ($element->statut >= 0) { - $hasreception = 1; - break; - } - } - } } if (in_array($object->statut, array(3, 4, 5))) { diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index f988cd62f19..0accaadfa62 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -204,3 +204,4 @@ StatusSupplierOrderApproved=Approved StatusSupplierOrderRefused=Refused StatusSupplierOrderReceivedPartially=Partially received StatusSupplierOrderReceivedAll=All products received +NeedAtLeastOneInvoice = There has to be at least one Invoice From d842d0394d28db95428f5057dfdd6755a624d23f Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 15 Jan 2023 12:51:21 +0100 Subject: [PATCH 05/12] Revert "FIX re-open supplier order should not be allowed when there is a reception." This reverts commit c52fab09e608d7eede0ece3f314304db147234d8. --- htdocs/fourn/commande/card.php | 46 ++++++++++++++-------------------- htdocs/langs/en_US/orders.lang | 1 - 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ffb2e834db7..644469a257d 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2440,19 +2440,6 @@ if ($action == 'create') { if (empty($reshook)) { $object->fetchObjectLinked(); // Links are used to show or not button, so we load them now. - // check if reception - $hasreception = 0; - if ($conf->reception->enabled) { - if (!empty($object->linkedObjects['reception'])) { - foreach ($object->linkedObjects['reception'] as $element) { - if ($element->statut >= 0) { - $hasreception = 1; - break; - } - } - } - } - // Validate if ($object->statut == 0 && $num > 0) { if ($usercanvalidate) { @@ -2528,21 +2515,17 @@ if ($action == 'create') { // Reopen if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED))) { $buttonshown = 0; - if ($hasreception) { - print ''.$langs->trans("Disapprove").''; - } else { - if (!$buttonshown && $usercanapprove) { - if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) - || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) { - print ''.$langs->trans("Disapprove").''; - $buttonshown++; - } + if (!$buttonshown && $usercanapprove) { + if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) + || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) { + print ''.$langs->trans("Disapprove").''; + $buttonshown++; } - if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) { - if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) - || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) { - print ''.$langs->trans("Disapprove").''; - } + } + if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) { + if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) + || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) { + print ''.$langs->trans("Disapprove").''; } } } @@ -2553,10 +2536,19 @@ if ($action == 'create') { } // Ship + $hasreception = 0; if (isModEnabled('stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { $labelofbutton = $langs->trans('ReceiveProducts'); if ($conf->reception->enabled) { $labelofbutton = $langs->trans("CreateReception"); + if (!empty($object->linkedObjects['reception'])) { + foreach ($object->linkedObjects['reception'] as $element) { + if ($element->statut >= 0) { + $hasreception = 1; + break; + } + } + } } if (in_array($object->statut, array(3, 4, 5))) { diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 0accaadfa62..f988cd62f19 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -204,4 +204,3 @@ StatusSupplierOrderApproved=Approved StatusSupplierOrderRefused=Refused StatusSupplierOrderReceivedPartially=Partially received StatusSupplierOrderReceivedAll=All products received -NeedAtLeastOneInvoice = There has to be at least one Invoice From f45ec82904c9fc4c0aabe40760535675d687ee20 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 15 Jan 2023 13:13:49 +0100 Subject: [PATCH 06/12] Disallow line delete if already dispatched --- htdocs/fourn/class/fournisseur.commande.class.php | 13 ++++++++++++- htdocs/langs/en_US/orders.lang | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a08f2046790..8b539138bfb 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2139,6 +2139,16 @@ class CommandeFournisseur extends CommonOrder return 0; } + // check if not yet received + $dispatchedLines = $this->getDispachedLines(); + foreach ($dispatchedLines as $dispatchLine) { + if ($dispatchLine['orderlineid'] == $idline) { + $this->error = "LineAlreadyDispatched"; + $this->errors[] = $this->error; + return -3; + } + } + if ($line->delete($notrigger) > 0) { $this->update_price(1); return 1; @@ -2327,7 +2337,7 @@ class CommandeFournisseur extends CommonOrder // List of already dispatched lines $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; - $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; + $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_commandefourndet"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; @@ -2351,6 +2361,7 @@ class CommandeFournisseur extends CommonOrder 'productid' => $objp->fk_product, 'warehouseid' => $objp->warehouse_id, 'qty' => $objp->qty, + 'orderlineid' => $objp->fk_commandefourndet ); } diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index f988cd62f19..4be2b34fd73 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -204,3 +204,5 @@ StatusSupplierOrderApproved=Approved StatusSupplierOrderRefused=Refused StatusSupplierOrderReceivedPartially=Partially received StatusSupplierOrderReceivedAll=All products received +NeedAtLeastOneInvoice = There has to be at least one Invoice +LineAlreadyDispatched = The order line is already received. \ No newline at end of file From 6f93cac359f875dd97cead8973135ad1f4548e5d Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 16 Jan 2023 17:10:26 +0100 Subject: [PATCH 07/12] fix style error --- htdocs/loan/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 5acd2532bef..1225f5304be 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -66,8 +66,7 @@ $search_amount = GETPOST('search_amount', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'loanlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); -$mode = GETPOST('mode', 'alpha'); // mode view result - +$mode = GETPOST('mode', 'alpha'); // mode view result /* From 98356222c18786336ef9c421a2ac7b39b776ae01 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Wed, 18 Jan 2023 10:36:52 +0100 Subject: [PATCH 08/12] NEW: Can add any contact on events if global MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is set at 1 --- htdocs/comm/action/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 91eb9f49516..e6205cd5317 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1446,7 +1446,7 @@ if ($action == 'create') { } if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int'); print img_picto('', 'contact', 'class="paddingrightonly"'); - print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); + print $form->selectcontacts(empty($conf->global->MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT) ? GETPOST('socid', 'int') : 0, $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); print ''; } @@ -1949,7 +1949,7 @@ if ($id > 0) { // related contact print ''.$langs->trans("ActionOnContact").''; print '
'; - print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts($object->socid, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid'); + print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(empty($conf->global->MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT) ? $object->socid : 0, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'quatrevingtpercent', false, 0, 0, array(), 'multiple', 'contactid'); print '
'; print ''; print ''; From ea6964ccd059de8382ccec91d4f2ad2f3cc506ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 18 Jan 2023 22:03:38 +0100 Subject: [PATCH 09/12] fix undeclared properties for php 8.2 --- htdocs/adherents/class/adherent.class.php | 15 ++++++++++++++- htdocs/adherents/class/adherent_type.class.php | 13 +++++++++++++ htdocs/core/class/commonobject.class.php | 9 +++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 225261e8f9f..99e84d61026 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2014-2018 Alexandre Spangaro * Copyright (C) 2015 Marcos García - * Copyright (C) 2015-2022 Frédéric France + * Copyright (C) 2015-2023 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2018-2019 Thibault FOUCART @@ -89,6 +89,11 @@ class Adherent extends CommonObject */ public $pass_indatabase_crypted; + /** + * @var string fullname + */ + public $fullname; + /** * @var string company name * @deprecated @@ -292,6 +297,10 @@ class Adherent extends CommonObject public $first_subscription_date; + public $first_subscription_date_start; + + public $first_subscription_date_end; + public $first_subscription_amount; public $last_subscription_date; @@ -304,6 +313,10 @@ class Adherent extends CommonObject public $subscriptions = array(); + /** + * @var string ip + */ + public $ip; // Fields loaded by fetchPartnerships() from partnership table diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 0a4663f8149..915502a9e96 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -129,6 +129,19 @@ class AdherentType extends CommonObject /** @var string string other */ public $other = array(); + /** + * @var string description + */ + public $description; + + /** + * @var string email + */ + public $email; + + /** + * @var array multilangs + */ public $multilangs = array(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ecf03696d7a..9f28f6c0d70 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -593,6 +593,15 @@ abstract class CommonObject protected $labelStatus; protected $labelStatusShort; + /** + * @var array nb used in load_stateboard + */ + public $nb = array(); + + /** + * @var string output + */ + public $output; /** * @var array List of child tables. To test if we can delete object. From cccba873a8f5eaf49e45ffa61eb43cb3635c6ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 18 Jan 2023 22:20:25 +0100 Subject: [PATCH 10/12] fix undeclared properties for php 8.2 --- htdocs/adherents/class/adherent.class.php | 7 +++++++ htdocs/contact/class/contact.class.php | 15 +++++++++++++++ htdocs/user/class/user.class.php | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 99e84d61026..2d8433de0c4 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -94,6 +94,13 @@ class Adherent extends CommonObject */ public $fullname; + /** + * @var string The civility code, not an integer + */ + public $civility_id; + public $civility_code; + public $civility; + /** * @var string company name * @deprecated diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 67b3ce2a38a..8c3991cabaf 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -130,6 +130,16 @@ class Contact extends CommonObject public $civility_code; public $civility; + /** + * @var int egroupware_id + */ + public $egroupware_id; + + /** + * @var int birthday_alert + */ + public $birthday_alert; + /** * @var string The civilite code, not an integer * @deprecated @@ -137,6 +147,11 @@ class Contact extends CommonObject */ public $civilite; + /** + * @var string fullname + */ + public $fullname; + /** * @var string Address */ diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 22556d3e1c2..3dc74832503 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -76,6 +76,11 @@ class User extends CommonObject public $employee; public $civility_code; + /** + * @var string fullname + */ + public $fullname; + /** * @var string gender */ From 9cd6adb6c8df667dd63f1a1bed3ce1723aac31cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 18 Jan 2023 22:28:43 +0100 Subject: [PATCH 11/12] use oldcopy only to retrieve old values instaed undeclared properties --- htdocs/contact/card.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 3e7f5fdb1f1..66cdc1ed1aa 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -322,9 +322,6 @@ if (empty($reshook)) { $result = $object->fetch($id); $object->oldcopy = clone $object; - $object->old_lastname = (string) GETPOST("old_lastname", 'alpha'); - $object->old_firstname = (string) GETPOST("old_firstname", 'alpha'); - $result = $object->delete(); // TODO Add $user as first param if ($result > 0) { setEventMessages("RecordDeleted", null, 'mesgs'); @@ -408,9 +405,6 @@ if (empty($reshook)) { $object->oldcopy = clone $object; - $object->old_lastname = (string) GETPOST("old_lastname", 'alpha'); - $object->old_firstname = (string) GETPOST("old_firstname", 'alpha'); - $object->socid = GETPOST("socid", 'int'); $object->lastname = (string) GETPOST("lastname", 'alpha'); $object->firstname = (string) GETPOST("firstname", 'alpha'); @@ -972,7 +966,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { /* set country at end because it will trigger page refresh */ console.log("Set country id to '.dol_escape_js($objsoc->country_id).'"); $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'").trigger("change"); /* trigger required to update select2 components */ - }); + }); })'."\n"; print ''."\n"; } @@ -982,8 +976,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; print ''; - print ''; - print ''; if (!empty($backtopage)) { print ''; } @@ -1033,7 +1025,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; print ''; print '
'; - if ($conf->use_javascript_ajax) { + if (!empty($conf->use_javascript_ajax)) { print ''.$langs->trans('CopyAddressFromSoc').'
'; } print '
'; @@ -1636,7 +1628,7 @@ function showSocialNetwork() items.show(); lnk.text("'.dol_escape_js($langs->transnoentitiesnoconv("HideSocialNetwork")).'"); if(chgCookieState) {document.cookie = "DOLUSER_SOCIALNETWORKS_SHOW=true; SameSite=Strict";} - } + } } '; } From 823a7ee72b5af6840a1197fa79882e4554e0eaef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 18 Jan 2023 22:37:08 +0100 Subject: [PATCH 12/12] fix undeclared properties --- htdocs/commande/class/commande.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 35ebda89c2c..2a462f77bc4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2016-2022 Ferran Marcet - * Copyright (C) 2021-2022 Frédéric France + * Copyright (C) 2021-2023 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -236,6 +236,11 @@ class Commande extends CommonOrder */ public $user_valid; + /** + * @var OrderLine one line of an order + */ + public $line; + /** * @var OrderLine[] */