From 8981020fa197bf67c47d3035da4d8ca49c482195 Mon Sep 17 00:00:00 2001 From: bomuux Date: Wed, 2 Nov 2022 18:18:53 +0100 Subject: [PATCH 01/32] BUG: can't update product_price_by_qty a typo in update query. --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 2171ef4aab3..d7005fa439a 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -556,7 +556,7 @@ if (empty($reshook)) { // Ajout / mise à jour if ($rowid > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."product_price_by_qty SET"; - $sql .= " price=".((float) $price)."',"; + $sql .= " price=".((float) $price).","; $sql .= " unitprice=".((float) $unitPrice).","; $sql .= " quantity=".((float) $quantity).","; $sql .= " remise_percent=".((float) $remise_percent).","; From 47dea03ecc4be594e0769688cb19f16ffa2603fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 3 Nov 2022 10:02:17 +0100 Subject: [PATCH 02/32] fetch last_main_doc in societe class --- htdocs/societe/class/societe.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 550f2280c59..8da7e20e4e5 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -15,7 +15,7 @@ * Copyright (C) 2017 Rui Strecht * Copyright (C) 2018 Philippe Grand * Copyright (C) 2019-2020 Josep Lluís Amador - * Copyright (C) 2019-2021 Frédéric France + * Copyright (C) 2019-2022 Frédéric France * Copyright (C) 2020 Open-Dsi * Copyright (C) 2022 ButterflyOfFire * @@ -1710,13 +1710,13 @@ class Societe extends CommonObject $sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif'; $sql .= ', s.phone, s.fax, s.email'; $sql .= ', s.socialnetworks'; - $sql .= ', s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur'; + $sql .= ', s.url, s.zip, s.town, s.note_private, s.note_public, s.client, s.fournisseur'; $sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6'; $sql .= ', s.capital, s.tva_intra'; $sql .= ', s.fk_typent as typent_id'; $sql .= ', s.fk_effectif as effectif_id'; $sql .= ', s.fk_forme_juridique as forme_juridique_code'; - $sql .= ', s.webservices_url, s.webservices_key, s.model_pdf'; + $sql .= ', s.webservices_url, s.webservices_key, s.model_pdf, s.last_main_doc'; if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= ', s.code_compta, s.code_compta_fournisseur, s.accountancy_code_buy, s.accountancy_code_sell'; } else { @@ -1947,7 +1947,10 @@ class Societe extends CommonObject // multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; $this->multicurrency_code = $obj->multicurrency_code; + + // pdf $this->model_pdf = $obj->model_pdf; + $this->last_main_doc = $obj->last_main_doc; $result = 1; From d375aca2c852085141cfa724d2aca095bab168ca Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 4 Nov 2022 11:29:52 +0100 Subject: [PATCH 03/32] fix bad SQL parenthesis in notification --- htdocs/core/ajax/check_notifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 35d10af49b6..4f5290b8826 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -152,7 +152,7 @@ if (empty($_SESSION['auto_check_events_not_before']) || $time >= $_SESSION['auto $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id; $sql .= ' WHERE a.code <> "AC_OTH_AUTO"'; $sql .= ' AND ('; - $sql .= " (ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; + $sql .= " ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."' AND ar.status = 0 AND ar.entity = ".$conf->entity; $sql .= ' )'; } else { $sql .= ' JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.$user->id; From 4890a2ada3a1a035a944edb8aa39ead2972514bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Nov 2022 00:13:52 +0100 Subject: [PATCH 04/32] Debug v17 --- htdocs/adherents/card.php | 6 ++++-- htdocs/adherents/class/adherent.class.php | 24 ++++++++++++++--------- htdocs/adherents/document.php | 9 ++++----- htdocs/adherents/note.php | 9 ++++----- htdocs/adherents/subscription.php | 6 ++++-- htdocs/core/lib/files.lib.php | 6 ++++++ htdocs/core/lib/functions.lib.php | 20 +++++++++++++++++++ htdocs/theme/eldy/info-box.inc.php | 15 +++++++++++++- htdocs/theme/md/info-box.inc.php | 15 +++++++++++++- htdocs/website/class/website.class.php | 8 ++++++-- 10 files changed, 91 insertions(+), 27 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 35829b5dcbf..c47321dbf7c 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1725,10 +1725,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''; + print ''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib('', 1).''; + print ''.$langs->trans("MemberNature").''; + print ''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index dd9d58eb7d3..130f5580e3a 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -520,7 +520,7 @@ class Adherent extends CommonObject * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) - * @param int $addbadge Add badge (1=Full label, 2=First letter only) + * @param int $addbadge Add badge (1=Full label, 2=First letters only) * @return string Label */ public function getmorphylib($morphy = '', $addbadge = 0) @@ -534,21 +534,27 @@ class Adherent extends CommonObject if ($addbadge) { $s = ''; + $labeltoshowm = $langs->trans("Moral"); + $labeltoshowp = $langs->trans("Physical"); if ($morphy == 'phy') { + $labeltoshow = $labeltoshowp; if ($addbadge == 2) { - $labeltoshow = dol_substr($langs->trans("Physical"), 0, 1); - } else { - $labeltoshow = $langs->trans("Physical"); + $labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowp)); + if ($labeltoshow == dol_strtoupper(dolGetFirstLetters($labeltoshowm))) { + $labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowp, 2)); + } } - $s .= ''.$labeltoshow.''; + $s .= ''.$labeltoshow.''; } if ($morphy == 'mor') { + $labeltoshow = $labeltoshowm; if ($addbadge == 2) { - $labeltoshow = dol_substr($langs->trans("Moral"), 0, 1); - } else { - $labeltoshow = $langs->trans("Moral"); + $labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowm)); + if ($labeltoshow == dol_strtoupper(dolGetFirstLetters($labeltoshowp))) { + $labeltoshow = dol_strtoupper(dolGetFirstLetters($labeltoshowm, 2)); + } } - $s .= ''.$labeltoshow.''; + $s .= ''.$labeltoshow.''; } } else { if ($morphy == 'phy') { diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index bce8227ab57..37d6e72a97e 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -158,13 +158,12 @@ if ($id > 0) { } // Type - print ''.$langs->trans("Type").''.$membert->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''; + print ''.$membert->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; - /*print ''; - print $form->showphoto('memberphoto',$object); - print '';*/ + print ''.$langs->trans("MemberNature").''; + print ''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index ea5e22fe153..938ab368ae1 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -133,13 +133,12 @@ if ($id) { } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''; + print ''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; - /*print ''; - print $form->showphoto('memberphoto',$member); - print '';*/ + print ''.$langs->trans("MemberNature").''; + print ''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index db40a8ad465..cc5b600b2a4 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -506,10 +506,12 @@ if ($rowid > 0) { } // Type - print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; + print ''.$langs->trans("Type").''; + print ''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; + print ''.$langs->trans("MemberNature").''; + print ''.$object->getmorphylib('', 1).''; print ''; // Company diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c3eede90efd..cb7e1a8883e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -641,6 +641,12 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask return 0; } + $srcexists = dol_is_file($srcfile); + if (!$srcexists) { + dol_syslog("files.lib.php::dolReplaceInFile failed to read src file", LOG_WARNING); + return -3; + } + $tmpdestfile = $destfile.'.tmp'; $newpathofsrcfile = dol_osencode($srcfile); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 09c9d3e9943..6d2841a08b2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3830,6 +3830,26 @@ function isValidPhone($phone) } +/** + * Return first letters of a strings. + * Example with nbofchar=1: 'ghi' will return 'g' but 'abc def' will return 'ad' + * Example with nbofchar=2: 'ghi' will return 'gh' but 'abc def' will return 'abde' + * + * @param string $s String to truncate + * @param int $nbofchar Nb of characters to keep + * @return string Return first chars. + */ +function dolGetFirstLetters($s, $nbofchar = 1) { + $ret = ''; + $tmparray = explode(' ', $s); + foreach($tmparray as $tmps) { + $ret .= dol_substr($tmps, 0, $nbofchar); + } + + return $ret; +} + + /** * Make a strlen call. Works even if mbstring module not enabled * diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 29f1a229054..daa3ff1da21 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -295,7 +295,20 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { margin: 2px; border-radius: 3px; } - +.member-company-back { + padding: 2px 7px 2px 7px; + background-color: #e4e4e4; + color: #666; + border-radius: 10px; + white-space: nowrap; +} +.member-individual-back { + padding: 2px 7px 2px 7px; + background-color: #e4e4e4; + color: #666; + border-radius: 10px; + white-space: nowrap; +} .bg-infobox-project{ diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index daf3c409397..e2733acc2bc 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -48,7 +48,20 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { margin: 2px; border-radius: 3px; } - +.member-company-back { + padding: 2px 7px 2px 7px; + background-color: #e4e4e4; + color: #666; + border-radius: 10px; + white-space: nowrap; +} +.member-individual-back { + padding: 2px 7px 2px 7px; + background-color: #e4e4e4; + color: #666; + border-radius: 10px; + white-space: nowrap; +} .bg-infobox-project{ color: #6c6aa8 !important; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index a8a85423da3..d532f7f475c 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1003,10 +1003,14 @@ class Website extends CommonObject // Make some replacement into some files $cssindestdir = $conf->website->dir_temp.'/'.$website->ref.'/containers/styles.css.php'; - dolReplaceInFile($cssindestdir, $arrayreplacementincss); + if (dol_is_file($cssindestdir)) { + dolReplaceInFile($cssindestdir, $arrayreplacementincss); + } $htmldeaderindestdir = $conf->website->dir_temp.'/'.$website->ref.'/containers/htmlheader.html'; - dolReplaceInFile($htmldeaderindestdir, $arrayreplacementincss); + if (dol_is_file($htmldeaderindestdir)) { + dolReplaceInFile($htmldeaderindestdir, $arrayreplacementincss); + } // Build sql file $filesql = $conf->website->dir_temp.'/'.$website->ref.'/website_pages.sql'; From a355f4fc8bb1746d87aa4d6dbee3d27f517d6701 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Fri, 4 Nov 2022 17:46:32 +0100 Subject: [PATCH 05/32] NEW: Add new hooks for actioncomm --- htdocs/comm/action/class/actioncomm.class.php | 13 ++++++++++++ htdocs/core/lib/company.lib.php | 20 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 228ff397607..aa14ba6e696 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1306,8 +1306,17 @@ class ActionComm extends CommonObject dol_syslog(get_class()."::getActions", LOG_DEBUG); + require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + $hookmanager->initHooks(array('agendadao')); + $sql = "SELECT a.id"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; + // Fields from hook + $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype); + $reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook + if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; if (!empty($socid)) { $sql .= " AND a.fk_soc = ".((int) $socid); @@ -1326,6 +1335,10 @@ class ActionComm extends CommonObject if (!empty($filter)) { $sql .= $filter; } + // Fields where hook + $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype); + $reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook + if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; if ($sortorder && $sortfield) { $sql .= $this->db->order($sortfield, $sortorder); } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 43264ac3d98..3d0cb72e7c9 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1489,6 +1489,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql = ''; if (isModEnabled('agenda')) { + require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + $hookmanager->initHooks(array('agendadao')); + // Recherche histo sur actioncomm if (is_object($objcon) && $objcon->id > 0) { $sql = "SELECT DISTINCT a.id, a.label as label,"; @@ -1528,6 +1533,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } } + // Fields from hook + $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon); + $reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook + if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; @@ -1539,6 +1549,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id); } + // Fields from hook + $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon); + $reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook + if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; } elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { @@ -1639,6 +1654,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin addOtherFilterSQL($sql, $donetodo, $now, $filters); + // Fields from hook + $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module); + $reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook + if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint; + if (is_array($actioncode)) { foreach ($actioncode as $code) { $sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj); From df3580687c387ba0ab0805fcf3f81b6d37e964d8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Nov 2022 04:38:12 +0100 Subject: [PATCH 06/32] NEW Accountancy - Added an option during export to export or not the lettering --- htdocs/accountancy/bookkeeping/list.php | 30 ++++++++++++++++++++++--- htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index e9836c4efbf..642dca887b2 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -700,6 +700,17 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements // Export files then exit $accountancyexport = new AccountancyExport($db); + $notexportlettering = GETPOST('notexportlettering', 'alpha'); + + if (!empty($notexportlettering)) { + if (is_array($object->lines)) { + foreach ($object->lines as $k => $movement) { + unset($object->lines[$k]->lettering_code); + unset($object->lines[$k]->date_lettering); + } + } + } + $mimetype = $accountancyexport->getMimeType($formatexportset); top_httphead($mimetype, 1); @@ -802,6 +813,19 @@ $formconfirm = ''; if ($action == 'export_file') { $form_question = array(); + if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) { + // If 1, we check by default. + $checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false'; + $form_question['notexportlettering'] = array( + 'name' => 'notexportlettering', + 'type' => 'checkbox', + 'label' => $langs->trans('NotExportLettering'), + 'value' => $checked, + ); + + $form_question['separator'] = array('name'=>'separator', 'type'=>'separator'); + } + // If 1 or not set, we check by default. $checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE)); $form_question['notifiedexportdate'] = array( @@ -811,7 +835,7 @@ if ($action == 'export_file') { 'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'), ); - $form_question['separator'] = array('name'=>'separator', 'type'=>'separator'); + $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { // If 0 or not set, we NOT check by default. @@ -823,10 +847,10 @@ if ($action == 'export_file') { 'value' => $checked, ); - $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); + $form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator'); } - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 600); } //if ($action == 'delbookkeepingyear') { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 40482298e63..5d115fe3e16 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -337,6 +337,7 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) ## Export +NotExportLettering=Do not export the lettering when generating the file NotifiedExportDate=Flag exported lines as Exported (to modify a line, you will need to delete the whole transaction and re-transfert it into accounting) NotifiedValidationDate=Validate and Lock the exported entries (same effect than the "%s" feature, modification and deletion of the lines will DEFINITELY not be possible) DateValidationAndLock=Date validation and lock From 578b63fea6ae48ee54c05168b767d4f009e06ce4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Nov 2022 05:16:18 +0100 Subject: [PATCH 07/32] NEW Accountancy - Add a graphic option to enable lettering function --- htdocs/accountancy/admin/index.php | 35 +++++++++++++++++++++++++++++ htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 36 insertions(+) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 8236b83eb3d..385c105451e 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -247,6 +247,20 @@ if ($action == 'setdisablebindingonexpensereports') { } } +if ($action == 'setenablelettering') { + $setenablelettering = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_LETTERING", $setenablelettering, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View @@ -466,6 +480,27 @@ print ''; print ''; +// Lettering params +print ''; +print ''; +print ''; +print "\n"; + +print ''; +print ''; +if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { + print ''; +} else { + print ''; +} +print ''; + +print '
'.$langs->trans('Options').' '.$langs->trans('Lettering').'
'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
'; + print '
'; print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 40482298e63..2582b6e3c90 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -335,6 +335,7 @@ NumberOfAccountancyMovements=Number of movements ACCOUNTING_DISABLE_BINDING_ON_SALES=Disable binding & transfer in accountancy on sales (customer invoices will not be taken into account in accounting) ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountancy on purchases (vendor invoices will not be taken into account in accounting) ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) +ACCOUNTING_ENABLE_LETTERING=Enable the lettering function in the accounting ## Export NotifiedExportDate=Flag exported lines as Exported (to modify a line, you will need to delete the whole transaction and re-transfert it into accounting) From 5fc293d408852013ef874e21693ccfaf7d5b252a Mon Sep 17 00:00:00 2001 From: Nicolas SILOBRE <45969285+ns-info90@users.noreply.github.com> Date: Sat, 5 Nov 2022 15:47:50 +0100 Subject: [PATCH 08/32] Unable to refuse leave #22752 update date refuse --- htdocs/holiday/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 1443a92a113..fcdb252c43e 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -668,7 +668,7 @@ if (empty($reshook)) { // If status pending validation and validator = user if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) { - $object->date_refuse = dol_print_date('dayhour', dol_now()); + $object->date_refuse = dol_now(); $object->fk_user_refuse = $user->id; $object->statut = Holiday::STATUS_REFUSED; $object->status = Holiday::STATUS_REFUSED; From ff2ee05277a62a8f3e5bf5b55e86eab23802cc31 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Nov 2022 08:11:53 +0100 Subject: [PATCH 09/32] NEW Reception - Add a from/to on date field --- htdocs/reception/list.php | 105 +++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 155e5185f57..0fbee47db8c 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -52,6 +52,22 @@ $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); $search_country = GETPOST("search_country", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); +$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int'); +$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int'); +$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int'); +$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int'); +$search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int'); +$search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int'); +$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); // Use tzserver +$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear); +$search_date_create_startday = GETPOST('search_date_create_startday', 'int'); +$search_date_create_startmonth = GETPOST('search_date_create_startmonth', 'int'); +$search_date_create_startyear = GETPOST('search_date_create_startyear', 'int'); +$search_date_create_endday = GETPOST('search_date_create_endday', 'int'); +$search_date_create_endmonth = GETPOST('search_date_create_endmonth', 'int'); +$search_date_create_endyear = GETPOST('search_date_create_endyear', 'int'); +$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver +$search_date_create_end = dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear); $search_billed = GETPOST("search_billed", 'int'); $sall = GETPOST('sall', 'alphanohtml'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -161,6 +177,30 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_state = ""; $search_country = ''; $search_type_thirdparty = ''; + $search_date_delivery_startday = ''; + $search_date_delivery_startmonth = ''; + $search_date_delivery_startyear = ''; + $search_date_delivery_endday = ''; + $search_date_delivery_endmonth = ''; + $search_date_delivery_endyear = ''; + $search_date_delivery_start = ''; + $search_date_delivery_end = ''; + $search_date_create_startday = ''; + $search_date_create_startmonth = ''; + $search_date_create_startyear = ''; + $search_date_create_endday = ''; + $search_date_create_endmonth = ''; + $search_date_create_endyear = ''; + $search_date_create_start = ''; + $search_date_create_end = ''; + $search_datelimit_startday = ''; + $search_datelimit_startmonth = ''; + $search_datelimit_startyear = ''; + $search_datelimit_endday = ''; + $search_datelimit_endmonth = ''; + $search_datelimit_endyear = ''; + $search_datelimit_start = ''; + $search_datelimit_end = ''; $search_billed = ''; $search_status = ''; $search_array_options = array(); @@ -545,6 +585,18 @@ if ($search_country) { if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')'; } +if ($search_date_delivery_start) { + $sql .= " AND e.date_delivery >= '".$db->idate($search_date_delivery_start)."'"; +} +if ($search_date_delivery_end) { + $sql .= " AND e.date_delivery <= '".$db->idate($search_date_delivery_end)."'"; +} +if ($search_date_create_start) { + $sql .= " AND e.date_creation >= '".$db->idate($search_date_create_start)."'"; +} +if ($search_date_create_end) { + $sql .= " AND e.date_creation <= '".$db->idate($search_date_create_end)."'"; +} if ($search_ref_rcp) { $sql .= natural_search('e.ref', $search_ref_rcp); } @@ -633,6 +685,42 @@ if ($search_country) { if ($search_type_thirdparty) { $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); } +if ($search_date_delivery_startday) { + $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); +} +if ($search_date_delivery_startmonth) { + $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); +} +if ($search_date_delivery_startyear) { + $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); +} +if ($search_date_delivery_endday) { + $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); +} +if ($search_date_delivery_endmonth) { + $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); +} +if ($search_date_delivery_endyear) { + $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); +} +if ($search_date_create_startday) { + $param .= '&search_date_create_startday='.urlencode($search_date_create_startday); +} +if ($search_date_create_startmonth) { + $param .= '&search_date_create_startmonth='.urlencode($search_date_create_startmonth); +} +if ($search_date_create_startyear) { + $param .= '&search_date_create_startyear='.urlencode($search_date_create_startyear); +} +if ($search_date_create_endday) { + $param .= '&search_date_create_endday='.urlencode($search_date_create_endday); +} +if ($search_date_create_endmonth) { + $param .= '&search_date_create_endmonth='.urlencode($search_date_create_endmonth); +} +if ($search_date_create_endyear) { + $param .= '&search_date_create_endyear='.urlencode($search_date_create_endyear); +} if ($search_ref_supplier) { $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); } @@ -815,7 +903,14 @@ if (!empty($arrayfields['typent.code']['checked'])) { } // Date delivery planned if (!empty($arrayfields['e.date_delivery']['checked'])) { - print ' '; + print ''; + print '
'; + print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print ''; } if (!empty($arrayfields['l.ref']['checked'])) { // Delivery ref @@ -836,7 +931,13 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['e.datec']['checked'])) { - print ''; + print ''; + print '
'; + print $form->selectDate($search_date_create_start ? $search_date_create_start : -1, 'search_date_create_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_create_end ? $search_date_create_end : -1, 'search_date_create_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // Date modification From fe9d21b0ea90c0dd21422a51407d6e8f9603a773 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Nov 2022 10:40:53 +0100 Subject: [PATCH 10/32] NEW Reception - Add a from/to on date field --- htdocs/reception/list.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 0fbee47db8c..58df4aaaa70 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -193,14 +193,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_date_create_endyear = ''; $search_date_create_start = ''; $search_date_create_end = ''; - $search_datelimit_startday = ''; - $search_datelimit_startmonth = ''; - $search_datelimit_startyear = ''; - $search_datelimit_endday = ''; - $search_datelimit_endmonth = ''; - $search_datelimit_endyear = ''; - $search_datelimit_start = ''; - $search_datelimit_end = ''; $search_billed = ''; $search_status = ''; $search_array_options = array(); From b1db74d9f0f38b6c89f73d18ea105d205ce995e2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Nov 2022 14:35:17 +0100 Subject: [PATCH 11/32] FIX Accountancy - Delete operation - Problem on SELECT --- htdocs/accountancy/class/lettering.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 857cd12115e..5749518e2b9 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -592,7 +592,7 @@ class Lettering extends BookKeeping $sql .= " WHERE bpn.entity IN (" . getEntity('accountancy') . ")"; $sql .= " AND bpn.doc_type = 'bank'"; $sql .= " AND bpn.fk_doc IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")"; - $sql .= " AND bpn ON bpn.piece_num = ab.piece_num"; + $sql .= " AND bpn.piece_num = ab.piece_num"; $sql .= " ) OR "; } $sql .= " EXISTS ("; From 13c7ddddbf048aa90138c3d01abbc519ff4d6e43 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Nov 2022 16:51:12 +0100 Subject: [PATCH 12/32] FIX Accountancy - the pages of generations of entries are not journals, this term must be removed --- htdocs/accountancy/journal/bankjournal.php | 4 ++-- .../accountancy/journal/expensereportsjournal.php | 6 +++--- htdocs/accountancy/journal/purchasesjournal.php | 4 ++-- htdocs/accountancy/journal/sellsjournal.php | 4 ++-- htdocs/accountancy/journal/variousjournal.php | 9 ++------- htdocs/install/mysql/data/llx_accounting_abc.sql | 14 +++++++------- htdocs/langs/en_US/accountancy.lang | 1 + 7 files changed, 19 insertions(+), 23 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f3049206389..9bc5ba45586 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1032,9 +1032,9 @@ if (empty($action) || $action == 'view') { $salarystatic = new Salary($db); $variousstatic = new PaymentVarious($db); - llxHeader('', $langs->trans("FinanceJournal")); + llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType4")); - $nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + $nom = $langs->trans("GenerationOfAccountingEntries").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $builddate = dol_now(); //$description = $langs->trans("DescFinanceJournal") . '
'; $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index d38e49c390e..d7c2582c5bf 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -496,14 +496,14 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("ExpenseReportsJournal")); + llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType5")); - $nom = $langs->trans("ExpenseReportsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + $nom = $langs->trans("GenerationOfAccountingEntries").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nomlink = ''; $periodlink = ''; $exportlink = ''; $builddate = dol_now(); - $description .= $langs->trans("DescJournalOnlyBindedVisible").'
'; + $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 0f721a67db7..ccf505f13c1 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -756,9 +756,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("PurchasesJournal")); + llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType3")); - $nom = $langs->trans("PurchasesJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + $nom = $langs->trans("GenerationOfAccountingEntries").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 4894e7b660f..9045126f065 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -699,9 +699,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("SellsJournal")); + llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType2")); - $nom = $langs->trans("SellsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + $nom = $langs->trans("GenerationOfAccountingEntries").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index 13ccba0d762..52c9b48f894 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -165,22 +165,18 @@ if ($reload) { $form = new Form($db); if ($object->nature == 2) { - $title = $langs->trans("SellsJournal"); $some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'; $account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'; } elseif ($object->nature == 3) { - $title = $langs->trans("PurchasesJournal"); $some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'; $account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'; } elseif ($object->nature == 4) { - $title = $langs->trans("FinanceJournal"); $some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' || empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1'; $account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'; } elseif ($object->nature == 5) { - $title = $langs->trans("ExpenseReportsJournal"); $some_mandatory_steps_of_setup_were_not_done = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1'; $account_accounting_not_defined = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1'; } else { @@ -189,8 +185,9 @@ if ($object->nature == 2) { $account_accounting_not_defined = false; } +llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType1")); -$nom = $title . ' | ' . $object->getNomUrl(0, 1, 1, '', 1); +$nom = $langs->trans("GenerationOfAccountingEntries") . ' | ' . $object->getNomUrl(0, 1, 1, '', 1); $nomlink = ''; $periodlink = ''; $exportlink = ''; @@ -213,8 +210,6 @@ $period .= ' - ' . $langs->trans("JournalizationInLedgerStatus") . ' ' . $form- $varlink = 'id_journal=' . $id_journal; -llxHeader('', $title); - journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); if ($object->nature == 4) { // Bank journal diff --git a/htdocs/install/mysql/data/llx_accounting_abc.sql b/htdocs/install/mysql/data/llx_accounting_abc.sql index 661e786ca06..e61f4ad8f1b 100644 --- a/htdocs/install/mysql/data/llx_accounting_abc.sql +++ b/htdocs/install/mysql/data/llx_accounting_abc.sql @@ -46,13 +46,13 @@ -- Accounting Journals -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'ACCOUNTING_SELL_JOURNAL', 2, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'ACCOUNTING_PURCHASE_JOURNAL', 3, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'ACCOUNTING_BANK_JOURNAL', 4, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'ACCOUNTING_EXPENSEREPORT_JOURNAL', 5, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'ACCOUNTING_MISCELLANEOUS_JOURNAL', 1, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'ACCOUNTING_HAS_NEW_JOURNAL', 9, 0, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'ACCOUNTING_INVENTORY_JOURNAL', 8, 0, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'AccountingJournalType2', 2, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'AccountingJournalType3', 3, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'AccountingJournalType4', 4, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'AccountingJournalType5', 5, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'AccountingJournalType1', 1, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'AccountingJournalType9', 9, 0, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'AccountingJournalType8', 8, 0, 1); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 40482298e63..8dc7ce4470f 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -328,6 +328,7 @@ AccountingJournalType4=Bank AccountingJournalType5=Expenses report AccountingJournalType8=Inventory AccountingJournalType9=Has-new +GenerationOfAccountingEntries=Generation of accounting entries ErrorAccountingJournalIsAlreadyUse=This journal is already use AccountingAccountForSalesTaxAreDefinedInto=Note: Accounting account for Sales tax are defined into menu %s - %s NumberOfAccountancyEntries=Number of entries From b9423bb532924da146786ed57111d8abbe041706 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Nov 2022 17:02:01 +0100 Subject: [PATCH 13/32] NEW Accountancy - Add a way to clean some words when you generate thirdparty accounting account --- .../societe/mod_codecompta_digitaria.php | 27 +++++++++++++++++-- htdocs/langs/en_US/admin.lang | 4 ++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index dddd01a602d..2ff2313c998 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -102,7 +102,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $texte .= ''; $texte .= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; + $texte .= '
'; $s1 = $form->textwithpicto('', $tooltip, 1, 1); $s2 = $form->textwithpicto('', $tooltip, 1, 1); $s3 = $form->textwithpicto('', $tooltip, 1, 1); @@ -127,7 +128,23 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode } $texte .= ''; $texte .= ''; + $texte .= ''; + + $texte .= '
'; + $texte .= "
\n"; + + $texthelp = $langs->trans("RemoveSpecialWordsHelp"); + $texttitle = $langs->trans("RemoveSpecialWords"); + + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); + $texte .= "
\n"; + $texte .= ''; $texte .= '
'; + $texte .= ''; return $texte; @@ -192,6 +209,11 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode return -1; } + // Clean declared words + if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_WORDS)) { + $cleanWords = explode(";", $conf->global->COMPANY_DIGITARIA_CLEAN_WORDS); + $codetouse = str_replace($cleanWords, "", $codetouse); + } // Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default) if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) { $codetouse = preg_replace('/([^a-z0-9])/i', '', $codetouse); @@ -202,7 +224,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode } $this->code = $prefix.strtoupper(substr($codetouse, 0, $width)); - dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code); + dol_syslog("mod_codecompta_digitaria::get_code search code proposed=".$this->code, LOG_DEBUG); // Unique index on code if COMPANY_DIGITARIA_UNIQUE_CODE is set to 1 or not set (default) if (!isset($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE) || !empty($conf->global->COMPANY_DIGITARIA_UNIQUE_CODE)) { @@ -279,6 +301,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $sql = "SELECT " . $typethirdparty . " FROM " . MAIN_DB_PREFIX . "societe"; $sql .= " WHERE " . $typethirdparty . " = '" . $db->escape($code) . "'"; } + $sql .= " AND entity IN (".getEntity('societe').")"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0555906768c..305bd003be2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2059,6 +2059,8 @@ RemoveSpecialChars=Remove special characters COMPANY_AQUARIUM_CLEAN_REGEX=Regex filter to clean value (COMPANY_AQUARIUM_CLEAN_REGEX) COMPANY_DIGITARIA_CLEAN_REGEX=Regex filter to clean value (COMPANY_DIGITARIA_CLEAN_REGEX) COMPANY_DIGITARIA_UNIQUE_CODE=Duplicate not allowed +RemoveSpecialWords=Clean certain words when generating sub-accounts for customers or suppliers +RemoveSpecialWordsHelp=Specify the words to be cleaned before calculating the customer or supplier account. Use a ";" between each word GDPRContact=Data Protection Officer (DPO, Data Privacy or GDPR contact) GDPRContactDesc=If you store personal data in your Information System, you can name the contact who is responsible for the General Data Protection Regulation here HelpOnTooltip=Help text to show on tooltip @@ -2333,4 +2335,4 @@ MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Show the price on the generated documents f WarningDisabled=Warning disabled LimitsAndMitigation=Access limits and mitigation DesktopsOnly=Desktops only -DesktopsAndSmartphones=Desktops et smartphones \ No newline at end of file +DesktopsAndSmartphones=Desktops et smartphones From 32737a48c028138606a79325596d257d5b36acc4 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 7 Nov 2022 16:22:23 +0100 Subject: [PATCH 14/32] Fix sql error on stripe sepa --- htdocs/core/class/commoninvoice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 2a185b362be..6fa218d4970 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -1572,7 +1572,7 @@ abstract class CommonInvoice extends CommonObject $this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?"; } - $sql = "INSERT INTO '.MAIN_DB_PREFIX.'prelevement_demande("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_demande("; $sql .= "fk_facture, "; $sql .= " amount, date_demande, fk_user_demande, ext_payment_id, ext_payment_site, sourcetype, entity)"; $sql .= " VALUES (".$this->id; From cbd4a734a87f1b96992f2455f7e6a934f060a427 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 7 Nov 2022 16:26:35 +0100 Subject: [PATCH 15/32] refresh of the object --- htdocs/compta/facture/prelevement.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 9809554c37f..5664c2e3f54 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -143,6 +143,13 @@ if (empty($reshook)) { $result = $object->makeStripeSepaRequest($user, GETPOST('did', 'int'), 'direct-debit', 'facture'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); + } else { + // We refresh object data + $ret = $object->fetch($id, $ref); + $isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); + if ($ret > 0) { + $object->fetch_thirdparty(); + } } } From cb5c5fd56d810a9a897699b752959236d094163c Mon Sep 17 00:00:00 2001 From: UlusoftConsultancy Date: Mon, 7 Nov 2022 16:25:03 +0100 Subject: [PATCH 16/32] Add formObjectOptions hook to variants/card.php --- htdocs/variants/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 956d95f0a82..ca026bef4a4 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -214,6 +214,9 @@ if ($action == 'create') { // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; print dol_get_fiche_end(); From 570a75b3d6500ddbab248a0665a9450020e5784e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 7 Nov 2022 18:50:21 +0100 Subject: [PATCH 17/32] Fix separator --- htdocs/accountancy/journal/bankjournal.php | 4 ++-- htdocs/accountancy/journal/expensereportsjournal.php | 4 ++-- htdocs/accountancy/journal/purchasesjournal.php | 4 ++-- htdocs/accountancy/journal/sellsjournal.php | 4 ++-- htdocs/accountancy/journal/variousjournal.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 9bc5ba45586..dd729872f13 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1032,9 +1032,9 @@ if (empty($action) || $action == 'view') { $salarystatic = new Salary($db); $variousstatic = new PaymentVarious($db); - llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType4")); + llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType4")); - $nom = $langs->trans("GenerationOfAccountingEntries").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $builddate = dol_now(); //$description = $langs->trans("DescFinanceJournal") . '
'; $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index d7c2582c5bf..599e5394399 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -496,9 +496,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType5")); + llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType5")); - $nom = $langs->trans("GenerationOfAccountingEntries").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index ccf505f13c1..a0b0bed97fa 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -756,9 +756,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType3")); + llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType3")); - $nom = $langs->trans("GenerationOfAccountingEntries").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 9045126f065..461fc327686 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -699,9 +699,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType2")); + llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType2")); - $nom = $langs->trans("GenerationOfAccountingEntries").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index 52c9b48f894..e9e9cabd984 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -185,9 +185,9 @@ if ($object->nature == 2) { $account_accounting_not_defined = false; } -llxHeader('', $langs->trans("GenerationOfAccountingEntries").' | '.$langs->trans("AccountingJournalType1")); +llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType1")); -$nom = $langs->trans("GenerationOfAccountingEntries") . ' | ' . $object->getNomUrl(0, 1, 1, '', 1); +$nom = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 1, 1, '', 1); $nomlink = ''; $periodlink = ''; $exportlink = ''; From ddf60b399edab4b3d75d839c4aa05b6ea8120ad5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Nov 2022 21:48:52 +0100 Subject: [PATCH 18/32] Fix better separation label journal and label transfer --- htdocs/accountancy/admin/journals_list.php | 6 ------ .../accountancy/class/accountingjournal.class.php | 9 +++++++-- htdocs/accountancy/journal/bankjournal.php | 13 ++++++++----- .../accountancy/journal/expensereportsjournal.php | 6 ++++-- htdocs/accountancy/journal/purchasesjournal.php | 6 ++++-- htdocs/accountancy/journal/sellsjournal.php | 6 ++++-- htdocs/accountancy/journal/variousjournal.php | 6 ++++-- htdocs/core/menus/standard/eldy.lib.php | 8 ++++++-- htdocs/install/mysql/data/llx_accounting_abc.sql | 15 +++++++-------- htdocs/langs/en_US/accountancy.lang | 2 +- 10 files changed, 45 insertions(+), 32 deletions(-) diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 8d350afbb07..e1a07fef5fc 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -611,12 +611,6 @@ if ($id) { if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { $iserasable = 0; $canbedisabled = 0; - } elseif ($obj->code == 'RECEP') { - $iserasable = 0; - $canbedisabled = 0; - } elseif ($obj->code == 'EF0') { - $iserasable = 0; - $canbedisabled = 0; } } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 982d6849f6e..ca6ea8cd5e5 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -231,7 +231,7 @@ class AccountingJournal extends CommonObject * Return clicable name (with picto eventually) * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $withlabel 0=No label, 1=Include label of journal + * @param int $withlabel 0=No label, 1=Include label of journal, 2=Include nature of journal * @param int $nourl 1=Disable url * @param string $moretitle Add more text to title tooltip * @param int $notooltip 1=Disable tooltip @@ -281,9 +281,14 @@ class AccountingJournal extends CommonObject } $label_link = $this->code; - if ($withlabel && !empty($this->label)) { + if ($withlabel != 2 && !empty($this->label)) { $label_link .= ' - '.($nourl ? '' : '').$langs->transnoentities($this->label).($nourl ? '' : ''); } + if ($withlabel == 2 && !empty($this->nature)) { + $key = $langs->trans("AccountingJournalType".strtoupper($this->nature)); + $transferlabel = ($this->nature && $key != "AccountingJournalType".strtoupper($langs->trans($this->nature)) ? $key : $this->label); + $label_link .= ' - '.($nourl ? '' : '').$transferlabel.($nourl ? '' : ''); + } $result .= $linkstart; if ($withpicto) { diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index dd729872f13..5c099922af4 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1032,9 +1032,11 @@ if (empty($action) || $action == 'view') { $salarystatic = new Salary($db); $variousstatic = new PaymentVarious($db); - llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType4")); + $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); - $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + llxHeader('', $title); + + $nom = $title; $builddate = dol_now(); //$description = $langs->trans("DescFinanceJournal") . '
'; $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; @@ -1052,6 +1054,7 @@ if (empty($action) || $action == 'view') { journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); + $desc = ''; // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0"; @@ -1074,7 +1077,7 @@ if (empty($action) || $action == 'view') { if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' || empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { - print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); + print ($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); print $desc; @@ -1125,8 +1128,8 @@ if (empty($action) || $action == 'view') { $i = 0; print '
'; - print ""; - print ""; + print '
'; + print ''; print ""; print ""; print ""; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 599e5394399..7db2df72979 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -496,9 +496,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType5")); + $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); - $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + llxHeader('', $title); + + $nom = $title; $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index a0b0bed97fa..c3592b8c9de 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -756,9 +756,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType3")); + $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); - $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + llxHeader('', $title); + + $nom = $title; $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 461fc327686..7ae8b3ca1c0 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -699,9 +699,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! if (empty($action) || $action == 'view') { - llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType2")); + $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); - $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); + llxHeader('', $title); + + $nom = $title; $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index e9e9cabd984..f822daa540c 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -185,9 +185,11 @@ if ($object->nature == 2) { $account_accounting_not_defined = false; } -llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType1")); +$title = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 2, 1, '', 1); -$nom = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 1, 1, '', 1); +llxHeader('', $title); + +$nom = $title; $nomlink = ''; $periodlink = ''; $exportlink = ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 8f91e4bb122..8c14bd40027 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1727,9 +1727,13 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($nature) { $langs->load('accountancy'); $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... - $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + + $key = $langs->trans("AccountingJournalType".strtoupper($objp->nature)); + $transferlabel = ($objp->nature && $key != "AccountingJournalType".strtoupper($langs->trans($objp->nature)) ? $key : $objp->label); + + $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $transferlabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire')); } - $i++; + $i++; } } else { // Should not happend. Entries are added diff --git a/htdocs/install/mysql/data/llx_accounting_abc.sql b/htdocs/install/mysql/data/llx_accounting_abc.sql index e61f4ad8f1b..0d2dd657639 100644 --- a/htdocs/install/mysql/data/llx_accounting_abc.sql +++ b/htdocs/install/mysql/data/llx_accounting_abc.sql @@ -46,14 +46,13 @@ -- Accounting Journals -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'AccountingJournalType2', 2, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'AccountingJournalType3', 3, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'AccountingJournalType4', 4, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'AccountingJournalType5', 5, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'AccountingJournalType1', 1, 1, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'AccountingJournalType9', 9, 0, 1); -INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'AccountingJournalType8', 8, 0, 1); - +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('VT', 'ACCOUNTING_SELL_JOURNAL', 2, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AC', 'ACCOUNTING_PURCHASE_JOURNAL', 3, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('BQ', 'FinanceJournal', 4, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('OD', 'ACCOUNTING_MISCELLANEOUS_JOURNAL', 1, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('AN', 'ACCOUNTING_HAS_NEW_JOURNAL', 9, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('ER', 'ExpenseReportsJournal', 5, 1, 1); +INSERT INTO llx_accounting_journal (code, label, nature, active, entity) VALUES ('INV', 'InventoryJournal', 8, 1, 1); -- Accounting Charts / Plans (Templates) for Countries diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 6ace02525ec..d2ae1e7f7a1 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -325,7 +325,7 @@ AccountingJournalType1=Miscellaneous operations AccountingJournalType2=Sales AccountingJournalType3=Purchases AccountingJournalType4=Bank -AccountingJournalType5=Expenses report +AccountingJournalType5=Expense reports AccountingJournalType8=Inventory AccountingJournalType9=Has-new GenerationOfAccountingEntries=Generation of accounting entries From f371bf96dbf0fcd6e769ed9763f433ff94795612 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Nov 2022 03:01:32 +0100 Subject: [PATCH 19/32] Debug v17 --- htdocs/comm/action/card.php | 63 ++++++++++++------- htdocs/comm/action/class/actioncomm.class.php | 16 ++++- htdocs/contact/list.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/ajax.lib.php | 11 +++- htdocs/theme/eldy/global.inc.php | 3 + htdocs/theme/md/style.css.php | 3 + 7 files changed, 68 insertions(+), 32 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 271b6eb463c..105e70e18bc 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -430,7 +430,36 @@ if (empty($reshook) && $action == 'add') { if (!$error) { $db->begin(); + $selectedrecurrulefreq = 'no'; + $selectedrecurrulebymonthday = ''; + $selectedrecurrulebyday = ''; + $object->recurrule = GETPOSTISSET('recurrulefreq') ? "FREQ=".GETPOST('recurrulefreq', 'alpha') : ""; + $object->recurrule .= (GETPOST('recurrulefreq', 'alpha') == 'MONTHLY' && GETPOSTISSET('BYMONTHDAY')) ? "_BYMONTHDAY".GETPOST('BYMONTHDAY', 'alpha') : ""; + $object->recurrule .= (GETPOST('recurrulefreq', 'alpha') == 'WEEKLY' && GETPOSTISSET('BYDAY')) ? "_BYDAY".GETPOST('BYDAY', 'alpha') : ""; + $reg1 = array(); $reg2 = array(); $reg3 = array(); + if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg1)) { + $selectedrecurrulefreq = $reg1[1]; + } + if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg2)) { + $selectedrecurrulebymonthday = $reg2[1]; + } + if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg3)) { + $selectedrecurrulebyday = $reg3[1]; + } + + // Is event recurrent ? + $eventisrecurring = 0; + $userepeatevent = (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 2 ? 1 : 0); + if ($userepeatevent && !empty($selectedrecurrulefreq) && $selectedrecurrulefreq != 'no') { + $eventisrecurring = 1; + $object->recurid = dol_print_date(dol_now('gmt'), 'dayhourlog', 'gmt'); + $object->recurdateend = dol_mktime(0, 0, 0, GETPOST('limitmonth', 'int'), GETPOST('limitday', 'int'), GETPOST('limityear', 'int')); + } else { + unset($object->recurid); + unset($object->recurrule); + unset($object->recurdateend); + } // Creation of action/event $idaction = $object->create($user); @@ -517,26 +546,7 @@ if (empty($reshook) && $action == 'add') { $action = 'create'; $donotclearsession = 1; } - $selectedrecurrulefreq = 'no'; - $selectedrecurrulebymonthday = ''; - $selectedrecurrulebyday = ''; - $object->recurrule = GETPOSTISSET('recurrulefreq') ? "FREQ=".GETPOST('recurrulefreq', 'alpha') : ""; - $object->recurrule .= GETPOSTISSET('BYMONTHDAY') ? "_BYMONTHDAY".GETPOST('BYMONTHDAY', 'alpha') : ""; - $object->recurrule .= GETPOSTISSET('BYDAY') ? "_BYDAY".GETPOST('BYDAY', 'alpha') : ""; - - if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i', $object->recurrule, $reg1)) { - $selectedrecurrulefreq = $reg1[1]; - } - if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY(\d+)/i', $object->recurrule, $reg2)) { - $selectedrecurrulebymonthday = $reg2[1]; - } - if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i', $object->recurrule, $reg3)) { - $selectedrecurrulebyday = $reg3[1]; - } - - // If event is recurrent - $userepeatevent = ($conf->global->MAIN_FEATURES_LEVEL == 2 ? 1 : 0); - if ($userepeatevent && !empty($selectedrecurrulefreq) && $selectedrecurrulefreq != 'no') { + if ($eventisrecurring) { // We set first date of recurrence and offsets if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) { $firstdatearray = dol_get_first_day_week(GETPOST("apday", 'int'), GETPOST("apmonth", 'int'), GETPOST("apyear", 'int')); @@ -944,9 +954,7 @@ if (empty($reshook) && $action == 'update') { } } -/* - * delete event - */ +// Delete event if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes') { $object->fetch($id); $object->fetch_optionals(); @@ -2205,11 +2213,18 @@ if ($id > 0) { } // Private - if ($object->elementtype == 'ticket') print ''; + if ($object->elementtype == 'ticket') { + print ''; + } // Full day event print ''; + // Event into a serie + if ($object->recurid) { + print ''; + } + $rowspan = 4; if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { $rowspan++; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index aa14ba6e696..f4b7f1b2bfb 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -269,6 +269,7 @@ class ActionComm extends CommonObject */ public $contact_id; + /** * @var Societe|null Company linked to action (optional) * @deprecated @@ -376,9 +377,9 @@ class ActionComm extends CommonObject /** * Properties to manage the recurring events */ - public $recurid; - public $recurrule; - public $recurdateend; + public $recurid; /* A string YYYYMMDDHHMMSS shared by allevent of same serie */ + public $recurrule; /* Rule of recurring */ + public $recurdateend; /* Repeat until this date */ public $calling_duration; @@ -549,6 +550,9 @@ class ActionComm extends CommonObject $sql .= "email_tobcc,"; $sql .= "email_subject,"; $sql .= "errors_to,"; + $sql .= "recurid,"; + $sql .= "recurrule,"; + $sql .= "recurdateend,"; $sql .= "num_vote,"; $sql .= "event_paid,"; $sql .= "status"; @@ -587,6 +591,9 @@ class ActionComm extends CommonObject $sql .= (!empty($this->email_tobcc) ? "'".$this->db->escape($this->email_tobcc)."'" : "null").", "; $sql .= (!empty($this->email_subject) ? "'".$this->db->escape($this->email_subject)."'" : "null").", "; $sql .= (!empty($this->errors_to) ? "'".$this->db->escape($this->errors_to)."'" : "null").", "; + $sql .= (!empty($this->recurid) ? "'".$this->db->escape($this->recurid)."'" : "null").", "; + $sql .= (!empty($this->recurrule) ? "'".$this->db->escape($this->recurrule)."'" : "null").", "; + $sql .= (!empty($this->recurdateend) ? "'".$this->db->idate($this->recurdateend)."'" : "null").", "; $sql .= (!empty($this->num_vote) ? (int) $this->num_vote : "null").", "; $sql .= (!empty($this->event_paid) ? (int) $this->event_paid : 0).", "; $sql .= (!empty($this->status) ? (int) $this->status : "0"); @@ -716,6 +723,9 @@ class ActionComm extends CommonObject $this->fetchResources(); $this->id = 0; + $this->recurid = ''; + $this->recurrule = ''; + $this->recurdateend = ''; // Create clone $this->context['createfromclone'] = 'createfromclone'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index ae5deba98f1..2bfdf9d1f66 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1010,7 +1010,7 @@ if (!empty($arrayfields['p.tms']['checked'])) { // Status if (!empty($arrayfields['p.statut']['checked'])) { print ''; } if (!empty($arrayfields['p.import_key']['checked'])) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a82aadb7363..13c99dea052 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8097,7 +8097,7 @@ class Form if ($addjscombo && $jsbeautify) { // Enhance with select2 include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', $show_empty < 0 ? (string) $show_empty : '-1'); + $out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($show_empty < 0 ? (string) $show_empty : '-1'), $morecss); } return $out; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 35e67f19e80..6cd7a0f0381 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -434,10 +434,11 @@ function ajax_dialog($title, $message, $w = 350, $h = 150) * @param int $forcefocus Force focus on field * @param string $widthTypeOfAutocomplete 'resolve' or 'off' * @param string $idforemptyvalue '-1' + * @param string $morecss More css * @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason. * @see selectArrayAjax() of html.form.class */ -function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete = 'resolve', $idforemptyvalue = '-1') +function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete = 'resolve', $idforemptyvalue = '-1', $morecss = '') { global $conf; @@ -463,14 +464,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = $minLengthToAutocomplete = 0; } + $moreselect2theme = ($morecss ? dol_escape_js(' '.$morecss) : ''); + $moreselect2theme = preg_replace('/widthcentpercentminus[^\s]*/', '', $moreselect2theme); + $tmpplugin = 'select2'; $msg = "\n".'
".$langs->trans("Date")."".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").")".$langs->trans("AccountAccounting")."
'.$langs->trans("PrivateEventMessage").''.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'
'.$langs->trans("PrivateEventMessage").''.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent ? 1 : 0, 3).'
'.$langs->trans("EventIntoASerie").''.dol_escape_htmltag($object->recurid).'
'; - print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75'); + print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75 onrightofpage'); print '