From abd5a86f348256fa6ab2eb09b93bed678f0ff9d2 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 19 Dec 2022 15:19:12 +0100 Subject: [PATCH 01/16] mode Kanban for subscription list --- htdocs/adherents/class/subscription.class.php | 32 ++ htdocs/adherents/subscription/list.php | 275 ++++++++++-------- 2 files changed, 187 insertions(+), 120 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index b3cfe027197..411fdb2181f 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -505,4 +505,36 @@ class Subscription extends CommonObject dol_print_error($this->db); } } + + /** + * 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 = '') + { + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + + $return .= '
'; + $return .= ''.(property_exists($this, 'fk_adherent')? $this->fk_adherent: $this->ref ).''; + if (property_exists($this, 'dateh') || property_exists($this, 'datef')) { + $return .= '
'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').''; + } + + if (property_exists($this, 'fk_bank')) { + $return .= '
'.$this->fk_bank.''; + } + if (property_exists($this, 'amount')) { + $return .= '
'.price($this->amount).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + return $return; + } } diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 1523bd4ee90..5aa19c6c6d0 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -37,6 +37,8 @@ $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'subscriptionlist'; // To manage different context of search +$mode = GETPOST('mode', 'alpha'); + $statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1); $search_ref = GETPOST('search_ref', 'alpha'); @@ -253,6 +255,9 @@ if (!empty($date_select)) { } $param = ''; +if (!empty($mode)) { + $param .='&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -298,6 +303,9 @@ if (in_array($massaction, array('presend', 'predelete'))) { $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $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')); + if ($user->rights->adherent->cotisation->creer) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewSubscription'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/list.php?status=-1,1'); } @@ -313,6 +321,8 @@ print ''; print ''; print ''; print ''; +print ''; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -506,144 +516,169 @@ while ($i < min($num, $limit)) { $adht->fetch($typeid); $adherent->need_subscription = $adht->subscription; - - print ''; - - // Ref - if (!empty($arrayfields['d.ref']['checked'])) { - print ''.$subscription->getNomUrl(1).''; - if (!$i) { - $totalarray['nbfield']++; + + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; } - } - // Type - if (!empty($arrayfields['d.fk_type']['checked'])) { - print ''; - if ($typeid > 0) { - print $adht->getNomUrl(1); - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Lastname - if (!empty($arrayfields['d.lastname']['checked'])) { - print ''.$adherent->getNomUrl(-1, 0, 'card', 'lastname').''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Firstname - if (!empty($arrayfields['d.firstname']['checked'])) { - print ''.$adherent->firstname.''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Login - if (!empty($arrayfields['d.login']['checked'])) { - print ''.$adherent->login.''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Label - if (!empty($arrayfields['t.libelle']['checked'])) { - print ''; - print $obj->note; - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Banque - if (!empty($arrayfields['d.bank']['checked'])) { - print ''; + + //fetch informations needs on this mode + $subscription->fk_adherent = $adherent->getNomUrl(1); + $subscription->fk_type = $adht->getNomUrl(1); + $subscription->amount = $obj->subscription; if ($obj->fk_account > 0) { $accountstatic->id = $obj->fk_account; $accountstatic->fetch($obj->fk_account); - //$accountstatic->label=$obj->label; - print $accountstatic->getNomUrl(1); + $subscription->fk_bank = $accountstatic->getNomUrl(1); } - print "\n"; - if (!$i) { - $totalarray['nbfield']++; + // Output Kanban + print $subscription->getKanbanView(''); + if ($i == (min($num, $limit) - 1)) { + print '
'; + print ''; } } - // Date start - if (!empty($arrayfields['c.dateadh']['checked'])) { - print ''.dol_print_date($db->jdate($obj->dateadh), 'day')."\n"; - if (!$i) { - $totalarray['nbfield']++; + else { + print ''; + + // Ref + if (!empty($arrayfields['d.ref']['checked'])) { + print ''.$subscription->getNomUrl(1).''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Date end - if (!empty($arrayfields['c.datef']['checked'])) { - print ''.dol_print_date($db->jdate($obj->datef), 'day')."\n"; - if (!$i) { - $totalarray['nbfield']++; + // Type + if (!empty($arrayfields['d.fk_type']['checked'])) { + print ''; + if ($typeid > 0) { + print $adht->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - } - // Price - if (!empty($arrayfields['d.amount']['checked'])) { - print ''.price($obj->subscription).''; - if (!$i) { - $totalarray['nbfield']++; + + // Lastname + if (!empty($arrayfields['d.lastname']['checked'])) { + print ''.$adherent->getNomUrl(-1, 0, 'card', 'lastname').''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'd.amount'; + // Firstname + if (!empty($arrayfields['d.firstname']['checked'])) { + print ''.$adherent->firstname.''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (empty($totalarray['val']['d.amount'])) { - $totalarray['val']['d.amount'] = $obj->subscription; - } else { - $totalarray['val']['d.amount'] += $obj->subscription; + + // Login + if (!empty($arrayfields['d.login']['checked'])) { + print ''.$adherent->login.''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Label + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''; + print $obj->note; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Banque + if (!empty($arrayfields['d.bank']['checked'])) { + print ''; + if ($obj->fk_account > 0) { + $accountstatic->id = $obj->fk_account; + $accountstatic->fetch($obj->fk_account); + //$accountstatic->label=$obj->label; + print $accountstatic->getNomUrl(1); + } + print "\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Date start + if (!empty($arrayfields['c.dateadh']['checked'])) { + print ''.dol_print_date($db->jdate($obj->dateadh), 'day')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date end + if (!empty($arrayfields['c.datef']['checked'])) { + print ''.dol_print_date($db->jdate($obj->datef), 'day')."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Price + if (!empty($arrayfields['d.amount']['checked'])) { + print ''.price($obj->subscription).''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'd.amount'; + } + if (empty($totalarray['val']['d.amount'])) { + $totalarray['val']['d.amount'] = $obj->subscription; + } else { + $totalarray['val']['d.amount'] += $obj->subscription; + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (!empty($arrayfields['c.datec']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date modification + if (!empty($arrayfields['c.tms']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column + print ''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->crowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (!empty($arrayfields['c.datec']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; if (!$i) { $totalarray['nbfield']++; } - } - // Date modification - if (!empty($arrayfields['c.tms']['checked'])) { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - print ''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->crowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; + print "\n"; + } $i++; } From 0c75e5bb2d81adb5cfa356e528c0cf77ec2c94c2 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 19 Dec 2022 15:19:18 +0100 Subject: [PATCH 02/16] mode Kanban for subscription list --- htdocs/adherents/class/subscription.class.php | 2 +- htdocs/adherents/subscription/list.php | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 411fdb2181f..12e19fd9c3a 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -525,7 +525,7 @@ class Subscription extends CommonObject if (property_exists($this, 'dateh') || property_exists($this, 'datef')) { $return .= '
'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').''; } - + if (property_exists($this, 'fk_bank')) { $return .= '
'.$this->fk_bank.''; } diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 5aa19c6c6d0..501bd9c80e5 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -516,13 +516,13 @@ while ($i < min($num, $limit)) { $adht->fetch($typeid); $adherent->need_subscription = $adht->subscription; - + if ($mode == 'kanban') { if ($i == 0) { print ''; print '
'; } - + //fetch informations needs on this mode $subscription->fk_adherent = $adherent->getNomUrl(1); $subscription->fk_type = $adht->getNomUrl(1); @@ -538,9 +538,7 @@ while ($i < min($num, $limit)) { print '
'; print ''; } - } - - else { + } else { print ''; // Ref From aed3f841bc1424304bc44e71449456d38ea3a2f7 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 20 Dec 2022 11:27:55 +0100 Subject: [PATCH 03/16] New View mode for Adherent Type list --- .../adherents/class/adherent_type.class.php | 42 +++++++++++ htdocs/adherents/type.php | 71 ++++++++++++------- 2 files changed, 89 insertions(+), 24 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 4516b132982..25211f11bd9 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -927,4 +927,46 @@ class AdherentType extends CommonObject return ''; } + + + /** + * 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 void HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '') + { + global $langs,$user; + $return = '
'; + $return .= '
'; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
'; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if ($user->rights->adherent->configurer) { + $return .= 'ref.'">'.img_edit().''; + } else { + $return .= ' '; + } + if (property_exists($this, 'vote')) { + $return .= '
'.$langs->trans("VoteAllowed").' : '.yn($this->vote).''; + } + if (property_exists($this, 'amount')) { + if (is_null($this->amount) || $this->amount === '') { + $return .= '
'; + } else { + $return .= '
'.$langs->trans("Amount").''; + $return .= ' : '.price($this->amount).''; + } + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
'.$this->getLibStatut(5).'
'; + } + $return .= '
'; + $return .= '
'; + $return .= '
'; + print $return; + } } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 257e7266e5a..6a2dbdb125d 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -44,6 +44,7 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$mode = GETPOST('mode', 'alopha'); $sall = GETPOST("sall", "alpha"); $filter = GETPOST("filter", 'alpha'); @@ -248,6 +249,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $i = 0; $param = ''; + if (!empty($mode)) { + $param .= '&mode'.urlencode($mode); + } if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.$contextpage; } @@ -256,6 +260,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } $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')); + if ($user->rights->adherent->configurer) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); } @@ -269,6 +276,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; print ''; + print ''; + print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -302,32 +311,46 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $membertype->amount = $objp->amount; $membertype->caneditamount = $objp->caneditamount; - print ''; - print ''; - print $membertype->getNomUrl(1); - //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' - print ''; - print ''.dol_escape_htmltag($objp->label).''; - print ''; - if ($objp->morphy == 'phy') { - print $langs->trans("Physical"); - } elseif ($objp->morphy == 'mor') { - print $langs->trans("Moral"); + if ($mode == 'kanban') { + if ($i == 0) { + print ''; + print '
'; + } + //output kanban + $membertype->label = $objp->label; + $membertype->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print '
'; + print ''; + } } else { - print $langs->trans("MorAndPhy"); + print ''; + print ''; + print $membertype->getNomUrl(1); + //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' + print ''; + print ''.dol_escape_htmltag($objp->label).''; + print ''; + if ($objp->morphy == 'phy') { + print $langs->trans("Physical"); + } elseif ($objp->morphy == 'mor') { + print $langs->trans("Moral"); + } else { + print $langs->trans("MorAndPhy"); + } + print ''; + print ''.yn($objp->subscription).''; + print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; + print ''.yn($objp->caneditamount).''; + print ''.yn($objp->vote).''; + print ''.$membertype->getLibStatut(5).''; + if ($user->rights->adherent->configurer) { + print 'rowid.'">'.img_edit().''; + } else { + print ' '; + } + print ""; } - print ''; - print ''.yn($objp->subscription).''; - print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; - print ''.yn($objp->caneditamount).''; - print ''.yn($objp->vote).''; - print ''.$membertype->getLibStatut(5).''; - if ($user->rights->adherent->configurer) { - print 'rowid.'">'.img_edit().''; - } else { - print ' '; - } - print ""; $i++; } From 54bd44e14af1744946b0d8d8148080b84be49422 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Tue, 20 Dec 2022 11:43:42 +0100 Subject: [PATCH 04/16] NEW : notify also the contributor affected to a ticket if a new message public is post (add global TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR) --- htdocs/ticket/class/ticket.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 2a3160b3b67..10c0541c168 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2449,6 +2449,16 @@ class Ticket extends CommonObject $assigned_user_dont_have_email = $assigned_user->getFullName($langs); } } + if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR)) { + $contactList = $object->liste_contact(-1, 'internal', 0, 'CONTRIBUTOR'); + if (is_array($contactList)) { + foreach ($contactList as $contactArray) { + if (!empty($contactArray['email'])) { + $sendto[] = dolGetFirstLastname($contactArray['firstname'], $contactArray['lastname']) . " <" . $contactArray['email'] . ">"; + } + } + } + } if (empty($sendto)) { if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) { $sendto[] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; From a849283e378b883ec59c6702efa1dcd2cbc2010e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 20 Dec 2022 12:41:54 +0100 Subject: [PATCH 05/16] update return type --- htdocs/adherents/class/adherent_type.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 25211f11bd9..e0311aacd34 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -933,7 +933,7 @@ class AdherentType extends CommonObject * 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 void HTML Code for Kanban thumb. + * @return string HTML Code for Kanban thumb. */ public function getKanbanView($option = '') { @@ -967,6 +967,6 @@ class AdherentType extends CommonObject $return .= ''; $return .= ''; $return .= ''; - print $return; + return $return; } } From 53ba5c0a4939e019a34e265bb8528e0b163cd781 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 22 Dec 2022 10:22:57 +0000 Subject: [PATCH 06/16] Fixing style errors. --- htdocs/adherents/type.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 0d8b37bbeb9..3796522e70e 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -264,9 +264,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $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')); - - if ($user->hasRight('adherent', 'configurer')) { + if ($user->hasRight('adherent', 'configurer')) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); } @@ -327,8 +326,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; } - } - else { + } else { print ''; print ''; print $membertype->getNomUrl(1); From 3ed5edc0032ff0f1ace6958e11e628cf52eeecb0 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 2 Jan 2023 16:21:14 +0100 Subject: [PATCH 07/16] NEW : search on time spent duration range --- htdocs/projet/tasks/time.php | 53 +++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 94ed0edaffd..8c98e6387b1 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -88,6 +88,10 @@ $search_company = GETPOST('$search_company', 'alpha'); $search_company_alias = GETPOST('$search_company_alias', 'alpha'); $search_project_ref = GETPOST('$search_project_ref', 'alpha'); $search_project_label = GETPOST('$search_project_label', 'alpha'); +$search_timespent_starthour = GETPOSTINT("search_timespent_duration_starthour"); +$search_timespent_startmin = GETPOSTINT("search_timespent_duration_startmin"); +$search_timespent_endhour = GETPOSTINT("search_timespent_duration_endhour"); +$search_timespent_endmin = GETPOSTINT("search_timespent_duration_endmin"); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -196,6 +200,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_product_ref = ''; $toselect = array(); $search_array_options = array(); + $search_timespent_starthour = ''; + $search_timespent_startmin = ''; + $search_timespent_endhour = ''; + $search_timespent_endmin = ''; $action = ''; } @@ -1337,6 +1345,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($search_date_endyear) { $param .= '&search_date_endyear='.urlencode($search_date_endyear); } + if ($search_timespent_starthour) { + $param .= '&search_timespent_duration_starthour='.urlencode($search_timespent_starthour); + } + if ($search_timespent_startmin) { + $param .= '&search_timespent_duration_startmin='.urlencode($search_timespent_startmin); + } + if ($search_timespent_endhour) { + $param .= '&search_timespent_duration_endhour='.urlencode($search_timespent_endhour); + } + if ($search_timespent_endmin) { + $param .= '&search_timespent_duration_endmin='.urlencode($search_timespent_endmin); + } /* // Add $param from extra fields @@ -1609,6 +1629,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $sql .= " AND t.task_date <= '".$db->idate($search_date_end)."'"; } + if($search_timespent_starthour || $search_timespent_startmin) { + $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds + $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration >= ".$timespent_duration_start; + } + + if($search_timespent_endhour || $search_timespent_endmin) { + $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds + $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration <= ".$timespent_duration_end; + } + $sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year); // Add where from hooks @@ -1877,7 +1909,26 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Duration if (!empty($arrayfields['t.task_duration']['checked'])) { - print ''; + // Duration - Time spent + print ''; + + $durationtouse_start = 0; + if ($search_timespent_starthour || $search_timespent_startmin) { + $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60); + } + print '
'.$langs->trans('from').' '; + $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text'); + print '
'; + + $durationtouse_end = 0; + if ($search_timespent_endhour || $search_timespent_endmin) { + $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60); + } + print '
'.$langs->trans('at').' '; + $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text'); + print '
'; + + print ''; } // Product if (!empty($arrayfields['t.fk_product']['checked'])) { From c84d17eced5d2a922b89b85a30ba61f6b680dbcf Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 2 Jan 2023 16:58:33 +0100 Subject: [PATCH 08/16] FIX : filter only if t.task_duration checked --- htdocs/projet/tasks/time.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 8c98e6387b1..6652b57304a 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1629,16 +1629,20 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $sql .= " AND t.task_date <= '".$db->idate($search_date_end)."'"; } - if($search_timespent_starthour || $search_timespent_startmin) { - $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds - $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds - $sql .= " AND t.task_duration >= ".$timespent_duration_start; - } + if (!empty($arrayfields['t.task_duration']['checked'])) { - if($search_timespent_endhour || $search_timespent_endmin) { - $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds - $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds - $sql .= " AND t.task_duration <= ".$timespent_duration_end; + if ($search_timespent_starthour || $search_timespent_startmin) { + $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds + $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration >= " . $timespent_duration_start; + } + + if ($search_timespent_endhour || $search_timespent_endmin) { + $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds + $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration <= " . $timespent_duration_end; + } + } $sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year); From c2b98856d395b73533a11e59065ee61dec1de95b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Jan 2023 15:32:31 +0100 Subject: [PATCH 09/16] Debug v17 --- htdocs/hrm/admin/admin_establishment.php | 11 +++++------ htdocs/langs/en_US/hrm.lang | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 99212988488..59192bc5ca5 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -145,13 +145,12 @@ if ($result) { $establishmentstatic->label = $obj->label; $establishmentstatic->status = $obj->status; - print ''; print ''.$establishmentstatic->getNomUrl(1).''; - print ''.$obj->label.''; - print ''.$obj->address.''; - print ''.$obj->zip.''; - print ''.$obj->town.''; + print ''.dol_escape_htmltag($obj->label).''; + print ''.dol_escape_htmltag($obj->address).''; + print ''.dol_escape_htmltag($obj->zip).''; + print ''.dol_escape_htmltag($obj->town).''; print ''; print $establishmentstatic->getLibStatut(5); print ''; @@ -160,7 +159,7 @@ if ($result) { $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 966f2399a13..592009b8697 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -86,7 +86,7 @@ SaveAddSkill = Skill(s) added SaveLevelSkill = Skill(s) level saved DeleteSkill = Skill removed SkillsExtraFields=Attributs supplémentaires (Compétences) -JobsExtraFields=Attributs supplémentaires (Emplois) +JobsExtraFields=Attributs supplémentaires (Job profile) EvaluationsExtraFields=Attributs supplémentaires (Evaluations) NeedBusinessTravels=Need business travels NoDescription=No description \ No newline at end of file From cfa974df2599ca895432a080285ba1f684571512 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Jan 2023 15:48:23 +0100 Subject: [PATCH 10/16] Look and feel v17 --- htdocs/admin/modulehelp.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index e18e65e47a0..9a0c34aea2b 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -372,13 +372,13 @@ if ($mode == 'feature') { if (count($objMod->depends)) { $text .= join(',', $objMod->depends); } else { - $text .= $langs->trans("None"); + $text .= ''.$langs->trans("None").''; } $text .= '
'.$langs->trans("RequiredBy").': '; if (count($objMod->requiredby)) { $text .= join(',', $objMod->requiredby); } else { - $text .= $langs->trans("None"); + $text .= ''.$langs->trans("None").''; } $text .= '

