diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index db28a176b62..18bf296526f 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1080,7 +1080,7 @@ if ($resql) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields // When action is 'reconcile', we force to have the column num_releve always enabled (otherwise we can't make reconciliation). if ($action == 'reconcile') { $arrayfields['b.num_releve']['checked'] = 1; @@ -1089,8 +1089,14 @@ if ($resql) { print '
'; print ''."\n"; - print ''; + // Actions and select + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } if (!empty($arrayfields['b.rowid']['checked'])) { print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print "\n"; // Fields title print ''; + // Actions and select + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + } if (!empty($arrayfields['b.rowid']['checked'])) { print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder); } @@ -1186,10 +1198,10 @@ if ($resql) { print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '', $sortfield, $sortorder, "center "); } if (!empty($arrayfields['b.datev']['checked'])) { - print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['type']['checked'])) { - print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['b.num_chq']['checked'])) { print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, '', $sortfield, $sortorder, "center "); @@ -1229,7 +1241,9 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Actions and select - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + } print "\n"; $balance = 0; // For balance @@ -1317,6 +1331,10 @@ if ($resql) { } print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } if ($tmpnbfieldbeforebalance) { print ''; } - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; } } @@ -1388,6 +1410,21 @@ if ($resql) { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Ref if (!empty($arrayfields['b.rowid']['checked'])) { print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; } print "\n"; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index db24c2641c7..916a12d0564 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -2175,10 +2175,11 @@ class AccountLine extends CommonObjectLine /** * Delete bank transaction record * - * @param User|null $user User object that delete - * @return int <0 if KO, >0 if OK + * @param User|null $user User object that delete + * @param int $notrigger 1=Does not execute triggers, 0= execute triggers + * @return int <0 if KO, >0 if OK */ - public function delete(User $user = null) + public function delete(User $user = null, $notrigger = 0) { global $conf; @@ -2192,6 +2193,16 @@ class AccountLine extends CommonObjectLine $this->db->begin(); + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('BANKACCOUNTLINE_DELETE', $user); + if ($result < 0) { + $this->db->rollback(); + return -1; + } + // End call triggers + } + // Protection to avoid any delete of accounted lines. Protection on by default if (empty($conf->global->BANK_ALLOW_TRANSACTION_DELETION_EVEN_IF_IN_ACCOUNTING)) { $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'bank' AND fk_doc = ".((int) $this->id); diff --git a/htdocs/core/ajax/bankconciliate.php b/htdocs/core/ajax/bankconciliate.php index 805d8f48b92..c67f1455b42 100644 --- a/htdocs/core/ajax/bankconciliate.php +++ b/htdocs/core/ajax/bankconciliate.php @@ -57,7 +57,7 @@ top_httphead(); //print ''."\n"; -if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvnext') { +if (($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) && $action == 'dvnext') { // Increase date $al = new AccountLine($db); $al->datev_next(GETPOST('rowid', 'int')); @@ -68,7 +68,7 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ exit; } -if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvprev') { +if (($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) && $action == 'dvprev') { // Decrease date $al = new AccountLine($db); $al->datev_previous(GETPOST('rowid', 'int')); @@ -79,18 +79,18 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ exit; } -if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'donext') { +if (($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) && $action == 'donext') { // Increase date $al = new AccountLine($db); $al->dateo_next(GETPOST('rowid', 'int')); $al->fetch(GETPOST('rowid', 'int')); - var_dump($al); + print ''.dol_print_date($al->dateo, "day").''; exit; } -if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'doprev') { +if (($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) && $action == 'doprev') { // Decrease date $al = new AccountLine($db); $al->dateo_previous(GETPOST('rowid', 'int')); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1144ad2f618..68d19a23ac4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9965,11 +9965,11 @@ class Form { $out = '
'; if ($pos == 'left') { - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; } else { - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; } $out .= '
'; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index aef501b4fe0..0a67f0450d7 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -754,15 +754,14 @@ class Notify continue; } + $sendto = $val; + $threshold = (float) $reg[1]; if (!empty($object->total_ht) && $object->total_ht <= $threshold) { dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification"); continue; } - $param = 'NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1]; - - $sendto = $conf->global->$param; $notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid'); if ($notifcodedefid <= 0) { dol_print_error($this->db, 'Failed to get id from code'); @@ -973,7 +972,7 @@ class Notify if ($mailfile->sendfile()) { $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)"; - $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($conf->global->$param)."')"; + $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($sendto)."')"; if (!$this->db->query($sql)) { dol_print_error($this->db); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index cd8224e4567..23559409136 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9999,6 +9999,11 @@ function printCommonFooter($zone = 'private') // Add 'field required' class on closest td for all input elements : input, textarea and select print 'jQuery(":input[name=\'' . $paramkey . '\']").closest("tr").find("td:first").addClass("fieldrequired");' . "\n"; } + // If we submit the cancel button we remove the required attributes + print 'jQuery("input[name=\'cancel\']").click(function() { + console.log("We click on cancel button so removed all required attribute"); + jQuery("input, textarea, select").each(function(){this.removeAttribute(\'required\');}); + });'."\n"; } } } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index de6013a41f9..7eaa7a14fdb 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -195,7 +195,8 @@ function dolDecrypt($chain, $key = '') $ciphering = $reg[1]; if (function_exists('openssl_decrypt')) { if (empty($key)) { - return 'Error dolDecrypt decrypt key is empty'; + dol_syslog("Error dolDecrypt decrypt key is empty", LOG_ERR); + return $chain; } $tmpexplode = explode(':', $reg[2]); if (!empty($tmpexplode[1]) && is_string($tmpexplode[0])) { @@ -204,7 +205,8 @@ function dolDecrypt($chain, $key = '') $newchain = openssl_decrypt($tmpexplode[0], $ciphering, $key, 0, null); } } else { - $newchain = 'Error dolDecrypt function openssl_decrypt() not available'; + dol_syslog("Error dolDecrypt openssl_decrypt is not available", LOG_ERR); + return $chain; } return $newchain; } else {
'; + $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + print $searchpicto; + print ''; print ''; @@ -1168,14 +1174,20 @@ if ($resql) { } // Actions and select - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); - print $searchpicto; - print ''; + $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + print $searchpicto; + print '
'; print ' '; @@ -1347,9 +1365,13 @@ if ($resql) { '; print ''; + print ''; print ' '; print '
'; @@ -1780,16 +1817,18 @@ if ($resql) { } // Action column - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '