diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index d211444b4ee..59ffdf2e899 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -661,7 +661,7 @@ if (empty($reshook)) { } $newcardbutton .= ''.$langs->trans("IncludeDocsAlreadyExported").''; - $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); + if (!empty($user->rights->accounting->mouvements->export)) $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly')); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 0efe367089c..0c2db362e75 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2021 Alexandre Spangaro * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -266,6 +266,18 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->m $object->datev = $newdatepayment; } + if (GETPOSTISSET("clone_sens")) { + $object->sens = GETPOST("clone_sens", 'int'); + } else { + $object->sens = $object->sens; + } + + if (GETPOST("clone_amount", "alpha")) { + $object->amount = price2num(GETPOST("clone_amount", "alpha")); + } else { + $object->amount = price2num($object->amount); + } + if ($object->check()) { $id = $object->create($user); @@ -486,14 +498,19 @@ if ($id) // Clone confirmation if ($action === 'clone') { + $set_value_help = $form->textwithpicto('', $langs->trans($langs->trans("AccountingDirectionHelp"))); + $sensarray = array('0' => $langs->trans("Debit"), '1' => $langs->trans("Credit")); + $formquestion = array( array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label), - ); - $formquestion[] = array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1); - $formquestion[] = array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1); - $formquestion[] = array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($accountid, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)); + array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1), + array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1), + array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'clone_accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($object->fk_account, "accountid", 0, '', 1, '', 0, 'minwidth200', 1)), + array('type' => 'text', 'name' => 'clone_amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount)), + array('type' => 'select', 'name' => 'clone_sens', 'label' => $langs->trans("Sens") . ' ' . $set_value_help, 'values' => $sensarray, 'default' => $object->sens), + ); - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 300); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350); } print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 887e97e76e9..566b044c81e 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1044,15 +1044,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1) { print "\n".''."\n"; } if (!GETPOSTISSET("no_email") && !empty($object->email)) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 59c6b2af273..3d8f3e72d9e 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1257,8 +1257,6 @@ class FormMail extends Form $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm"); } elseif ($type_template == 'thirdparty') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); - } elseif ($type_template == 'user') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentUser"); } elseif (!empty($type_template)) { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric"); } diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 41ce8a67316..c62c6add140 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -148,8 +148,11 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) { if ($result == 2) // Connection is ok for user/pass into LDAP { - dol_syslog("functions_ldap::check_user_password_ldap Authentification ok"); $login = $usertotest; + if (!empty($conf->global->LDAP_FIELD_LOGIN)) { + $login = $ldap->login; + } + dol_syslog("functions_ldap::check_user_password_ldap $login authentication ok"); require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 0cb380f39a1..af11f4c1d67 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -80,12 +80,13 @@ class TraceableDB extends DoliDB * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. * Function to use to build INSERT, UPDATE or WHERE predica * - * @param int $param Date TMS to convert - * @return string Date in a string YYYYMMDDHHMMSS + * @param int $param Date TMS to convert + * @param mixed $gm 'gmt'=Input informations are GMT values, 'tzserver'=Local to server TZ + * @return string Date in a string YYYY-MM-DD HH:MM:SS */ - public function idate($param) + public function idate($param, $gm = 'tzserver') { - return $this->db->idate($param); + return $this->db->idate($param, $gm); } /** diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 20091028583..aa2402a432b 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -499,8 +499,8 @@ class Expedition extends CommonObject // create shipment lines foreach ($stockLocationQty as $stockLocation => $qty) { - if (($line_id = $this->create_line($stockLocation, $line_ext->origin_line_id, $qty, $line_ext->rang, $array_options)) < 0) - { + $line_id = $this->create_line($stockLocation, $line_ext->origin_line_id, $qty, $line_ext->rang, $array_options); + if ($line_id < 0) { $error++; } else { // create shipment batch lines for stockLocation @@ -629,7 +629,7 @@ class Expedition extends CommonObject if (!empty($conf->multicurrency->enabled)) { if (!empty($this->multicurrency_code)) $this->multicurrency_code = $this->thirdparty->multicurrency_code; - if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $this->multicurrency_tx = $this->thirdparty->multicurrency_tx; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($this->thirdparty->multicurrency_tx)) $this->multicurrency_tx = $this->thirdparty->multicurrency_tx; } /* @@ -1081,8 +1081,8 @@ class Expedition extends CommonObject if (isset($this->size_units)) $this->size_units = trim($this->size_units); if (isset($this->weight_units)) $this->weight_units = trim($this->weight_units); if (isset($this->trueWeight)) $this->weight = trim($this->trueWeight); - if (isset($this->note_private)) $this->note = trim($this->note_private); - if (isset($this->note_public)) $this->note = trim($this->note_public); + if (isset($this->note_private)) $this->note_private = trim($this->note_private); + if (isset($this->note_public)) $this->note_public = trim($this->note_public); if (isset($this->model_pdf)) $this->model_pdf = trim($this->model_pdf); @@ -1093,7 +1093,6 @@ class Expedition extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; - $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").","; $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").","; $sql .= " ref_customer=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : "null").","; @@ -2751,7 +2750,7 @@ class ExpeditionLigne extends CommonObjectLine $ranktouse = $this->rang; if ($ranktouse == -1) { - $rangmax = $this->line_max($fk_expedition); + $rangmax = $this->line_max($this->fk_expedition); $ranktouse = $rangmax + 1; } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 1951df8c0e1..b318b44f053 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -511,7 +511,7 @@ if (!empty($arrayfields['t.label']['checked'])) print ''; print ''; } -//Task Description +// Task Description if (!empty($arrayfields['t.description']['checked'])) { print ''; @@ -728,7 +728,7 @@ while ($i < min($num, $limit)) // Project ref if (!empty($arrayfields['p.ref']['checked'])) { - print ''; + print ''; print $projectstatic->getNomUrl(1, 'task'); if ($projectstatic->hasDelay()) print img_warning("Late"); print ''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 77f0e25c945..310bb2aca28 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -402,6 +402,11 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors'); } + if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1 && GETPOST('contact_no_email', 'int')==-1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")), null, 'errors'); + } + if (!$error) { if ($action == 'update') @@ -1176,8 +1181,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $("#email").keyup(function() { init_check_no_email($(this)); }); - init_check_no_email($("#email")); - });'; + init_check_no_email($("#email"));'; } print '});'; print ''."\n"; @@ -1558,6 +1562,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ""; } + if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) + { + print ''.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1); + print img_picto('', 'category').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print ""; + } + // Supplier if (!empty($conf->fournisseur->enabled)) { print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).'';