From 8426e955c8f221817653f9cc498db8eb60a7c713 Mon Sep 17 00:00:00 2001 From: Jesse Rovira Date: Fri, 2 Dec 2022 12:34:13 -0300 Subject: [PATCH 01/50] Showing Due date into last customer invoice at comm card --- htdocs/comm/card.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index f578aa75cf5..0df573b7f9b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1418,7 +1418,7 @@ if ($object->id > 0) { $sql .= ', f.total_tva'; $sql .= ', f.total_ttc'; $sql .= ', f.entity'; - $sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as status'; + $sql .= ', f.datef as df, f.date_lim_reglement as dl, f.datec as dc, f.paye as paye, f.fk_statut as status'; $sql .= ', s.nom, s.rowid as socid'; $sql .= ', SUM(pf.amount) as am'; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; @@ -1496,6 +1496,11 @@ if ($object->id > 0) { } else { print '!!!'; } + if ($objp->dl > 0) { + print ''.dol_print_date($db->jdate($objp->dl), 'day').''; + } else { + print '!!!'; + } print ''; print price($objp->total_ht); print ''; From f98381de8a45047a182d10df72c1509575f2a915 Mon Sep 17 00:00:00 2001 From: Jesse Rovira Date: Fri, 2 Dec 2022 13:36:17 -0300 Subject: [PATCH 02/50] Showing label for Due date into last customer invoice at comm card --- htdocs/comm/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 0df573b7f9b..345a97e9e19 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1492,12 +1492,12 @@ if ($object->id > 0) { //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print ''; if ($objp->df > 0) { - print ''.dol_print_date($db->jdate($objp->df), 'day').''; + print ''.$langs->trans('DateInvoice').": ".dol_print_date($db->jdate($objp->df), 'day').''; } else { print '!!!'; } if ($objp->dl > 0) { - print ''.dol_print_date($db->jdate($objp->dl), 'day').''; + print ''.$langs->trans('DateMaxPayment').": ".dol_print_date($db->jdate($objp->dl), 'day').''; } else { print '!!!'; } From 471260738ab41260459150b7ad3ccefbb9af4574 Mon Sep 17 00:00:00 2001 From: IC-Florian <71641704+IC-Florian@users.noreply.github.com> Date: Wed, 21 Dec 2022 12:03:32 +0100 Subject: [PATCH 03/50] FIX : Product list in setup.php in new Module --- htdocs/modulebuilder/template/admin/setup.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 1c46028b142..37fa410f1e7 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -55,6 +55,7 @@ global $langs, $user; // Libraries require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once '../lib/mymodule.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; //require_once "../class/myclass.class.php"; // Translations From 2a68836375fd0cdb9f1b03068fcfdfac0f61711b Mon Sep 17 00:00:00 2001 From: IC-Florian <71641704+IC-Florian@users.noreply.github.com> Date: Thu, 22 Dec 2022 14:52:03 +0100 Subject: [PATCH 04/50] New require for product in generateOutputField --- htdocs/core/class/html.formsetup.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 1cfddb588fd..4f88c597178 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1103,6 +1103,9 @@ class FormSetupItem $out.= $this->langs->trans("NorProspectNorCustomer"); } } elseif ($this->type == 'product') { + if (!class_exists("Product")){ + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + } $product = new Product($this->db); $resprod = $product->fetch($this->fieldValue); if ($resprod > 0) { From 56d05c09b2fd02450831083af0ec5ca560478378 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 22 Dec 2022 13:52:39 +0000 Subject: [PATCH 05/50] Fixing style errors. --- htdocs/core/class/html.formsetup.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 4f88c597178..611455f003f 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1103,9 +1103,9 @@ class FormSetupItem $out.= $this->langs->trans("NorProspectNorCustomer"); } } elseif ($this->type == 'product') { - if (!class_exists("Product")){ - require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - } + if (!class_exists("Product")) { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + } $product = new Product($this->db); $resprod = $product->fetch($this->fieldValue); if ($resprod > 0) { From ffae98085bcaa3b54e9d3439bff7e4ab71506fab Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 26 Dec 2022 22:36:05 +0100 Subject: [PATCH 06/50] New box box_members_by_tags.php --- htdocs/adherents/class/adherent.class.php | 2 +- .../adherents/class/adherentstats.class.php | 78 +++++ htdocs/core/boxes/box_members_by_tags.php | 279 ++++++++++++++++++ htdocs/core/boxes/modules_boxes.php | 1 + htdocs/langs/en_US/boxes.lang | 1 + 5 files changed, 360 insertions(+), 1 deletion(-) create mode 100644 htdocs/core/boxes/box_members_by_tags.php diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 6aaac503060..15df4f7225d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3203,4 +3203,4 @@ class Adherent extends CommonObject return $nbko; } -} +} \ No newline at end of file diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 9aa2fe2e8ad..ed86cae8704 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -181,4 +181,82 @@ class AdherentStats extends Stats return $this->_getAllByYear($sql); } + + + + /** + * Return count of member by status group by adh type, total and average + * + * @param int $numberYears Years to scan + * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type + */ + public function countMembersByTagAndStatus($tag_id, $numberYears = 2) + { + global $user; + + $now = dol_now(); + $endYear = date('Y'); + $startYear = $endYear - $numberYears; + + $sql = "SELECT c.rowid as fk_categorie, c.label as label"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_DRAFT, "'members_draft'", 'NULL').") as members_draft"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin IS NULL AND t.subscription = '1')", "'members_pending'", 'NULL').") as members_pending"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin >= '".$this->db->idate($now)."' OR t.subscription = 0)", "'members_uptodate'", 'NULL').") as members_uptodate"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_VALIDATED." AND (d.datefin < '".$this->db->idate($now)."' AND t.subscription = 1)", "'members_expired'", 'NULL').") as members_expired"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded"; + $sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated"; + $sql .= " FROM ".MAIN_DB_PREFIX."categorie as c"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as ct ON c.rowid = ct.fk_categorie"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_member"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as t ON t.rowid = d.fk_adherent_type"; + $sql .= " WHERE c.entity IN (".getEntity('member_type').")"; + $sql .= " AND d.entity IN (" . getEntity('adherent') . ")"; + $sql .= " AND t.entity IN (" . getEntity('adherent') . ")"; + $sql .= " AND d.datefin > '".$this->db->idate(dol_get_first_day($startYear))."'"; + $sql .= " AND c.fk_parent = 0"; + $sql .= " GROUP BY c.rowid"; + + dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG); + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $i = 0; + $MembersCountArray = []; + $totalstatus = array( + 'label' => 'Total', + 'members_draft' => 0, + 'members_pending' => 0, + 'members_uptodate' => 0, + 'members_expired' => 0, + 'members_excluded' => 0, + 'members_resiliated' => 0 + ); + while ($i < $num) { + $objp = $this->db->fetch_object($result); + $MembersCountArray[$objp->fk_categorie] = array( + 'label' => $objp->label, + 'members_draft' => (int) $objp->members_draft, + 'members_pending' => (int) $objp->members_pending, + 'members_uptodate' => (int) $objp->members_uptodate, + 'members_expired' => (int) $objp->members_expired, + 'members_excluded' => (int) $objp->members_excluded, + 'members_resiliated' => (int) $objp->members_resiliated + ); + $totalrow = 0; + foreach ($MembersCountArray[$objp->fk_categorie] as $key=>$nb) { + if ($key!='label') { + $totalrow += $nb; + $totalstatus[$key] += $nb; + } + } + $MembersCountArray[$objp->fk_categorie]['total_adhtype'] = $totalrow; + $i++; + } + $this->db->free($result); + $MembersCountArray['total'] = $totalstatus; + $MembersCountArray['total']['all'] = array_sum($totalstatus); + } + return $MembersCountArray; + } } diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php new file mode 100644 index 00000000000..cd7a499c867 --- /dev/null +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -0,0 +1,279 @@ + + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015-2020 Frederic France + * Copyright (C) 2021-2022 Waƫl Almoman + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_members_by_tags.php + * \ingroup adherent + * \brief Module to show box of members + */ + +include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php'; + + +/** + * Class to manage the box to show last modofied members + */ +class box_members_by_tags extends ModeleBoxes +{ + public $boxcode = "box_members_by_tags"; + public $boximg = "object_user"; + public $boxlabel = "BoxTitleMembersByTags"; + public $depends = array("adherent", "categorie"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $param; + public $enabled = 1; + + public $info_box_head = array(); + public $info_box_contents = array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param = '') + { + global $conf, $user; + + $this->db = $db; + + // disable module for such cases + $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) { + $this->enabled = 0; // disabled for external users + } + + $this->hidden = !(isModEnabled('adherent') && $user->rights->adherent->lire); + } + + /** + * Load data into info_box_contents array to show array later. + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $user, $langs, $conf; + $langs->load("boxes"); + + $this->max = $max; + + include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; + $staticmember = new Adherent($this->db); + + $year = date('Y'); + $numberyears = empty(getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH")) ? 2 : getDolGlobalInt("MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH"); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByTags").' ('.$year-$numberyears.' - '.$year.')'); + + if ($user->rights->adherent->lire) { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + $stats = new AdherentStats($this->db, $user->socid, $user->id); + + // Show array + $sumMembers= $stats->countMembersByTagAndStatus($tag_id, $numberyears); + echo "
";print_r($sumMembers);echo "
"; + if ($sumMembers) { + $line = 0; + $this->info_box_contents[$line][] = array( + 'td' => 'class=""', + 'text' => '', + ); + // Members Status To Valid + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_DRAFT, 0, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Waiting for subscription + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus, + ); + // Up to date + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() + 86400, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus, + ); + // Expired + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_VALIDATED, 1, dol_now() - 86400, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Excluded + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_EXCLUDED, 0, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Resiliated + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($labelstatus).'"', + 'text' => $labelstatus + ); + // Total row + $labelstatus = $staticmember->LibStatut($staticmember::STATUS_RESILIATED, 0, 0, 1); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right tdoverflowmax100" width="10%" title="'.dol_escape_htmltag($langs->trans("Total")).'"', + 'text' => $langs->trans("Total") + ); + $line++; + foreach ($sumMembers as $key => $data) { + $adhtype = new AdherentType($this->db); + $adhtype->id = $key; + + if ($key=='total') { + break; + } + $adhtype->label = $data['label']; + $AdherentType[$key] = $adhtype; + + $this->info_box_contents[$line][] = array( + 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', + 'text' => $adhtype->getNomUrl(1, dol_size(32)), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_draft']) && $data['members_draft'] > 0 ? $data['members_draft'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_uptodate']) && $data['members_uptodate'] > 0 ? $data['members_uptodate'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_expired']) && $data['members_expired'] > 0 ? $data['members_expired'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_excluded']) && $data['members_excluded'] > 0 ? $data['members_excluded'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['members_resiliated']) && $data['members_resiliated'] > 0 ? $data['members_resiliated'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3), + 'asis' => 1, + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="right"', + 'text' => (isset($data['total_adhtype']) && $data['total_adhtype'] > 0 ? $data['total_adhtype'] : ''), + 'asis' => 1, + ); + $line++; + } + + if (count($sumMembers) == 0) { + $this->info_box_contents[$line][0] = array( + 'td' => 'class="center" colspan="6"', + 'text' => $langs->trans("NoRecordedMembersByType") + ); + } else { + $this->info_box_contents[$line][] = array( + 'tr' => 'class="liste_total"', + 'td' => 'class="liste_total"', + 'text' => $langs->trans("Total") + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_draft'].' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_uptodate'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 0, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_expired'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 1, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_excluded'].' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['members_resiliated'].' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3), + 'asis' => 1 + ); + $this->info_box_contents[$line][] = array( + 'td' => 'class="liste_total right"', + 'text' => $sumMembers['total']['all'], + 'asis' => 1 + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => '', + 'maxlength' => 500, + 'text' => ($this->db->error() . ' sql=' . $sql) + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'class="nohover opacitymedium left"', + 'text' => $langs->trans("ReadPermissionNotAllowed") + ); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 1a29c8e1389..54ad02c0f3b 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -464,6 +464,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box closedir($handle); } } + echo "
";print_r($modules);echo "
"; asort($orders); diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 0ac1ecce545..9e80e36b119 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -24,6 +24,7 @@ BoxFicheInter=Latest interventions BoxCurrentAccounts=Open accounts balance BoxTitleMemberNextBirthdays=Birthdays of this month (members) BoxTitleMembersByType=Members by type and status +BoxTitleMembersByTags=Members by tags and status BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year BoxTitleLastRssInfos=Latest %s news from %s BoxTitleLastProducts=Products/Services: last %s modified From 5b40a4a21097b2550063c228e0d020b7ffd63752 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 26 Dec 2022 21:37:33 +0000 Subject: [PATCH 07/50] Fixing style errors. --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 15df4f7225d..6aaac503060 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3203,4 +3203,4 @@ class Adherent extends CommonObject return $nbko; } -} \ No newline at end of file +} From 5d09076a8faad01b77446ceb03d7ddcfd9f6bbe0 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 26 Dec 2022 22:56:26 +0100 Subject: [PATCH 08/50] Doc --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index ed86cae8704..20d66130362 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -187,10 +187,10 @@ class AdherentStats extends Stats /** * Return count of member by status group by adh type, total and average * - * @param int $numberYears Years to scan - * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member type + * @param int $numberYears Years to scan + * @return array Array with total of draft, pending, uptodate, expired, resiliated for each member tag */ - public function countMembersByTagAndStatus($tag_id, $numberYears = 2) + public function countMembersByTagAndStatus($numberYears = 2) { global $user; From 7a15e61849fd66edb0b1a33de6f34b2d1b5f201a Mon Sep 17 00:00:00 2001 From: daraelmin Date: Mon, 26 Dec 2022 22:59:39 +0100 Subject: [PATCH 09/50] Clean code --- htdocs/core/boxes/box_members_by_tags.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php index cd7a499c867..196cec30738 100644 --- a/htdocs/core/boxes/box_members_by_tags.php +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -98,8 +98,7 @@ class box_members_by_tags extends ModeleBoxes $stats = new AdherentStats($this->db, $user->socid, $user->id); // Show array - $sumMembers= $stats->countMembersByTagAndStatus($tag_id, $numberyears); - echo "
";print_r($sumMembers);echo "
"; + $sumMembers= $stats->countMembersByTagAndStatus($numberyears); if ($sumMembers) { $line = 0; $this->info_box_contents[$line][] = array( From 39cf086ace24ffd79ef4072dc2022caa28df7d54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Dec 2022 18:20:52 +0100 Subject: [PATCH 10/50] Update modules_boxes.php --- htdocs/core/boxes/modules_boxes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 54ad02c0f3b..96928adfdff 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -464,7 +464,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box closedir($handle); } } - echo "
";print_r($modules);echo "
"; + //echo "
";print_r($modules);echo "
"; asort($orders); From 596cb4caa6e987fe6642c2623a3ea340d44d345a Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 30 Dec 2022 18:16:42 +0100 Subject: [PATCH 11/50] Add box_members_by_tags.php in modAdherent.class.php --- htdocs/core/modules/modAdherent.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 2422cead7bb..0df5284eaed 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -198,6 +198,7 @@ class modAdherent extends DolibarrModules 4 => array('file'=>'box_members_last_subscriptions.php', 'enabledbydefaulton'=>'membersindex'), 5 => array('file'=>'box_members_subscriptions_by_year.php', 'enabledbydefaulton'=>'membersindex'), 6 => array('file'=>'box_members_by_type.php', 'enabledbydefaulton'=>'membersindex'), + 7 => array('file'=>'box_members_by_tags.php', 'enabledbydefaulton'=>'membersindex'), ); // Permissions From 1d50acb3cfdc083bc142d00d65c3f21808881143 Mon Sep 17 00:00:00 2001 From: GregM Date: Wed, 18 Jan 2023 12:10:58 +0100 Subject: [PATCH 12/50] Fix fieldvalue emailtemplate --- htdocs/core/class/html.formsetup.class.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 1cfddb588fd..0c9adf0be59 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1069,16 +1069,18 @@ class FormSetupItem } elseif ($this->type == 'yesno') { $out.= ajax_constantonoff($this->confKey); } elseif (preg_match('/emailtemplate:/', $this->type)) { - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($this->db); + if ($this->fieldValue > 0){ + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); - $tmp = explode(':', $this->type); + $tmp = explode(':', $this->type); - $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); - if ($template<0) { - $this->setErrors($formmail->errors); + $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); + if ($template<0) { + $this->setErrors($formmail->errors); + } + $out.= $this->langs->trans($template->label); } - $out.= $this->langs->trans($template->label); } elseif (preg_match('/category:/', $this->type)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $c = new Categorie($this->db); From c8d0226613ef1f09e2e17a69d3406178d5f6ebae Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 19 Jan 2023 11:24:53 +0100 Subject: [PATCH 13/50] Harmonize CSS for tables in fichehalfleft/fichehalfright --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 43dfbf67869..1592fed7493 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3549,7 +3549,7 @@ td.border, div.tagtable div div.border { } -.fichehalfright table.noborder { +.fichehalfright table.noborder , .fichehalfleft table.noborder{ margin: 0px 0px 0px 0px; } table.liste, table.noborder, table.formdoc, div.noborder { From 9a40c966bd7d4cb67b8f16fbbb97b01d345034b0 Mon Sep 17 00:00:00 2001 From: piernov Date: Thu, 19 Jan 2023 16:25:59 +0100 Subject: [PATCH 14/50] Fix: don setPaid sets paid field When donation is classified as paid, paid field also needs to be set to 1 so that accounting reports show the correct information. --- htdocs/don/class/don.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 181b3fc0ca3..3b09e8cc178 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -758,7 +758,7 @@ class Don extends CommonObject */ public function setPaid($id, $modepayment = 0) { - $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2, paid = 1"; if ($modepayment) { $sql .= ", fk_payment = ".((int) $modepayment); } @@ -768,6 +768,7 @@ class Don extends CommonObject if ($resql) { if ($this->db->affected_rows($resql)) { $this->statut = 2; + $this->paid = 1; return 1; } else { return 0; From 51f1871dd6fa33ca3c569f996dfbd96699e1b109 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 19 Jan 2023 17:09:31 +0100 Subject: [PATCH 15/50] FIX on public ticket list, only the page 1 was accessible. Other pages were 404 error. --- htdocs/public/ticket/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 3c5dfffba17..fa4142ac260 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -211,7 +211,7 @@ if ($action == "view_ticketlist") { $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $filter = array(); - $param = 'action=view_ticketlist'; + $param = '&action=view_ticketlist'; // Definition of fields for list $arrayfields = array( @@ -386,7 +386,7 @@ if ($action == "view_ticketlist") { $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - print_barre_liste($langs->trans('TicketList'), $page, 'public/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket'); + print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket'); // Search bar print '
'."\n"; From f7302232df71d2d276984d4bf4d455ef77af39a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Jan 2023 19:34:26 +0100 Subject: [PATCH 16/50] Fix rounding --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c20f58a943d..0d4e30f4a2a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5743,9 +5743,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ // If force rounding if ((string) $forcerounding != '-1') { - if ($forcerounding == 'MU') { + if ($forcerounding === 'MU') { $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT; - } elseif ($forcerounding == 'MT') { + } elseif ($forcerounding === 'MT') { $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT; } elseif ($forcerounding >= 0) { $nbdecimal = $forcerounding; From 642ba67a55730128a6c9af4f687111266277a498 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 22 Jan 2023 14:21:47 +0100 Subject: [PATCH 17/50] Fix missing include --- htdocs/compta/prelevement/create.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 37a2d74c5e3..7c91bfcca8e 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; From e1c3b61ce80311580b7a1d8167776c2ef4644c22 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 23 Jan 2023 19:36:55 +0100 Subject: [PATCH 18/50] Update llx_10_c_regions.sql add new Slovakia --- htdocs/install/mysql/data/llx_10_c_regions.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 52a1a3bbbb6..f86fbe069b8 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -78,6 +78,7 @@ -- Portugal -- Romania -> for Departmements -- San Salvador +-- Slovakia -- Slovenia -- Spain -- Switzerland/Suisse -> for Departmements/Cantons @@ -450,6 +451,13 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 8 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 86, 8603, NULL, NULL, 'Occidental'); +-- Slovakia Regions (rowid country=201) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20101', 'SK01', NULL, 'Bratislava Region'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20102', 'SK02', NULL, 'Western Slovakia'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20103', 'SK03', NULL, 'Central Slovakia'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 201, '20104', 'SK04', NULL, 'Eastern Slovakia'); + + -- Slovenia Regions (rowid country=202) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20203', 'SI03', NULL, 'East Slovenia'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 202, '20204', 'SI04', NULL, 'West Slovenia'); From c5fcd99f6e92f6228cddc3c998c28b758230dbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= Date: Mon, 23 Jan 2023 19:51:00 +0100 Subject: [PATCH 19/50] Adding a hook addToLandingPageList in userihm context --- htdocs/user/param_ihm.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 3d2e3240ce3..136da34e1bd 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -215,6 +215,16 @@ if (isModEnabled('ticket')) { $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets'; } +// Hook for insertion new items in the List of possible landing pages +$reshook = $hookmanager->executeHooks('addToLandingPageList', $tmparray, $object); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} elseif ($reshook > 0) { + $tmparray=$hookmanager->resArray; +} elseif ($reshook == 0) { + $tmparray=array_merge($tmparray, $hookmanager->resArray); +} + $head = user_prepare_head($object); $title = $langs->trans("User"); From 5ad4f278ca4a77d83bf58652d9f568a751a1f5dc Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 23 Jan 2023 20:26:04 +0100 Subject: [PATCH 20/50] Update list.php update parameters (like /modulebuilder/template/myobject_list.php) --- htdocs/adherents/list.php | 63 +++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index d06d91cbea6..2e04aba9167 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -30,9 +30,9 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -41,47 +41,51 @@ $langs->loadLangs(array("members", "companies")); // Get parameters -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search -$mode = GETPOST('mode', 'alpha'); - +$backtopage = GETPOST('backtopage', 'alpha'); +$optioncss = GETPOST('optioncss', 'aZ'); +$mode = GETPOST('mode', 'alpha'); // Search fields -$search = GETPOST("search", 'alpha'); -$search_ref = GETPOST("search_ref", 'alpha'); -$search_lastname = GETPOST("search_lastname", 'alpha'); -$search_firstname = GETPOST("search_firstname", 'alpha'); -$search_gender = GETPOST("search_gender", 'alpha'); -$search_civility = GETPOST("search_civility", 'alpha'); -$search_company = GETPOST('search_company', 'alphanohtml'); -$search_login = GETPOST("search_login", 'alpha'); -$search_address = GETPOST("search_address", 'alpha'); -$search_zip = GETPOST("search_zip", 'alpha'); -$search_town = GETPOST("search_town", 'alpha'); -$search_state = GETPOST("search_state", 'alpha'); -$search_country = GETPOST("search_country", 'alpha'); -$search_phone = GETPOST("search_phone", 'alpha'); +$search = GETPOST("search", 'alpha'); +$search_ref = GETPOST("search_ref", 'alpha'); +$search_lastname = GETPOST("search_lastname", 'alpha'); +$search_firstname = GETPOST("search_firstname", 'alpha'); +$search_gender = GETPOST("search_gender", 'alpha'); +$search_civility = GETPOST("search_civility", 'alpha'); +$search_company = GETPOST('search_company', 'alphanohtml'); +$search_login = GETPOST("search_login", 'alpha'); +$search_address = GETPOST("search_address", 'alpha'); +$search_zip = GETPOST("search_zip", 'alpha'); +$search_town = GETPOST("search_town", 'alpha'); +$search_state = GETPOST("search_state", 'alpha'); // county / departement / federal state +$search_country = GETPOST("search_country", 'alpha'); +$search_phone = GETPOST("search_phone", 'alpha'); $search_phone_perso = GETPOST("search_phone_perso", 'alpha'); $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha'); -$search_type = GETPOST("search_type", 'alpha'); -$search_email = GETPOST("search_email", 'alpha'); -$search_categ = GETPOST("search_categ", 'int'); -$search_filter = GETPOST("search_filter", 'alpha'); -$search_status = GETPOST("search_status", 'intcomma'); -$search_morphy = GETPOST("search_morphy", 'alpha'); +$search_type = GETPOST("search_type", 'alpha'); +$search_email = GETPOST("search_email", 'alpha'); +$search_categ = GETPOST("search_categ", 'int'); +$search_morphy = GETPOST("search_morphy", 'alpha'); $search_import_key = trim(GETPOST("search_import_key", 'alpha')); -$catid = GETPOST("catid", 'int'); -$optioncss = GETPOST('optioncss', 'alpha'); -$socid = GETPOST('socid', 'int'); + +$catid = GETPOST("catid", 'int'); +$socid = GETPOST('socid', 'int'); + +$search_filter = GETPOST("search_filter", 'alpha'); +$search_status = GETPOST("search_status", 'intcomma'); // statut $filter = GETPOST("filter", 'alpha'); if ($filter) { $search_filter = $filter; // For backward compatibility } + $statut = GETPOST("statut", 'alpha'); if ($statut != '') { $search_status = $statut; // For backward compatibility @@ -93,6 +97,7 @@ if ($search_status < -2) { $search_status = ''; } +// Pagination parameters $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); From 2dcd811e37b1392b91090274e4e03974053878a5 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 23 Jan 2023 20:35:17 +0100 Subject: [PATCH 21/50] Update list.php update parameters --- htdocs/bookmarks/list.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 2adef615a70..3eae08bb60a 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -29,15 +29,18 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; $langs->loadLangs(array('bookmarks', 'admin')); // Get Parameters -$action = GETPOST('action', 'aZ09'); +$id = GETPOST("id", 'int'); + +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search -$id = GETPOST("id", 'int'); -$optioncss = GETPOST('optioncss', 'alpha'); -$mode = GETPOST('mode', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'aZ09'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; From 6cf41da7745a397956d9ab97cef9bb29a6d0c5e8 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 23 Jan 2023 20:41:39 +0100 Subject: [PATCH 22/50] Update list.php --- htdocs/comm/action/list.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 8807ccd4764..a0176ca18b0 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -33,18 +33,22 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + // Load translation files required by the page $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills")); -$action = GETPOST('action', 'aZ09'); +// Get Parameters +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search -$optioncss = GETPOST('optioncss', 'alpha'); -$toselect = GETPOST('toselect', 'array'); -$confirm = GETPOST('confirm', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); + $disabledefaultvalues = GETPOST('disabledefaultvalues', 'int'); @@ -70,6 +74,7 @@ if (GETPOST('search_actioncode', 'array')) { $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } +// Search Fields $search_id = GETPOST('search_id', 'alpha'); $search_title = GETPOST('search_title', 'alpha'); $search_note = GETPOST('search_note', 'alpha'); @@ -106,6 +111,7 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { $filtert = $user->id; } +// Pagination parameters $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); From cd13fcb0af0b687b61d60b416cac1d904ceff030 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 23 Jan 2023 21:04:31 +0100 Subject: [PATCH 23/50] Update list.php --- htdocs/comm/mailing/list.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 6916a2dfe5d..501de4c11cf 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -27,20 +27,24 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; // Load translation files required by the page -$langs->load("mails"); +$langs->load('mails'); -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$optioncss = GETPOST('optioncss', 'alpha'); +// Get Parameters $massaction = GETPOST('massaction', 'alpha'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); + +// Pagination +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + if (!$sortorder) { $sortorder = "DESC"; } @@ -48,10 +52,12 @@ if (!$sortfield) { $sortfield = "m.date_creat"; } +// Search Fields $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha"); $filteremail = GETPOST('filteremail', 'alpha'); +// Initialize objects $object = new Mailing($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -128,7 +134,9 @@ if (empty($reshook)) { * View */ -llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'); +// Page Header +$help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'; +llxHeader('', $langs->trans("Mailing"), $help_url); $form = new Form($db); From 0c30837f154c3089a7562708587d58b6d30edc6c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 23 Jan 2023 21:09:34 +0100 Subject: [PATCH 24/50] Update list.php --- htdocs/comm/propal/list.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index cc5872abb25..93d2298795c 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -62,21 +62,23 @@ if (isModEnabled("expedition")) { $langs->loadLangs(array('sendings')); } +// Get Parameters $socid = GETPOST('socid', 'int'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist'; -$mode = GETPOST('mode', 'alpha'); +$mode = GETPOST('mode', 'alpha'); -$search_user = GETPOST('search_user', 'int'); -$search_sale = GETPOST('search_sale', 'int'); -$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); +// Search Fields +$search_user = GETPOST('search_user', 'int'); +$search_sale = GETPOST('search_sale', 'int'); +$search_ref = GETPOST('sf_ref') ?GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha'); $search_refcustomer = GETPOST('search_refcustomer', 'alpha'); - $search_refproject = GETPOST('search_refproject', 'alpha'); $search_project = GETPOST('search_project', 'alpha'); @@ -140,15 +142,15 @@ $search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int') $search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear); $search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear); - $search_status = GETPOST('search_status', 'alpha'); + $optioncss = GETPOST('optioncss', 'alpha'); $object_statut = GETPOST('search_statut', 'alpha'); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); - +// Pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -263,6 +265,7 @@ foreach ($object->fields as $key => $val) { $fieldstosearchall['t.'.$key] = $val['label']; } }*/ + // Definition of array of fields for columns /*$arrayfields = array(); foreach ($object->fields as $key => $val) { @@ -278,9 +281,11 @@ foreach ($object->fields as $key => $val) { ); } }*/ + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; +// Permissions $permissiontoread = $user->rights->propal->lire; $permissiontoadd = $user->rights->propal->creer; $permissiontodelete = $user->rights->propal->supprimer; From 482c842895e925f547221787f8ce9f8ed0077ec1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 23 Jan 2023 20:15:00 +0000 Subject: [PATCH 25/50] Fixing style errors. --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 93d2298795c..cc507041ac6 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -69,7 +69,7 @@ $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'proposallist'; $mode = GETPOST('mode', 'alpha'); From 25a6be008a199bec10b4eeae055235d2296e946b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 23 Jan 2023 21:34:20 +0100 Subject: [PATCH 26/50] clean code emailcollectorfilter --- .../class/emailcollectorfilter.class.php | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index cff80aa4153..327159f61a4 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -206,16 +206,14 @@ class EmailCollectorFilter extends CommonObject // Clear fields $object->ref = "copy_of_".$object->ref; - $object->title = $langs->trans("CopyOf")." ".$object->title; - // ... + // $object->title = $langs->trans("CopyOf")." ".$object->title; + // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { $extrafields->fetch_name_optionals_label($this->table_element); foreach ($object->array_options as $key => $option) { $shortkey = preg_replace('/options_/', '', $key); if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { - //var_dump($key); - //var_dump($clonedObj->array_options[$key]); exit; unset($object->array_options[$key]); } } @@ -252,26 +250,10 @@ class EmailCollectorFilter extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); - } + return $result; } - /** - * Load object lines in memory from the database - * - * @return int <0 if KO, 0 if not found, >0 if OK - */ - /*public function fetchLines() - { - $this->lines=array(); - - // Load lines with object EmailcollectorFilterLine - - return count($this->lines)?1:0; - }*/ - /** * Update object into database * @@ -317,7 +299,6 @@ class EmailCollectorFilter extends CommonObject } $result = ''; - $companylink = ''; $label = ''.$langs->trans("EmailcollectorFilter").''; $label .= '
'; @@ -468,7 +449,7 @@ class EmailCollectorFilter extends CommonObject $this->user_creation_id = $obj->fk_user_creat; $this->user_modification_id = $obj->fk_user_modif; - $this->date_creation = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); } From d08965c293ecee1409c4720e63bd6d19463d1afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 23 Jan 2023 21:42:09 +0100 Subject: [PATCH 27/50] Update emailcollectoraction.class.php --- .../class/emailcollectoraction.class.php | 60 ++----------------- 1 file changed, 4 insertions(+), 56 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index e43a86da515..5616abbbd35 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -24,8 +24,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for EmailCollectorAction @@ -113,37 +111,6 @@ class EmailCollectorAction extends CommonObject public $status; // END MODULEBUILDER PROPERTIES - - - // If this object has a subtable with lines - - // /** - // * @var string Name of subtable line - // */ - //public $table_element_line = 'emailcollectoractiondet'; - - // /** - // * @var string Field with ID of parent key if this field has a parent - // */ - //public $fk_element = 'fk_emailcollectoraction'; - - // /** - // * @var string Name of subtable class that manage subtable lines - // */ - //public $class_element_line = 'EmailcollectorActionline'; - - // /** - // * @var array List of child tables. To test if we can delete object. - // */ - //protected $childtables=array(); - - // /** - // * @var EmailcollectorActionLine[] Array of subtable lines - // */ - //public $lines = array(); - - - /** * Constructor * @@ -225,16 +192,14 @@ class EmailCollectorAction extends CommonObject // Clear fields $object->ref = "copy_of_".$object->ref; - $object->title = $langs->trans("CopyOf")." ".$object->title; - // ... + // $object->title = $langs->trans("CopyOf")." ".$object->title; + // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { $extrafields->fetch_name_optionals_label($this->table_element); foreach ($object->array_options as $key => $option) { $shortkey = preg_replace('/options_/', '', $key); if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { - //var_dump($key); - //var_dump($clonedObj->array_options[$key]); exit; unset($object->array_options[$key]); } } @@ -271,26 +236,10 @@ class EmailCollectorAction extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - // if ($result > 0 && !empty($this->table_element_line)) { - // $this->fetchLinesCommon(); - // } + return $result; } - /** - * Load object lines in memory from the database - * - * @return int <0 if KO, 0 if not found, >0 if OK - */ - /*public function fetchLines() - { - $this->lines=array(); - - // Load lines with object EmailcollectorActionLine - - return count($this->lines)?1:0; - }*/ - /** * Update object into database * @@ -336,7 +285,6 @@ class EmailCollectorAction extends CommonObject } $result = ''; - $companylink = ''; $label = ''.$langs->trans("EmailcollectorAction").''; $label .= '
'; @@ -487,7 +435,7 @@ class EmailCollectorAction extends CommonObject $this->user_creation_id = $obj->fk_user_creat; $this->user_modification_id = $obj->fk_user_modif; - $this->date_creation = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); } From 124a76029ecdf541c4eef2428aea7a567f1ec497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NASSIET?= Date: Mon, 23 Jan 2023 21:45:28 +0100 Subject: [PATCH 28/50] Protection against deletion of ref_employee and national_registration_number while fields are not presents in the user tab --- htdocs/user/card.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index dbe1764f54e..21e18c94e99 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -417,8 +417,18 @@ if (empty($reshook)) { $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); - $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); - $object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml'); + /* + * Protection against deletion of ref_employee while the field is not present in the user tab + */ + if (GETPOSTISSET("ref_employee")){ + $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); + } + /* + * Protection against deletion of national_registration_number while the field is not present in the user tab + */ + if (GETPOSTISSET("national_registration_number")){ + $object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml'); + } $object->gender = GETPOST("gender", 'aZ09'); $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key; From cade14a80736678fa09c2033581bd1a4cb9c6415 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 23 Jan 2023 21:13:30 +0000 Subject: [PATCH 29/50] Fixing style errors. --- htdocs/user/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 21e18c94e99..688ac6c28ac 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -420,13 +420,13 @@ if (empty($reshook)) { /* * Protection against deletion of ref_employee while the field is not present in the user tab */ - if (GETPOSTISSET("ref_employee")){ + if (GETPOSTISSET("ref_employee")) { $object->ref_employee = GETPOST("ref_employee", 'alphanohtml'); } /* * Protection against deletion of national_registration_number while the field is not present in the user tab */ - if (GETPOSTISSET("national_registration_number")){ + if (GETPOSTISSET("national_registration_number")) { $object->national_registration_number = GETPOST("national_registration_number", 'alphanohtml'); } $object->gender = GETPOST("gender", 'aZ09'); From 01e90a48541973b95743f27a7073a91fee1c07b3 Mon Sep 17 00:00:00 2001 From: David Pareja Rodriguez Date: Tue, 24 Jan 2023 11:04:26 +0100 Subject: [PATCH 30/50] Fix wrong variable used to fetch replaced invoice --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d1cd74099ae..fe952a31893 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2940,7 +2940,7 @@ if ($action == 'create') { } if (isset($objectidnext) && $objectidnext > 0) { $facthatreplace = new FactureFournisseur($db); - $facthatreplace->fetch($facidnext); + $facthatreplace->fetch($objectidnext); print ' ('.$langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)).')'; } if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { From b2ac7a72bee80f7fe1ae197648cb707689db005d Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 24 Jan 2023 11:21:59 +0100 Subject: [PATCH 31/50] FIX simple quote in generated file name from build doc mass action --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 34e2fe8b34e..3c33765c407 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1035,7 +1035,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; } foreach ($listofobjectref as $tmppdf) { - $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files + $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9\-\_\']+\.pdf$'; // To include PDF generated from ODX files } $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); From c463f0972d9577fb1833f549326782fd854c20a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jan 2023 12:15:57 +0100 Subject: [PATCH 32/50] Clean code --- htdocs/accountancy/customer/list.php | 5 ++--- htdocs/accountancy/expensereport/list.php | 3 +-- htdocs/accountancy/supplier/list.php | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 021c1ec7821..a4a12b97b98 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -43,10 +43,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancycustomerlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); + $default_account = GETPOST('default_account', 'int'); // Select Box @@ -73,8 +74,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); -$btn_ventil = GETPOST('ventil', 'alpha'); - // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 25b86a8d527..39508332d40 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -40,10 +40,9 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'expensereportlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancyexpensereportlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 3b8e93cb54b..dfd8af7f68f 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -44,10 +44,11 @@ $langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); -$show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'accountancysupplierlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); + $default_account = GETPOST('default_account', 'int'); // Select Box @@ -75,8 +76,6 @@ $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_en $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); -$btn_ventil = GETPOST('ventil', 'alpha'); - // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $sortfield = GETPOST('sortfield', 'aZ09comma'); From 5b5a3547e29a870ed6fed0485e8384df33ea72df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jan 2023 13:00:09 +0100 Subject: [PATCH 33/50] Debug v17 --- .../class/accountingaccount.class.php | 4 +++- htdocs/accountancy/customer/list.php | 19 +++++++++++++------ htdocs/accountancy/expensereport/index.php | 18 +++++++++++++----- htdocs/accountancy/expensereport/list.php | 4 ++-- htdocs/accountancy/supplier/list.php | 15 ++++++++++----- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/langs/en_US/accountancy.lang | 9 +++++---- 8 files changed, 49 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 94ee1ac6029..8e5f7690dd1 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -723,7 +723,7 @@ class AccountingAccount extends CommonObject } /** - * Return Suggest accounting accounts to bind + * Return a suggested account (from chart of accounts) to bind * * @param Societe $buyer Object buyer * @param Societe $seller Object seller @@ -733,6 +733,8 @@ class AccountingAccount extends CommonObject * @param array $accountingAccount Array of Accounting account * @param string $type Customer / Supplier * @return array|int Accounting accounts suggested or < 0 if technical error. + * 'suggestedaccountingaccountbydefaultfor'=>Will be used for the label to show on tooltip for account by default on any product + * 'suggestedaccountingaccountfor'=>Is the account suggested for this product */ public function getAccountingCodeToBind(Societe $buyer, Societe $seller, Product $product, $facture, $factureDet, $accountingAccount = array(), $type = '') { diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index a4a12b97b98..35be32d6b34 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -519,8 +519,8 @@ if ($result) { print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); - print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall '); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center '); $checkpicto = ''; if ($massactionbutton) { $checkpicto = $form->showCheckAddButtons('checkforselect', 1); @@ -639,7 +639,7 @@ if ($result) { print ''.dol_print_date($facture_static->date, 'day').''; // Ref Product - print ''; + print ''; if ($product_static->id > 0) { print $product_static->getNomUrl(1); } @@ -648,7 +648,7 @@ if ($result) { } print ''; - // Description + // Description of line print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1)); $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; @@ -682,15 +682,22 @@ if ($result) { // Found accounts print ''; + // First show default account for any products $s = '1. '.(($facture_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; - $shelp = ''; + $shelp = ''; $ttype = 'help'; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); + } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') { + $shelp = $langs->trans("SaleEECWithVAT"); + } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') { + $shelp = $langs->trans("SaleEECWithoutVATNumber"); + $ttype = 'warning'; } elseif ($suggestedaccountingaccountbydefaultfor == 'export') { $shelp .= $langs->trans("SaleExport"); } $s .= ($code_sell_l > 0 ? length_accountg($code_sell_l) : ''.$langs->trans("NotDefined").''); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); + // Now show account for product if ($product_static->id > 0) { print '
'; $s = '2. '.(($facture_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 5064003c7ff..948130dd98a 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -58,6 +58,8 @@ $year_current = $year_start; // Validate History $action = GETPOST('action', 'aZ09'); +$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); + // Security check if (!isModEnabled('accounting')) { accessforbidden(); @@ -65,7 +67,7 @@ if (!isModEnabled('accounting')) { if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->mouvements->lire)) { +if (!$user->hasRight('accounting', 'mouvements', 'lire')) { accessforbidden(); } @@ -74,7 +76,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { * Actions */ -if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { +if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) { // Clean database $db->begin(); $sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd"; @@ -109,8 +111,7 @@ if ($action == 'validatehistory') { $sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid"; $sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd"; $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id"; - $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity); - $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,'; + $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND accnt.entity =".((int) $conf->entity); $sql1 .= " ".MAIN_DB_PREFIX."expensereport as er"; $sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity); $sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; @@ -176,6 +177,7 @@ llxHeader('', $langs->trans("ExpenseReportsVentilation")); $textprevyear = ''.img_previous().''; $textnextyear = ' '.img_next().''; + print load_fiche_titre($langs->trans("ExpenseReportsVentilation")." ".$textprevyear." ".$langs->trans("Year")." ".$year_start." ".$textnextyear, '', 'title_accountancy'); print ''.$langs->trans("DescVentilExpenseReport").'
'; @@ -247,7 +249,7 @@ $sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= ' ORDER BY aa.account_number'; -dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql); +dol_syslog('/accountancy/expensereport/index.php', LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -277,6 +279,12 @@ if ($resql) { print ''; } $db->free($resql); + + if ($num == 0) { + print ''; + print ''.$langs->trans("NoRecordFound").''; + print ''; + } } else { print $db->lasterror(); // Show last sql error } diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 39508332d40..1cf9149024a 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -418,8 +418,8 @@ if ($result) { print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); - print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', ''); + print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall '); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', ''); $checkpicto = ''; if ($massactionbutton) { $checkpicto = $form->showCheckAddButtons('checkforselect', 1); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index dfd8af7f68f..aae34a51e03 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -111,7 +111,7 @@ if (!isModEnabled('accounting')) { if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->mouvements->lire)) { +if (!$user->hasRight('accounting', 'mouvements', 'lire')) { accessforbidden(); } @@ -531,8 +531,8 @@ if ($result) { print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntraShort", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall '); - print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre("DataUsedToSuggestAccount", '', '', '', '', '', '', '', 'nowraponall '); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center '); $checkpicto = ''; if ($massactionbutton) { $checkpicto = $form->showCheckAddButtons('checkforselect', 1); @@ -711,14 +711,19 @@ if ($result) { // Found accounts print ''; $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; - $shelp = ''; + $shelp = ''; $ttype = 'help'; if ($suggestedaccountingaccountbydefaultfor == 'eec') { $shelp .= $langs->trans("SaleEEC"); + } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithvat') { + $shelp = $langs->trans("SaleEECWithVAT"); + } elseif ($suggestedaccountingaccountbydefaultfor == 'eecwithoutvatnumber') { + $shelp = $langs->trans("SaleEECWithoutVATNumber"); + $ttype = 'warning'; } elseif ($suggestedaccountingaccountbydefaultfor == 'export') { $shelp .= $langs->trans("SaleExport"); } $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : ''.$langs->trans("NotDefined").''); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); if ($product_static->id > 0) { print '
'; $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1bdad2ed3c5..52f91f86963 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6273,7 +6273,7 @@ class Form if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { // If option to have vat for end customer for services is on require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) { - // We also add the buyer + // We also add the buyer country code if (is_numeric($type)) { if ($type == 1) { // We know product is a service $code_country .= ",'".$societe_acheteuse->country_code."'"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0d4e30f4a2a..6bfc788ddd4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6490,7 +6490,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { if ($seller_in_cee && $buyer_in_cee) { $isacompany = $thirdparty_buyer->isACompany(); - if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { + if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (!isValidVATID($thirdparty_buyer)) { $isacompany = 0; @@ -6526,7 +6526,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, // Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle if (($seller_in_cee && $buyer_in_cee)) { $isacompany = $thirdparty_buyer->isACompany(); - if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { + if ($isacompany && getDolGlobalString('MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (!isValidVATID($thirdparty_buyer)) { $isacompany = 0; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 5a1e51a2269..d44c86ceccd 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -14,8 +14,8 @@ ACCOUNTING_EXPORT_ENDLINE=Select the carriage return type ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name ThisService=This service ThisProduct=This product -DefaultForService=Default for service -DefaultForProduct=Default for product +DefaultForService=Default for services +DefaultForProduct=Default for products ProductForThisThirdparty=Product for this thirdparty ServiceForThisThirdparty=Service for this thirdparty CantSuggest=Can't suggest @@ -101,7 +101,8 @@ ShowAccountingAccount=Show accounting account ShowAccountingJournal=Show accounting journal ShowAccountingAccountInLedger=Show accounting account in ledger ShowAccountingAccountInJournals=Show accounting account in journals -AccountAccountingSuggest=Accounting account suggested +DataUsedToSuggestAccount=Data used to suggest account +AccountAccountingSuggest=Account suggested MenuDefaultAccounts=Default accounts MenuBankAccounts=Bank accounts MenuVatAccounts=Vat accounts @@ -401,7 +402,7 @@ SaleLocal=Local sale SaleExport=Export sale SaleEEC=Sale in EEC SaleEECWithVAT=Sale in EEC with a VAT not null, so we suppose this is NOT an intracommunautary sale and the suggested account is the standard product account. -SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of thirdparty is not defined. We fallback on the product account for standard sales. You can fix the VAT ID of thirdparty or the product account if needed. +SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of thirdparty is not defined. We fall back on the account for standard sales. You can fix the VAT ID of the thirdparty, or change the product account suggested for binding if needed. ForbiddenTransactionAlreadyExported=Forbidden: The transaction has been validated and/or exported. ForbiddenTransactionAlreadyValidated=Forbidden: The transaction has been validated. ## Dictionary From b964f1a4761c8adf2de08162ced6cc50f2167e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Tue, 24 Jan 2023 14:21:14 +0100 Subject: [PATCH 34/50] FIX: page was not reloaded after addline causing a new lline creation was page was reloaded --- htdocs/expensereport/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 31cf21c34ae..3f0541c89b4 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1161,8 +1161,9 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - - $action = ''; + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); + exit; } if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { From 08bd8caaf255fe5ec08dc9608238d9e99334d8b0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 24 Jan 2023 13:28:59 +0000 Subject: [PATCH 35/50] Fixing style errors. --- htdocs/expensereport/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 3f0541c89b4..0756cb1bc7f 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1161,9 +1161,9 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - - header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); - exit; + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); + exit; } if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { From 32da192db44a043b6d8e32f1b3339c5f9964289b Mon Sep 17 00:00:00 2001 From: hystepik Date: Tue, 24 Jan 2023 14:32:20 +0100 Subject: [PATCH 36/50] fix : php 8.1 warnings --- htdocs/compta/localtax/card.php | 5 ++++- htdocs/contrat/services_list.php | 3 +++ htdocs/loan/card.php | 5 +++-- htdocs/loan/list.php | 2 ++ htdocs/product/card.php | 2 +- htdocs/product/reassort.php | 2 +- htdocs/reception/contact.php | 2 +- htdocs/salaries/payments.php | 9 ++++++++- 8 files changed, 23 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 8b6119db13a..ad80b6d1b6d 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -144,9 +144,12 @@ $form = new Form($db); $title = $langs->trans("LT".$object->ltt)." - ".$langs->trans("Card"); $help_url = ''; -llxHeader('', $title, $helpurl); +llxHeader('', $title, $help_url); if ($action == 'create') { + $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear")); + $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear")); + print load_fiche_titre($langs->transcountry($lttype == 2 ? "newLT2Payment" : "newLT1Payment", $mysoc->country_code)); print ''."\n"; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index fb50283991b..d42dc70f49a 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -822,6 +822,9 @@ while ($i < min($num, $limit)) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'cd.qty'; } + if (!$i) { + $totalarray['val']['cd.qty'] = $obj->qty; + } $totalarray['val']['cd.qty'] += $obj->qty; } if (!empty($arrayfields['cd.total_ht']['checked'])) { diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index a45577b6608..afa7aa5eaa8 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -66,6 +66,7 @@ $error = 0; * Actions */ +$parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -291,13 +292,13 @@ if ($action == 'create') { // Date Start print ""; print ''.$langs->trans("DateStart").''; - print $form->selectDate($datestart ? $datestart : -1, 'start', '', '', '', 'add', 1, 1); + print $form->selectDate(!empty($datestart) ? $datestart : -1, 'start', '', '', '', 'add', 1, 1); print ''; // Date End print ""; print ''.$langs->trans("DateEnd").''; - print $form->selectDate($dateend ? $dateend : -1, 'end', '', '', '', 'add', 1, 1); + print $form->selectDate(!empty($dateend) ? $dateend : -1, 'end', '', '', '', 'add', 1, 1); print ''; // Number of terms diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 1225f5304be..b664d784e7e 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -42,6 +42,7 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$massaction = GETPOST('massaction', 'alpha'); if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action @@ -148,6 +149,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { } $db->free($resql); } +$arrayfields = array(); // Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8a5aecf1513..ac465b16bd7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1485,7 +1485,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } } - if ($type == 1 && $conf->workstation->enabled) { + if ($type == 1 && isModEnabled("workstation")) { // Default workstation print ''.$langs->trans("DefaultWorkstation").''; print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 10581d19b7c..9946e7a9077 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -133,7 +133,7 @@ $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; $form = new Form($db); $htmlother = new FormOther($db); -if ($objp->stock_physique < 0) { print ''; } +if (!empty($objp->stock_physique) && $objp->stock_physique < 0) { print ''; } $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql .= ' p.fk_product_type, p.tms as datem,'; diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 02cbc9af957..11ab664c6c0 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -72,7 +72,7 @@ if ($origin == 'reception') { } else { if ($origin == 'supplierorder' || $origin == 'order_supplier') { $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); - } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) { + } elseif (empty($user->hasRight($origin, "lire")) && empty($user->hasRight($origin, "read"))) { accessforbidden(); } } diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 5a5ccb08bf6..7bf61f3021f 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -97,6 +97,7 @@ $search_chq_number = GETPOST('search_chq_number', 'int'); $filtre = GETPOST("filtre", 'restricthtml'); +$search_type_id = ''; if (!GETPOST('search_type_id', 'int')) { $newfiltre = str_replace('filtre=', '', $filtre); $filterarray = explode('-', $newfiltre); @@ -532,6 +533,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $total = 0; $totalarray = array(); +$totalarray['nbfield'] = 0; while ($i < ($limit ? min($num, $limit) : $num)) { $obj = $db->fetch_object($resql); if (empty($obj)) { @@ -697,7 +699,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; } - $totalarray['val']['totalttcfield'] += $obj->amount; + if (!$i) { + $totalarray['val']['totalttcfield'] = $obj->amount; + } else { + $totalarray['val']['totalttcfield'] += $obj->amount; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; From fe6d9730cdd8c2cc44749b56fed71401e4de9322 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jan 2023 16:58:35 +0100 Subject: [PATCH 37/50] Fix messages to avoid confusion. --- htdocs/accountancy/bookkeeping/list.php | 11 +++++++---- htdocs/langs/en_US/accountancy.lang | 2 ++ htdocs/langs/en_US/main.lang | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index fa42b5bd6fd..983da7502d9 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -474,7 +474,7 @@ if (empty($reshook)) { if ($conf->global->ACCOUNTING_REEXPORT == 1) { setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs'); } else { - setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs'); + setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings'); } } else { setEventMessages($langs->trans("Error"), null, 'errors'); @@ -953,11 +953,14 @@ $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; if (empty($reshook)) { // Button re-export if (!empty($conf->global->ACCOUNTING_REEXPORT)) { - $newcardbutton .= ''.img_picto($langs->trans("Activated"), 'switch_on').' '; + $newcardbutton .= ''.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"'); + $newcardbutton .= ''.$langs->trans("ClickToHideAlreadyExportedLines").''; + $newcardbutton .= ''; } else { - $newcardbutton .= ''.img_picto($langs->trans("Disabled"), 'switch_off').' '; + $newcardbutton .= ''.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"').''; + $newcardbutton .= ''.$langs->trans("DocsAlreadyExportedAreExcluded").''; + $newcardbutton .= ''; } - $newcardbutton .= ''.$langs->trans("IncludeDocsAlreadyExported").''; if ($user->hasRight('accounting', 'mouvements', 'export')) { $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : ''), $user->hasRight('accounting', 'mouvements', 'export')); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index d44c86ceccd..801618352aa 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -472,5 +472,7 @@ FECFormatMulticurrencyCode=Multicurrency code (Idevise) DateExport=Date export WarningReportNotReliable=Warning, this report is not based on the Ledger, so does not contains transaction modified manually in the Ledger. If your journalization is up to date, the bookkeeping view is more accurate. ExpenseReportJournal=Expense Report Journal +DocsAlreadyExportedAreExcluded=Docs already exported are excluded +ClickToHideAlreadyExportedLines=Click to hide already exported lines NAccounts=%s accounts diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 73dfee80a69..45119814420 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -912,8 +912,8 @@ ExportFilteredList=Export filtered list ExportList=Export list ExportOptions=Export Options IncludeDocsAlreadyExported=Include docs already exported -ExportOfPiecesAlreadyExportedIsEnable=Export of pieces already exported is enable -ExportOfPiecesAlreadyExportedIsDisable=Export of pieces already exported is disable +ExportOfPiecesAlreadyExportedIsEnable=Documents already exported are visible and will be exported +ExportOfPiecesAlreadyExportedIsDisable=Documents already exported are hidden and won't be exported AllExportedMovementsWereRecordedAsExported=All exported movements were recorded as exported NotAllExportedMovementsCouldBeRecordedAsExported=Not all exported movements could be recorded as exported Miscellaneous=Miscellaneous From 891ba8f4ef6362639710058bc0d2f7242ef9fdea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jan 2023 17:05:42 +0100 Subject: [PATCH 38/50] Debug v17 --- htdocs/core/class/conf.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 279ccded71c..2d6cc4f5715 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -783,6 +783,11 @@ class Conf $this->global->USE_STRICT_CSV_RULES = 2; } + // By default, option is on. Once set by user, this code is useless + if (!isset($this->global->ACCOUNTING_REEXPORT)) { + $this->global->ACCOUNTING_REEXPORT = 1; + } + // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined) if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) { $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1; From 5429882147db304bd3fa533f443e6436a79290d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jan 2023 18:23:46 +0100 Subject: [PATCH 39/50] Debug v17 --- htdocs/accountancy/bookkeeping/list.php | 7 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/hrm/job_list.php | 290 +++++++++++++++--------- 3 files changed, 182 insertions(+), 117 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 983da7502d9..086a5acd918 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -994,7 +994,7 @@ if ($massaction == 'preunletteringauto') { include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields if ($massactionbutton && $contextpage != 'poslist') { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } @@ -1010,7 +1010,7 @@ if (empty($reshook)) { } print '
'; -print ''; +print '
'; // Filters lines print ''; @@ -1166,8 +1166,7 @@ print "\n"; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); -} + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');} if (!empty($arrayfields['t.piece_num']['checked'])) { print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6bfc788ddd4..4d38c7e5e5d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4085,7 +4085,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice', 'edit', 'ellipsis-h', 'email', 'entity', 'envelope', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'eye', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', - 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', + 'gears', 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'help', 'holiday', 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right', diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index ed0fb480a3a..6cb1a4bf62c 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -115,11 +115,11 @@ $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) { - $visible = (int) dol_eval($val['visible'], 1, 1, '1'); + $visible = (int) dol_eval($val['visible'], 1); $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), + 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -136,18 +136,15 @@ $permissiontoread = $user->rights->hrm->all->read; $permissiontoadd = $user->rights->hrm->all->write; $permissiontodelete = $user->rights->hrm->all->delete; -// Security check -if (empty($conf->hrm->enabled)) { - accessforbidden('Module not enabled'); -} - // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden(); //$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +if (!isModEnabled('hrm')) { + accessforbidden('Module hrm not enabled'); +} if (!$permissiontoread) accessforbidden(); @@ -256,17 +253,17 @@ foreach ($search as $key => $val) { $mode_search = 2; } if ($search[$key] != '') { - $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); + $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search)); } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; } } } @@ -286,7 +283,7 @@ $sql .= $hookmanager->resPrint; /* If a group by is required $sql .= " GROUP BY "; foreach($object->fields as $key => $val) { - $sql .= "t.".$key.", "; + $sql .= "t.".$db->escape($key).", "; } // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -301,8 +298,6 @@ $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); */ -$sql .= $db->order($sortfield, $sortorder); - // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -312,24 +307,24 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { - $num = $nbtotalofrecords; -} else { - if ($limit) { - $sql .= $db->plimit($limit + 1, $offset); - } - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); +// Complete request and execute it with limit +$sql .= $db->order($sortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); } +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + + // Direct jump if only one record found if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); @@ -362,6 +357,9 @@ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -369,11 +367,17 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { - $param .= '&search_'.$key.'[]='.urlencode($skey); + if ($skey != '') { + $param .= '&search_'.$key.'[]='.urlencode($skey); + } } - } else { + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); + } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } @@ -394,7 +398,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -413,6 +417,7 @@ print ''; print ''; print ''; print ''; +print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/job_card.php', 1).'?action=create', '', $permissiontoadd); @@ -426,9 +431,12 @@ $trackid = 'xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } + print ''."\n"; print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } @@ -452,7 +460,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -462,7 +470,15 @@ print '
'; +// Action column +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} foreach ($object->fields as $key => $val) { + $searchkey = empty($search[$key]) ? '' : $search[$key]; $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -470,7 +486,7 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { @@ -478,9 +494,7 @@ foreach ($object->fields as $key => $val) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); - } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - print ''; + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth125', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
'; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -488,6 +502,12 @@ foreach ($object->fields as $key => $val) { print '
'; print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; + } elseif ($key == 'lang') { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin = new FormAdmin($db); + print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2); + } else { + print ''; } print ''; } @@ -500,16 +520,23 @@ $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print '
'; +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; +} print ''."\n"; +$totalarray = array(); +$totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -518,21 +545,26 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + $totalarray['nbfield']++; } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} +$totalarray['nbfield']++; print ''."\n"; @@ -550,9 +582,11 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // Loop on record // -------------------------------------------------------------------- $i = 0; +$savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -while ($i < ($limit ? min($num, $limit) : $num)) { +$imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { break; // Should not happen @@ -561,77 +595,109 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); - // Show here line of result - print ''; - foreach ($object->fields as $key => $val) { - $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); - if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; - } elseif ($key == 'status') { - $cssforfield .= ($cssforfield ? ' ' : '').'center'; + if ($mode == 'kanban') { + if ($i == 0) { + print ''; } - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { - $cssforfield .= ($cssforfield ? ' ' : '').'right'; - } - //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; - - if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; - if ($key == 'status') { - print $object->getLibStatut(5); - } elseif ($key == 'rowid') { - print $object->showOutputField($val, $key, $object->id, ''); - } elseif ($key == 'label') { - print $object->getNomUrl(1); - } else { - print $object->showOutputField($val, $key, $object->$key, ''); + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; - if (!$i) { - $totalarray['nbfield']++; - } - if (!empty($val['isameasure']) && $val['isameasure'] == 1) { - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; - } - if (!isset($totalarray['val'])) { - $totalarray['val'] = array(); - } - if (!isset($totalarray['val']['t.'.$key])) { - $totalarray['val']['t.'.$key] = 0; - } - $totalarray['val']['t.'.$key] += $object->$key; - } } - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Action column - print ''; - if (!$i) { - $totalarray['nbfield']++; - } + foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } elseif ($key == 'status') { + $cssforfield .= ($cssforfield ? ' ' : '').'center'; + } - print ''."\n"; + if (in_array($val['type'], array('timestamp'))) { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } elseif ($key == 'ref') { + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + } + + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + $cssforfield .= ($cssforfield ? ' ' : '').'right'; + } + //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; + + if (!empty($arrayfields['t.'.$key]['checked'])) { + print ''; + if ($key == 'status') { + print $object->getLibStatut(5); + } elseif ($key == 'rowid') { + print $object->showOutputField($val, $key, $object->id, ''); + } elseif ($key == 'label') { + print $object->getNomUrl(1); + } else { + print $object->showOutputField($val, $key, $object->$key, ''); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + if (!empty($val['isameasure']) && $val['isameasure'] == 1) { + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; + } + if (!isset($totalarray['val'])) { + $totalarray['val'] = array(); + } + if (!isset($totalarray['val']['t.'.$key])) { + $totalarray['val']['t.'.$key] = 0; + } + $totalarray['val']['t.'.$key] += $object->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print ''; + } + if (!$i) { + $totalarray['nbfield']++; + } + + print ''."\n"; + } $i++; } @@ -647,14 +713,14 @@ if ($num == 0) { $colspan++; } } - print ''; + print ''; } $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; + print '
'; } - - if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + // Output Kanban + print $object->getKanbanView(''); + if ($i == ($imaxinloop - 1)) { + print '
'; + 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($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; } 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($object->id, $arrayofselected)) { - $selected = 1; - } - print ''; - } - 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($object->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'.$langs->trans("NoRecordFound").'
'.$langs->trans("NoRecordFound").'
'."\n"; From e8c2c6b6999f2ef060565c92f0e971d1de0a2ca5 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Wed, 25 Jan 2023 15:28:34 +0100 Subject: [PATCH 40/50] FIX: Rights on action for payments by bank transfer --- htdocs/compta/prelevement/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index c9f90b8b240..33a4409bac9 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -272,7 +272,7 @@ if ($id > 0 || $ref) { print $formconfirm; - if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action == 'settransmitted') { + if (empty($object->date_trans) && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer')) && $action == 'settransmitted') { print ''; print ''; print ''; @@ -291,7 +291,7 @@ if ($id > 0 || $ref) { print '
'; } - if (!empty($object->date_trans) && empty($object->date_credit) && $user->rights->prelevement->bons->credit && $action == 'setcredited') { + if (!empty($object->date_trans) && empty($object->date_credit) && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer')) && $action == 'setcredited') { $btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited"); print ''; print ''; From 79b7b106fc1f1fdf6baf93bb5c1fe42c9a7c8c14 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 25 Jan 2023 15:35:09 +0100 Subject: [PATCH 41/50] FIX - PHP8 Warnning admin commande --- htdocs/admin/commande.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 79c42f6e2db..20064ca099c 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -117,7 +117,7 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - if ($conf->global->COMMANDE_ADDON_PDF == "$value") { + if (getDolGlobalString('COMMANDE_ADDON_PDF') == $value) { dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity); } } From 4e289bf5baf343a10db140561e8b90587aa0fa2a Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 25 Jan 2023 15:36:47 +0100 Subject: [PATCH 42/50] next --- htdocs/admin/commande.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 20064ca099c..b366ea928ef 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -461,7 +461,7 @@ foreach ($dirmodels as $reldir) { // Default print ''; - if ($conf->global->COMMANDE_ADDON_PDF == $name) { + if (getDolGlobalString('COMMANDE_ADDON_PDF') == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; From 8c7f0e8e93739e2781d3cce2ab9a8ed8fe7f5efe Mon Sep 17 00:00:00 2001 From: hystepik Date: Wed, 25 Jan 2023 16:06:41 +0100 Subject: [PATCH 43/50] fix travis --- htdocs/reception/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index 11ab664c6c0..97d6d19a4f9 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -72,7 +72,7 @@ if ($origin == 'reception') { } else { if ($origin == 'supplierorder' || $origin == 'order_supplier') { $result = restrictedArea($user, 'fournisseur', $origin_id, 'commande_fournisseur', 'commande'); - } elseif (empty($user->hasRight($origin, "lire")) && empty($user->hasRight($origin, "read"))) { + } elseif (!$user->hasRight($origin, "lire") && !$user->hasRight($origin, "read")) { accessforbidden(); } } From 1d5e2bd0256a3c2ea3b204a3a0b8fd304d8c826c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 25 Jan 2023 16:39:45 +0100 Subject: [PATCH 44/50] fix : Warning: Undefined array key xStartPos in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/class/commondocgenerator.class.php on line 1109 --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 7c136f446d9..b4eddcc252f 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1104,7 +1104,7 @@ abstract class CommonDocGenerator public function getColumnContentXStart($colKey) { $colDef = $this->cols[$colKey]; - return $colDef['xStartPos'] + $colDef['content']['padding'][3]; + return (isset($colDef['xStartPos']) ? $colDef['xStartPos'] : 0) + $colDef['content']['padding'][3]; } /** From 3d814ac3d3fb6982e6b5cc391d721827746b64f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Jan 2023 16:38:05 +0100 Subject: [PATCH 45/50] Debug set/edit date/end of contrat lines --- htdocs/contrat/card.php | 61 +++++++++++--------------- htdocs/contrat/class/contrat.class.php | 14 +++--- 2 files changed, 32 insertions(+), 43 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index db501e113fb..6b3937df76a 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -143,7 +143,16 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer) { - $result = $object->active_line($user, GETPOST('ligne', 'int'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment')); + $date_start = ''; + $date_end = ''; + if (GETPOST('startmonth') && GETPOST('startday') && GETPOST('startyear')) { + $date_start = dol_mktime(GETPOST('starthour'), GETPOST('startmin'), 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear')); + } + if (GETPOST('endmonth') && GETPOST('endday') && GETPOST('endyear')) { + $date_end = dol_mktime(GETPOST('endhour'), GETPOST('endmin'), 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + } + + $result = $object->active_line($user, GETPOST('ligne', 'int'), $date_start, $date_end, GETPOST('comment')); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); @@ -152,12 +161,16 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) { - if (!GETPOST('dateend')) { + $date_end = ''; + if (GETPOST('endmonth') && GETPOST('endday') && GETPOST('endyear')) { + $date_end = dol_mktime(GETPOST('endhour'), GETPOST('endmin'), 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); + } + if (!$date_end) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors'); } if (!$error) { - $result = $object->close_line($user, GETPOST('ligne', 'int'), GETPOST('dateend'), urldecode(GETPOST('comment'))); + $result = $object->close_line($user, GETPOST('ligne', 'int'), $date_end, urldecode(GETPOST('comment'))); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; @@ -1837,34 +1850,6 @@ if ($action == 'create') { print '
'; } - /* - * Confirmation de la validation activation - */ - if ($action == 'active' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) { - $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - $comment = GETPOST('comment', 'alpha'); - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("ActivateService"), $langs->trans("ConfirmActivateService", dol_print_date($dateactstart, "%A %d %B %Y")), "confirm_active", '', 0, 1); - print '
'; - } - - /* - * Confirmation de la validation fermeture - */ - if ($action == 'closeline' && !$cancel && $user->rights->contrat->activer && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) { - $dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - $dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - $comment = GETPOST('comment', 'alpha'); - - if (empty($dateactend)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEndReal")), null, 'errors'); - } else { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService", dol_print_date($dateactend, "%A %d %B %Y")), "confirm_closeline", '', 0, 1); - } - print '
'; - } - - // Area with status and activation info of line if ($object->statut > 0) { print ''; @@ -1930,8 +1915,12 @@ if ($action == 'create') { // Form to activate line if ($user->rights->contrat->activer && $action == 'activateline' && $object->lines[$cursorline - 1]->id == GETPOST('ligne', 'int')) { - print ''; + print ''; print ''; + print ''; + print ''; + print ''; + print ''; print '
'; @@ -1956,7 +1945,7 @@ if ($action == 'create') { print ''; print ''; print '
'.$langs->trans("DateServiceActivate").''; - print $form->selectDate($dateactstart, '', $usehm, $usehm, '', "active", 1, 0); + print $form->selectDate($dateactstart, 'start', $usehm, $usehm, '', "active", 1, 0); print ''.$langs->trans("DateEndPlanned").''; print $form->selectDate($dateactend, "end", $usehm, $usehm, '', "active", 1, 0); @@ -1984,10 +1973,10 @@ if ($action == 'create') { * Disable a contract line */ print ''."\n"; - print ''; - + print ''; print ''; - print ''; + print ''; + print ''; print ''; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 486a647fb68..1e8f0e1f7e5 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -320,15 +320,15 @@ class Contrat extends CommonObject * * @param User $user Objet User who activate contract * @param int $line_id Id of line to activate - * @param int $date Opening date + * @param int $date_start Opening date * @param int|string $date_end Expected end date * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - public function active_line($user, $line_id, $date, $date_end = '', $comment = '') + public function active_line($user, $line_id, $date_start, $date_end = '', $comment = '') { // phpcs:enable - $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); + $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date_start, $date_end, $comment); if ($result < 0) { $this->error = $this->lines[$this->lines_id_index_mapper[$line_id]]->error; $this->errors = $this->lines[$this->lines_id_index_mapper[$line_id]]->errors; @@ -3554,7 +3554,7 @@ class ContratLigne extends CommonObjectLine * Activate a contract line * * @param User $user Objet User who activate contract - * @param int $date Date activation + * @param int $date Date real activation * @param int|string $date_end Date planned end. Use '-1' to keep it unchanged. * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK @@ -3569,13 +3569,13 @@ class ContratLigne extends CommonObjectLine $this->db->begin(); $this->statut = ContratLigne::STATUS_OPEN; - $this->date_start = $date; + $this->date_start_real = $date; $this->date_end = $date_end; $this->fk_user_ouverture = $user->id; $this->date_end_real = null; $this->commentaire = $comment; - $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".$this->statut.","; + $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".((int) $this->statut).","; $sql .= " date_ouverture = ".(dol_strlen($this->date_start_real) != 0 ? "'".$this->db->idate($this->date_start_real)."'" : "null").","; if ($date_end >= 0) { $sql .= " date_fin_validite = ".(dol_strlen($this->date_end) != 0 ? "'".$this->db->idate($this->date_end)."'" : "null").","; @@ -3614,7 +3614,7 @@ class ContratLigne extends CommonObjectLine * Close a contract line * * @param User $user Objet User who close contract - * @param int $date_end_real Date end + * @param int $date_end_real Date end * @param string $comment A comment typed by user * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK From d8ce744e4c4dc70c897775203f56f1c28c1ce588 Mon Sep 17 00:00:00 2001 From: hystepik Date: Wed, 25 Jan 2023 16:56:27 +0100 Subject: [PATCH 46/50] New : Export for module ticket --- htdocs/core/modules/modTicket.class.php | 28 +++++++++++++++++++++++++ htdocs/langs/en_US/ticket.lang | 3 +++ 2 files changed, 31 insertions(+) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 37e6552af2f..ff80385235f 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -208,6 +208,13 @@ class modTicket extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'manage'; + $r++; + $this->rights[$r][0] = 56006; // id de la permission + $this->rights[$r][1] = "Export ticket"; // libelle de la permission + //$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'export'; + /* Seems not used and in conflict with societe->client->voir (see all thirdparties) $r++; $this->rights[$r][0] = 56005; // id de la permission @@ -318,6 +325,27 @@ class modTicket extends DolibarrModules 'target' => '', 'user' => 0); $r++; + + // Exports + //-------- + $r = 1; + + // Export list of tickets and attributes + $langs->load("ticket"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r] = array(array("ticket", "export")); + $this->export_icon[$r]='ticket'; + $keyforclass = 'Ticket';$keyforclassfile='/ticket/class/ticket.class.php';$keyforelement='ticket'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $keyforselect='ticket'; $keyforaliasextra='extra'; $keyforelement='ticket'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'ticket as t'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'ticket_extrafields as extra on (t.rowid = extra.fk_object)'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('ticket').')'; + $r++; } /** diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index ea560012afc..de54d475591 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -26,6 +26,7 @@ Permission56002=Modify tickets Permission56003=Delete tickets Permission56004=Manage tickets Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on) +Permission56006=Export tickets Tickets=Tickets TicketDictType=Ticket - Types @@ -61,6 +62,8 @@ TypeContact_ticket_external_CONTRIBUTOR=External contributor OriginEmail=Reporter Email Notify_TICKET_SENTBYMAIL=Send ticket message by email +ExportDataset_ticket_1=Tickets + # Status Read=Read Assigned=Assigned From 934bcc72c489799d451f0c49642728460bed1880 Mon Sep 17 00:00:00 2001 From: GregM Date: Wed, 25 Jan 2023 17:34:57 +0100 Subject: [PATCH 47/50] update space --- htdocs/core/class/html.formsetup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 0c9adf0be59..a7fb11e624f 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -1069,7 +1069,7 @@ class FormSetupItem } elseif ($this->type == 'yesno') { $out.= ajax_constantonoff($this->confKey); } elseif (preg_match('/emailtemplate:/', $this->type)) { - if ($this->fieldValue > 0){ + if ($this->fieldValue > 0) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($this->db); From dbfa172e195be8d007792aaefbfa50cbddc04f65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Jan 2023 17:38:04 +0100 Subject: [PATCH 48/50] Debug view of thumbs for svg --- htdocs/core/class/commonobject.class.php | 5 ++++- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 471d835f4a3..2c9bb0c14c0 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8650,7 +8650,10 @@ abstract class CommonObject // Find name of thumb file $photo_vignette = basename(getImageFileNameForSize($dir.$file, '_small')); if (!dol_is_file($dirthumb.$photo_vignette)) { - $photo_vignette = ''; + // The thumb does not exists, so we will use the original file + $dirthumb = $dir; + $pdirthumb = $pdir; + $photo_vignette = basename($file); } // Get filesize of original file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4d38c7e5e5d..81f830d6456 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9903,7 +9903,7 @@ function showDirectDownloadLink($object) * @param string $file Original filename (full or relative path) * @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini') * @param string $extImgTarget Force image extension for thumbs. Use '' to keep same extension than original image (default). - * @return string New file name (full or relative path, including the thumbs/) + * @return string New file name (full or relative path, including the thumbs/). May be the original path if no thumb can exists. */ function getImageFileNameForSize($file, $extName, $extImgTarget = '') { From 35f16e821da3843fa93cefe5a284f9676b6501e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 25 Jan 2023 21:56:49 +0100 Subject: [PATCH 49/50] fix php8.2 warnings --- htdocs/debugbar/class/DataCollector/DolLogsCollector.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index 44885296bae..3d3b3b25a0e 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -41,6 +41,11 @@ class DolLogsCollector extends MessagesCollector */ protected $maxnboflines; + /** + * @var int number of lines + */ + protected $nboflines; + /** * Constructor * @@ -54,7 +59,7 @@ class DolLogsCollector extends MessagesCollector parent::__construct($name); $this->nboflines = 0; - $this->maxnboflines = empty($conf->global->DEBUGBAR_LOGS_LINES_NUMBER) ? 250 : $conf->global->DEBUGBAR_LOGS_LINES_NUMBER; // High number slows seriously output + $this->maxnboflines = getDolGlobalInt('DEBUGBAR_LOGS_LINES_NUMBER', 250); // High number slows seriously output $this->path = $path ?: $this->getLogsFile(); } From 1a4cb5b4e2057f2b66254fdcaf9100abb438fe1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Jan 2023 02:06:40 +0100 Subject: [PATCH 50/50] FIX #22964 #23012 --- htdocs/core/class/commonobject.class.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 63858fa28e2..ed74194d492 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1207,7 +1207,7 @@ abstract class CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Delete all links between an object $this and all its contacts + * Delete all links between an object $this and all its contacts in llx_element_contact * * @param string $source '' or 'internal' or 'external' * @param string $code Type of contact (code or id) @@ -1224,12 +1224,16 @@ abstract class CommonObject } $listId = implode(",", $temp); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; - $sql .= " WHERE element_id = ".((int) $this->id); - if ($listId) { - $sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")"; + // If $listId is empty, we have not criteria on fk_c_type_contact so we will delete record on element_id for + // any type or record instead of only the ones of the current object. So we do nothing in such a case. + if (empty($listId)) { + return 0; } + $sql = "DELETE FROM ".$this->db->prefix()."element_contact"; + $sql .= " WHERE element_id = ".((int) $this->id); + $sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")"; + dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); if ($this->db->query($sql)) { return 1;