'; @@ -395,7 +395,7 @@ if ($mode == 'feature') { $i++; } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -408,7 +408,7 @@ if ($mode == 'feature') { $i++; } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -418,7 +418,7 @@ if ($mode == 'feature') { if (dol_is_file($filedata)) { $text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)'; } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -437,7 +437,7 @@ if ($mode == 'feature') { } } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -446,7 +446,7 @@ if ($mode == 'feature') { if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models']) { $text .= $langs->trans("Yes"); } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -455,7 +455,7 @@ if ($mode == 'feature') { if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) { $text .= $langs->trans("Yes"); } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -468,7 +468,7 @@ if ($mode == 'feature') { $i++; } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -502,7 +502,7 @@ if ($mode == 'feature') { $i++; } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -531,7 +531,7 @@ if ($mode == 'feature') { $i++; } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -544,7 +544,7 @@ if ($mode == 'feature') { $i++; } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -553,7 +553,7 @@ if ($mode == 'feature') { if (isset($objMod->menu) && !empty($objMod->menu)) { // objMod can be an array or just an int 1 $text .= $langs->trans("Yes"); } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -566,7 +566,7 @@ if ($mode == 'feature') { $i++; } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; @@ -579,13 +579,13 @@ if ($mode == 'feature') { $i++; } } else { - $text .= $langs->trans("No"); + $text .= ''.$langs->trans("No").''; } $text .= '
'; $text .= '
'.$langs->trans("AddOtherPagesOrServices").': '; - $text .= $langs->trans("DetectionNotPossible"); + $text .= ''.$langs->trans("DetectionNotPossible").''; } @@ -594,7 +594,7 @@ if ($mode == 'changelog') { if ($changelog) { $text .= '
'.$changelog.'
'; } else { - $text .= '
'.$langs->trans("NotAvailable").'
'; + $text .= '
'.$langs->trans("NotAvailable").'
'; } } From 28ff94fd67c337ac60f3aa9201f5200c69c87c3b Mon Sep 17 00:00:00 2001 From: hystepik Date: Wed, 4 Jan 2023 16:09:55 +0100 Subject: [PATCH 11/16] Fix : facture-rec 's deletion process --- htdocs/compta/facture/card-rec.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 26fb26d4cdb..7896b26e8b0 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -271,7 +271,7 @@ if (empty($reshook)) { } // Delete - if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && $user->rights->facture->supprimer) { + if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer) { $object->delete($user); header("Location: ".DOL_URL_ROOT.'/compta/facture/invoicetemplate_list.php'); @@ -1175,8 +1175,8 @@ if ($action == 'create') { } // Confirm delete of repeatable invoice - if ($action == 'ask_deleteinvoice') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1); + if ($action == 'delete') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_delete', '', 'no', 1); } // Call Hook formConfirm From f964f14c850537e82812b7c0fead7f62966ff6e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Jan 2023 17:36:31 +0100 Subject: [PATCH 12/16] Fix phpunit --- htdocs/core/db/DoliDB.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 0c62be0a85a..30b3ea76975 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -75,7 +75,7 @@ abstract class DoliDB implements Database /** - * Return the DB prefix found into prefix_db (if it was set manually by doing $db->prefix_db=...). + * Return the DB prefix found into prefix_db (if it was set manually by doing $dbhandler->prefix_db=...). * Otherwise return MAIN_DB_PREFIX (common use). * * @return string The DB prefix From 9dd6045412611830873e2bdb2d15573685b0ad40 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 4 Jan 2023 17:06:16 +0000 Subject: [PATCH 13/16] Fixing style errors. --- htdocs/projet/tasks/time.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 6652b57304a..3c8597cd862 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1630,7 +1630,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } if (!empty($arrayfields['t.task_duration']['checked'])) { - if ($search_timespent_starthour || $search_timespent_startmin) { $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds @@ -1642,7 +1641,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds $sql .= " AND t.task_duration <= " . $timespent_duration_end; } - } $sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year); From 6c4809bcf58b30813af9bfee897af1658aae025d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Jan 2023 18:11:40 +0100 Subject: [PATCH 14/16] Standardize code: same code for message from public and backoffice --- htdocs/ticket/class/ticket.class.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 54d09e28288..c7813b708c8 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2369,7 +2369,7 @@ class Ticket extends CommonObject /** * Add new message on a ticket (private/public area). - * Can also send it be email if GETPOST('send_email', 'int') is set. For such email, header and footer is added. + * Can also send it by email if GETPOST('send_email', 'int') is set. For such email, header and footer is added. * * @param User $user User for action * @param string $action Action string @@ -2438,8 +2438,13 @@ class Ticket extends CommonObject * Send emails to assigned users (public area notification) */ if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED)) { + // Retrieve internal contact datas + $internal_contacts = $object->getInfosTicketInternalContact(); + $assigned_user_dont_have_email = ''; + $sendto = array(); + if ($this->fk_user_assign > 0) { $assigned_user = new User($this->db); $assigned_user->fetch($this->fk_user_assign); @@ -2449,16 +2454,21 @@ class Ticket extends CommonObject $assigned_user_dont_have_email = $assigned_user->getFullName($langs); } } - if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR)) { - $contactList = $object->liste_contact(-1, 'internal', 0, 'CONTRIBUTOR'); - if (is_array($contactList)) { - foreach ($contactList as $contactArray) { - if (!empty($contactArray['email'])) { - $sendto[] = dolGetFirstLastname($contactArray['firstname'], $contactArray['lastname']) . " <" . $contactArray['email'] . ">"; - } + + // Build array to display recipient list + foreach ($internal_contacts as $key => $info_sendto) { + // Avoid duplicate notifications + if ($info_sendto['id'] == $user->id) { + continue; + } + + if ($info_sendto['email'] != '') { + if (!empty($info_sendto['email'])) { + $sendto[] = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'])." <".$info_sendto['email'].">"; } } } + if (empty($sendto)) { if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) { $sendto[] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL; From 8a42999bdaa97f2ebfaddf5b9d4977f8c53b6003 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Jan 2023 18:12:13 +0100 Subject: [PATCH 15/16] Debug v17 --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 27cdf8d164b..d4e0148f662 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2535,7 +2535,7 @@ class Ticket extends CommonObject if ($info_sendto['email'] != '') { if (!empty($info_sendto['email'])) { - $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + $sendto[] = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'])." <".$info_sendto['email'].">"; } // Contact type From 27792fe1adc45eef1e6a05536121fb042b9ee6bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Jan 2023 18:34:54 +0100 Subject: [PATCH 16/16] Fix qodana --- htdocs/commande/class/api_orders.class.php | 6 +++--- htdocs/compta/bank/class/api_bankaccounts.class.php | 10 +++++----- htdocs/core/class/comment.class.php | 6 ++++-- htdocs/core/class/evalmath.class.php | 13 +++++++------ htdocs/core/class/html.formticket.class.php | 3 +-- htdocs/core/class/openid.class.php | 4 ++-- .../core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../supplier_proposal/doc/pdf_aurore.modules.php | 2 +- htdocs/projet/class/api_projects.class.php | 5 ++--- htdocs/projet/class/project.class.php | 2 +- htdocs/user/class/user.class.php | 2 +- htdocs/user/class/usergroup.class.php | 12 ++++++------ 12 files changed, 34 insertions(+), 33 deletions(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 8e389d862d3..1a879173684 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -108,11 +108,11 @@ class Orders extends DolibarrApi * * Return an array with order informations * - * @param int $id ID of order + * @param int $id ID of order * @param string $ref Ref of object * @param string $ref_ext External reference of object - * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id - * @return array|mixed data without useless information + * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id + * @return Object Object with cleaned properties * * @throws RestException */ diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index c9886a176f0..537c7c9acb6 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -122,8 +122,8 @@ class BankAccounts extends DolibarrApi /** * Get account by ID. * - * @param int $id ID of account - * @return array Account object + * @param int $id ID of account + * @return Object Object with cleaned properties * * @throws RestException */ @@ -313,9 +313,9 @@ class BankAccounts extends DolibarrApi /** * Update account * - * @param int $id ID of account - * @param array $request_data data - * @return int + * @param int $id ID of account + * @param array $request_data data + * @return Object Object with cleaned properties */ public function put($id, $request_data = null) { diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 960d2ac4744..4a743e5b070 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -351,16 +351,18 @@ class Comment extends CommonObject /** - * Load comments linked with current task + * Load comments linked with current task into ->comments * * @param string $element_type Element type * @param int $fk_element Id of element - * @return array Comment array + * @return int Result */ public function fetchAllFor($element_type, $fk_element) { global $db, $conf; + $this->comments = array(); + if (!empty($element_type) && !empty($fk_element)) { $sql = "SELECT"; $sql .= " c.rowid"; diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index f2dfb80960e..9c01f133bf6 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -198,9 +198,9 @@ class EvalMath } /** - * vars + * Function vars * - * @return string Output + * @return array Output */ public function vars() { @@ -211,9 +211,9 @@ class EvalMath } /** - * vars + * Function funcs * - * @return string Output + * @return array Output */ private function funcs() { @@ -229,8 +229,8 @@ class EvalMath /** * Convert infix to postfix notation * - * @param string $expr Expression - * @return string Output + * @param string $expr Expression + * @return boolean|array Output */ private function nfx($expr) { @@ -367,6 +367,7 @@ class EvalMath } $output[] = $op; } + return $output; } diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 0aa2c39de91..a34861e17d6 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -779,7 +779,7 @@ class FormTicket * @param string $morecss More CSS * @param int $use_multilevel If > 0 create a multilevel select which use $htmlname example: $use_multilevel = 1 permit to have 2 select boxes. * @param Translate $outputlangs Output language - * @return void + * @return string|void String of HTML component */ public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0, $outputlangs = null) { @@ -985,7 +985,6 @@ class FormTicket } $sql = substr($sql, 0, -2); $sql .= ")"; - } else { } $sql .= $this->db->order('ctc.pos', 'ASC'); diff --git a/htdocs/core/class/openid.class.php b/htdocs/core/class/openid.class.php index 79cf9137a99..7198f532358 100644 --- a/htdocs/core/class/openid.class.php +++ b/htdocs/core/class/openid.class.php @@ -178,7 +178,7 @@ class SimpleOpenID /** * SetOpenIDServer * - * @return void + * @return array */ public function GetError() { @@ -225,7 +225,7 @@ class SimpleOpenID * splitResponse * * @param string $response Server - * @return void + * @return array */ public function splitResponse($response) { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index ff5283e2bb8..eac6e0261ee 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -907,7 +907,7 @@ class pdf_azur extends ModelePDFPropales * @param Propal $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object - * @return void + * @return int */ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) { 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 8e25a227ad7..ff90b500969 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -744,7 +744,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Object $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object - * @return void + * @return int */ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) { diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 6a18057afd5..8cbb3949cd5 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -29,7 +29,6 @@ */ class Projects extends DolibarrApi { - /** * @var array $FIELDS Mandatory fields, checked when create and update object */ @@ -267,10 +266,9 @@ class Projects extends DolibarrApi * * @param int $id Id of project * @param int $userid Id of user (0 = connected user) + * @return array * * @url GET {id}/roles - * - * @return int */ public function getRoles($id, $userid = 0) { @@ -301,6 +299,7 @@ class Projects extends DolibarrApi foreach ($this->project->roles as $line) { array_push($result, $this->_cleanObjectDatas($line)); } + return $result; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 57235d491da..79ea13dcd40 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1480,7 +1480,7 @@ class Project extends CommonObject * @param int $list 0=Return array, 1=Return string list * @param int $socid 0=No filter on third party, id of third party * @param string $filter additionnal filter on project (statut, ref, ...) - * @return array or string Array of projects id, or string with projects id separated with "," if list is 1 + * @return array|string Array of projects id, or string with projects id separated with "," if list is 1 */ public function getProjectsAuthorizedForUser($user, $mode = 0, $list = 0, $socid = 0, $filter = '') { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 5c0f3f15b45..a4d4c7acfe6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3489,7 +3489,7 @@ class User extends CommonObject * * @param int $deleteafterid Removed all users including the leaf $deleteafterid (and all its child) in user tree. * @param string $filter SQL filter on users. This parameter must not come from user intput. - * @return array Array of users $this->users. Note: $this->parentof is also set. + * @return array|int Array of users $this->users. Note: $this->parentof is also set. */ public function get_full_tree($deleteafterid = 0, $filter = '') { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 849b08bc7f6..71339991172 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -180,9 +180,9 @@ class UserGroup extends CommonObject /** * Return array of groups objects for a particular user * - * @param int $userid User id to search - * @param boolean $load_members Load all members of the group - * @return array Array of groups objects + * @param int $userid User id to search + * @param boolean $load_members Load all members of the group + * @return array|int Array of groups objects */ public function listGroupsForUser($userid, $load_members = true) { @@ -544,7 +544,7 @@ class UserGroup extends CommonObject * Charge dans l'objet group, la liste des permissions auquels le groupe a droit * * @param string $moduletag Name of module we want permissions ('' means all) - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >=0 if OK */ public function getrights($moduletag = '') { @@ -552,12 +552,12 @@ class UserGroup extends CommonObject if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag]) { // Rights for this module are already loaded, so we leave - return; + return 0; } if (!empty($this->all_permissions_are_loaded)) { // We already loaded all rights for this group, so we leave - return; + return 0; } /*