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/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 ("; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f3049206389..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("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..599e5394399 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..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("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..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("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..e9e9cabd984 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/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/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 183ee457c32..4a4a02e87c4 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -136,7 +136,7 @@ class Facture extends CommonInvoice /** * @var int Date expected for delivery * @deprecated - * @see delivery_date + * @see $delivery_date */ public $date_livraison; @@ -148,7 +148,7 @@ class Facture extends CommonInvoice /** * @var string customer ref * @deprecated - * @see ref_customer + * @see $ref_customer */ public $ref_client; @@ -5421,12 +5421,13 @@ class Facture extends CommonInvoice * Send reminders by emails for ivoices that are due * CAN BE A CRON TASK * - * @param int $nbdays Delay after due date (or before if delay is negative) - * @param string $paymentmode '' or 'all' by default (no filter), or 'LIQ', 'CHQ', CB', ... - * @param int|string $template Name (or id) of email template (Must be a template of type 'facture_send') - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + * @param int $nbdays Delay after due date (or before if delay is negative) + * @param string $paymentmode '' or 'all' by default (no filter), or 'LIQ', 'CHQ', CB', ... + * @param int|string $template Name (or id) of email template (Must be a template of type 'facture_send') + * @param string $forcerecipient Force email of recipient (for example to send the email to an accountant supervisor instead of the customer) + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) */ - public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '') + public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '', $forcerecipient = '') { global $conf, $langs, $user; @@ -5469,11 +5470,11 @@ class Facture extends CommonInvoice $sql .= " WHERE f.paye = 0"; $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; $sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'"; - $sql .= " AND f.entity IN (".getEntity('facture').")"; + $sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing) if (!empty($paymentmode) && $paymentmode != 'all') { $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'"; } - // TODO Add filter to check there is no payment started + // TODO Add a filter to check there is no payment started yet $sql .= $this->db->order("date_lim_reglement", "ASC"); $resql = $this->db->query($sql); @@ -5527,30 +5528,37 @@ class Facture extends CommonInvoice // Recipient $to = array(); - $res = $tmpinvoice->fetch_thirdparty(); - $recipient = $tmpinvoice->thirdparty; - if ($res > 0) { - $tmparraycontact = $tmpinvoice->liste_contact(-1, 'external', 0, 'BILLING'); - if (is_array($tmparraycontact) && count($tmparraycontact) > 0) { - foreach ($tmparraycontact as $data_email) { - if (!empty($data_email['email'])) { - $to[] = $tmpinvoice->thirdparty->contact_get_property($data_email['id'], 'email'); + if ($forcerecipient) { // If a recipient was forced + $to = array($forcerecipient); + } else { + $res = $tmpinvoice->fetch_thirdparty(); + $recipient = $tmpinvoice->thirdparty; + if ($res > 0) { + $tmparraycontact = $tmpinvoice->liste_contact(-1, 'external', 0, 'BILLING'); + if (is_array($tmparraycontact) && count($tmparraycontact) > 0) { + foreach ($tmparraycontact as $data_email) { + if (!empty($data_email['email'])) { + $to[] = $tmpinvoice->thirdparty->contact_get_property($data_email['id'], 'email'); + } } } - } - if (empty($to) && !empty($recipient->email)) { - $to[] = $recipient->email; + if (empty($to) && !empty($recipient->email)) { + $to[] = $recipient->email; + } else { + $errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for user."; + $error++; + } } else { - $errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for user."; + $errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid; $error++; } - } else { - $errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid; - $error++; } // Sender - $from = $conf->global->MAIN_MAIL_EMAIL_FROM; + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + if (!empty($arraymessage->email_from)) { // If a sender is defined into template, we use it in priority + $from = $arraymessage->email_from; + } if (empty($from)) { $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; $error++; @@ -5560,6 +5568,9 @@ class Facture extends CommonInvoice $this->db->begin(); $to = implode(',', $to); + if (!empty($arraymessage->email_to)) { // If a recipient is defined into template, we add it + $to = $to.','.$arraymessage->email_to; + } // Errors Recipient $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO; @@ -5567,8 +5578,18 @@ class Facture extends CommonInvoice $trackid = 'inv'.$tmpinvoice->id; $sendcontext = 'standard'; + $email_tocc = ''; + if (!empty($arraymessage->email_tocc)) { // If a CC is defined into template, we use it + $email_tocc = $arraymessage->email_tocc; + } + + $email_tobcc = ''; + if (!empty($arraymessage->email_tobcc)) { // If a BCC is defined into template, we use it + $email_tobcc = $arraymessage->email_tobcc; + } + // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', $trackid, '', $sendcontext, ''); + $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), $email_tocc, $email_tobcc, 0, 1, $errors_to, '', $trackid, '', $sendcontext, ''); // Sending Mail if ($cMailFile->sendfile()) { 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(); + } } } 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; diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index b6a9140cf58..609458ce839 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -96,6 +96,9 @@ class FormCron extends Form $out .= ''; } + if (empty($readonly)) { + $out .= ajax_combobox($htmlname); + } return $out; } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 41cf2482f9a..aa2ee4b3e6a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1305,9 +1305,9 @@ class FormMail extends Form $languagetosearchmain = ''; } - $sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang"; + $sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang, email_from, email_to, email_tocc, email_tobcc"; $sql .= " FROM ".$dbs->prefix().'c_email_templates'; - $sql .= " WHERE (type_template='".$dbs->escape($type_template)."' OR type_template='all')"; + $sql .= " WHERE (type_template = '".$dbs->escape($type_template)."' OR type_template = 'all')"; $sql .= " AND entity IN (".getEntity('c_email_templates').")"; $sql .= " AND (private = 0 OR fk_user = ".((int) $user->id).")"; // Get all public or private owned if ($active >= 0) { @@ -1728,6 +1728,11 @@ class ModelMail public $lang; public $joinfiles; + public $email_from; + public $email_to; + public $email_tocc; + public $email_tobcc; + /** * @var string Module the template is dedicated for */ 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); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6d2841a08b2..b5ec311b0c5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1159,29 +1159,43 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) } /** - * Create a clone of instance of object (new instance with same value for properties) - * With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object may not be valid. + * Create a clone of instance of object (new instance with same value for each properties) + * With native = 0: Property that are reference are different memory area in the new object (full isolation clone). This means $this->db of new object may not be valid. * With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object. + * With native = 2: Property that are reference are different memory area in the new object (full isolation clone). Only scalar and array values are cloned. This means $this->db of new object is not valid. * * @param object $object Object to clone - * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method+destroy non scalar or array properties (recommended) + * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method keeping only scalar and array properties (recommended) * @return object Clone object * @see https://php.net/manual/language.oop5.cloning.php */ function dol_clone($object, $native = 0) { if ($native == 0) { + // deprecated method, use the method with native = 2 instead $tmpsavdb = null; if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') { $tmpsavdb = $object->db; unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection') } - $myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields + $myclone = unserialize(serialize($object)); // serialize then unserialize is a hack to be sure to have a new object for all fields if (!empty($tmpsavdb)) { $object->db = $tmpsavdb; } + } elseif ($native == 2) { + // recommended method to have a full isolated cloned object + $myclone = new stdClass(); + $tmparray = get_object_vars($object); // return only public properties + + if (is_array($tmparray)) { + foreach ($tmparray as $propertykey => $propertyval) { + if (is_scalar($propertyval) || is_array($propertyval)) { + $myclone->$propertykey = $propertyval; + } + } + } } else { $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable) } @@ -5657,8 +5671,8 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0, * @param integer $form Type of format, HTML or not (not by default) * @param Translate|string $outlangs Object langs for output. '' use default lang. 'none' use international separators. * @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless. - * @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT) - * @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force) + * @param int $rounding MINIMUM number of decimal to show. 0=no change, -1=we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT) + * @param int|string $forcerounding Force the MAXIMUM of decimal to forcerounding decimal (-1=no change, 'MU' or 'MT' or numeric to round to MU or MT or to a given number of decimal) * @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency) * @return string String with formated amount * @@ -5729,8 +5743,14 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ } // If force rounding - if ($forcerounding >= 0) { - $nbdecimal = $forcerounding; + if ((string) $forcerounding != '-1') { + if ($forcerounding == 'MU') { + $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT; + } else if ($forcerounding == 'MT') { + $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT; + } elseif ($forcerounding >= 0) { + $nbdecimal = $forcerounding; + } } // Format number 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/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index b7e6fd15dcb..eaf2d602571 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -372,9 +372,19 @@ if (isset($conf->file->main_authentication) && preg_match('/google/', $conf->fil // Show error message if defined if (!empty($_SESSION['dol_loginmesg'])) { ?> -
- -
+
+ /', $message)) { // if it contains this comment, this is a warning message + $message = str_replace('', '', $message); + print '
'; + } else { + print '
'; + } + print dol_escape_htmltag($message); + print '
'; + ?> +
. */ - if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', 1); } @@ -234,15 +233,19 @@ if (!empty($morelogincontent)) {
- - - trans('SendNewPasswordDesc'); ?> - - -
- trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?> -
- +'; + print $langs->trans('SendNewPasswordDesc'); + print ''; + } +} else { + print '
'; + print $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); + print '
'; +} +?>
diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php new file mode 100644 index 00000000000..1f35b1a251a --- /dev/null +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -0,0 +1,367 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// To show this page, we need parameters: setnewpassword=1&username=...&passworduidhash=... + +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', 1); +} + +// Protection to avoid direct call of template +if (empty($conf) || !is_object($conf)) { + print "Error, template page can't be called as URL"; + exit; +} + +// DDOS protection +$size = (int) $_SERVER['CONTENT_LENGTH']; +if ($size > 10000) { + $langs->loadLangs(array("errors", "install")); + httponly_accessforbidden('
'.$langs->trans("ErrorRequestTooLarge").'
'.$langs->trans("ClickHereToGoToApp").'
', 413, 1); +} + +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +header('Cache-Control: Public, must-revalidate'); +header("Content-type: text/html; charset=".$conf->file->character_set_client); + +if (GETPOST('dol_hide_topmenu')) { + $conf->dol_hide_topmenu = 1; +} +if (GETPOST('dol_hide_leftmenu')) { + $conf->dol_hide_leftmenu = 1; +} +if (GETPOST('dol_optimize_smallscreen')) { + $conf->dol_optimize_smallscreen = 1; +} +if (GETPOST('dol_no_mouse_hover')) { + $conf->dol_no_mouse_hover = 1; +} +if (GETPOST('dol_use_jmobile')) { + $conf->dol_use_jmobile = 1; +} + +// If we force to use jmobile, then we reenable javascript +if (!empty($conf->dol_use_jmobile)) { + $conf->use_javascript_ajax = 1; +} + +$php_self = $_SERVER['PHP_SELF']; +$php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''; +$php_self = str_replace('action=validatenewpassword', '', $php_self); + +$titleofpage = $langs->trans('ResetPassword'); + +// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second +$arrayofjs = array(); + +$disablenofollow = 1; +if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) { + $disablenofollow = 0; +} +if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $disablenofollow = 0; +} + +print top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow); + + +$colorbackhmenu1 = '60,70,100'; // topmenu +if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) { + $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; +} +$colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (empty($conf->global->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $conf->global->THEME_ELDY_TOPMENU_BACK1) : (empty($user->conf->THEME_ELDY_TOPMENU_BACK1) ? $colorbackhmenu1 : $user->conf->THEME_ELDY_TOPMENU_BACK1); +$colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' + + +$edituser = new User($db); + + +// Validate parameters +if ($setnewpassword && $username && $passworduidhash) { + $result = $edituser->fetch('', $username); + if ($result < 0) { + $message = '
'.dol_escape_htmltag($langs->trans("ErrorTechnicalError")).'
'; + } else { + global $dolibarr_main_instance_unique_id; + + //print $edituser->pass_temp.'-'.$edituser->id.'-'.$dolibarr_main_instance_unique_id.' '.$passworduidhash; + if ($edituser->pass_temp && dol_verifyHash($edituser->pass_temp.'-'.$edituser->id.'-'.$dolibarr_main_instance_unique_id, $passworduidhash)) { + // Clear session + unset($_SESSION['dol_login']); + + // Parameters to reset the user are validated + } else { + $langs->load("errors"); + $message = '
'.$langs->trans("ErrorFailedToValidatePasswordReset").'
'; + } + } +} else { + $langs->load("errors"); + $message = '
'.$langs->trans("ErrorFailedToValidatePasswordReset").'
'; +} + + +?> + + +global->MAIN_LOGIN_BACKGROUND) ? '' : ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> + +dol_use_jmobile)) { ?> + + + + + + + + + + diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index 94b4b861e86..6a05551d333 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -103,7 +103,23 @@ class InterfaceWebhookTriggers extends DolibarrTriggers foreach ($target_url as $key => $tmpobject) { $actionarray = explode(",", $tmpobject->trigger_codes); if (is_array($actionarray) && in_array($action, $actionarray)) { - $jsonstr = '{"triggercode":'.json_encode($action).',"object":'.json_encode($object).'}'; + // Build the answer object + $resobject = new stdClass(); + $resobject->triggercode = $action; + $resobject->object = dol_clone($object, 2); + + if (property_exists($resobject->object, 'fields')) { + unset($resobject->object->fields); + } + if (property_exists($resobject->object, 'error')) { + unset($resobject->object->error); + } + if (property_exists($resobject->object, 'errors')) { + unset($resobject->object->errors); + } + + $jsonstr = json_encode($resobject); + $response = getURLContent($tmpobject->url, 'POST', $jsonstr, 1, array(), array('http', 'https'), 0, -1); if (empty($response['curl_error_no']) && $response['http_code'] >= 200 && $response['http_code'] < 300) { $nbPosts ++; diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 5de627a9a9a..9900db2c9d6 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -493,7 +493,7 @@ if (($action == "create") || ($action == "edit")) { if (!empty($object->datestart)) { print $form->selectDate($object->datestart, 'datestart', 1, 1, '', "cronform"); } else { - print $form->selectDate(-1, 'datestart', 1, 1, '', "cronform"); + print $form->selectDate(-1, 'datestart', 1, 1, 1, "cronform"); } print ""; print ""; @@ -505,7 +505,7 @@ if (($action == "create") || ($action == "edit")) { if (!empty($object->dateend)) { print $form->selectDate($object->dateend, 'dateend', 1, 1, '', "cronform"); } else { - print $form->selectDate(-1, 'dateend', 1, 1, '', "cronform"); + print $form->selectDate(-1, 'dateend', 1, 1, 1, "cronform"); } print ""; print ""; @@ -518,7 +518,7 @@ if (($action == "create") || ($action == "edit")) { if (!empty($object->priority)) { $priority = $object->priority; } - print " "; + print ' '; print ""; print ""; print ""; @@ -530,7 +530,7 @@ if (($action == "create") || ($action == "edit")) { $maxrun = $object->maxrun; } print $langs->trans('CronMaxRun').""; - print " "; + print ' '; print ""; print ""; print ""; @@ -538,12 +538,12 @@ if (($action == "create") || ($action == "edit")) { print ''; print $langs->trans('CronDtNextLaunch'); - print ' ('.$langs->trans('CronFrom').')'; + //print ' ('.$langs->trans('CronFrom').')'; print ""; if (!empty($object->datenextrun)) { print $form->selectDate($object->datenextrun, 'datenextrun', 1, 1, '', "cronform"); } else { - print $form->selectDate(-1, 'datenextrun', 1, 1, '', "cronform"); + print $form->selectDate(-1, 'datenextrun', 1, 1, '', "cronform", 1, 1); } print ""; print ""; @@ -774,7 +774,7 @@ if (($action == "create") || ($action == "edit")) { print ''; print $langs->trans('CronLastOutput').""; - print nl2br($object->lastoutput); + print ''.nl2br($object->lastoutput).''; print ""; print ''; @@ -787,7 +787,7 @@ if (($action == "create") || ($action == "edit")) { print dol_get_fiche_end(); - print "\n\n
\n"; + print "\n\n".'
'."\n"; if (!$user->rights->cron->create) { print ''.$langs->trans("Edit").''; } else { diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index a2c3b1d4807..ae53242d836 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -420,7 +420,7 @@ if (!empty($conf->global->CRON_WARNING_DELAY_HOURS)) { $text .= $langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS); } print info_admin($text); -print '
'; +//print '
'; //$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = ''; @@ -447,7 +447,7 @@ print ' '; print ''; print ' '; print ' '; -print ''; +print ''; print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Scheduled")), $search_status, 1); print ''; $searchpicto = $form->showFilterButtons(); @@ -460,18 +460,18 @@ print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "t.rowid", "", $param, '', print_liste_field_titre("CronLabel", $_SERVER["PHP_SELF"], "t.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Prority", $_SERVER["PHP_SELF"], "t.priority", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("CronModule", $_SERVER["PHP_SELF"], "t.module_name", "", $param, '', $sortfield, $sortorder); -print_liste_field_titre("CronType", '', '', "", $param, '', $sortfield, $sortorder); +print_liste_field_titre("CronType", '', '', "", $param, '', $sortfield, $sortorder, 'tdoverflowmax100 '); print_liste_field_titre("CronFrequency", '', "", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("CronDtStart", $_SERVER["PHP_SELF"], "t.datestart", "", $param, 'align="center"', $sortfield, $sortorder); //print_liste_field_titre("CronDtEnd", $_SERVER["PHP_SELF"], "t.dateend", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("CronNbRun", $_SERVER["PHP_SELF"], "t.nbrun", "", $param, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre("CronDtLastLaunch", $_SERVER["PHP_SELF"], "t.datelastrun", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("CronLastResult", $_SERVER["PHP_SELF"], "t.lastresult", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("CronNbRun", $_SERVER["PHP_SELF"], "t.nbrun", "", $param, '', $sortfield, $sortorder, 'right tdoverflowmax50'); +print_liste_field_titre("CronDtLastLaunch", $_SERVER["PHP_SELF"], "t.datelastrun", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("CronLastResult", $_SERVER["PHP_SELF"], "t.lastresult", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("CronLastOutput", $_SERVER["PHP_SELF"], "t.lastoutput", "", $param, '', $sortfield, $sortorder); -print_liste_field_titre("CronDtNextLaunch", $_SERVER["PHP_SELF"], "t.datenextrun", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "t.status,t.priority", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +print_liste_field_titre("CronDtNextLaunch", $_SERVER["PHP_SELF"], "t.datenextrun", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "t.status,t.priority", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -560,19 +560,20 @@ if ($num > 0) { print $form->textwithpicto($text, $texttoshow, 1); print ''; - print ''; + $s = ''; if ($obj->unitfrequency == "60") { - print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Minutes'); - } - if ($obj->unitfrequency == "3600") { - print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Hours'); - } - if ($obj->unitfrequency == "86400") { - print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Days'); - } - if ($obj->unitfrequency == "604800") { - print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Weeks'); + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Minutes') : $langs->trans('Minute')); + } elseif ($obj->unitfrequency == "3600") { + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Hours') : $langs->trans('Hour')); + } elseif ($obj->unitfrequency == "86400") { + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Days') : $langs->trans('Day')); + } elseif ($obj->unitfrequency == "604800") { + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Weeks') : $langs->trans('Week')); + } elseif ($obj->unitfrequency == "2678400") { + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Months') : $langs->trans('Month')); } + print ''; + print $s; print ''; /* 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; 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..6ace02525ec 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 @@ -337,6 +338,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 diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e963f8206be..dae72d3d703 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1843,7 +1843,7 @@ StockDecreaseForPointOfSaleDisabledbyBatch=Stock decrease in POS is not compatib CashDeskYouDidNotDisableStockDecease=You did not disable stock decrease when making a sale from Point of Sale. Hence a warehouse is required. CashDeskForceDecreaseStockLabel=Stock decrease for batch products was forced. CashDeskForceDecreaseStockDesc=Decrease first by the oldest eatby and sellby dates. -CashDeskReaderKeyCodeForEnter=Key code for "Enter" defined in barcode reader (Example: 13) +CashDeskReaderKeyCodeForEnter=Key ASCII code for "Enter" defined in barcode reader (Example: 13) ##### Bookmark ##### BookmarkSetup=Bookmark module setup BookmarkDesc=This module allows you to manage bookmarks. You can also add shortcuts to any Dolibarr pages or external web sites on your left menu. @@ -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 @@ -2335,4 +2337,4 @@ LimitsAndMitigation=Access limits and mitigation DesktopsOnly=Desktops only DesktopsAndSmartphones=Desktops et smartphones AllowOnlineSign=Allow online signing -AllowExternalDownload=Allow external download (without login, using a shared link) \ No newline at end of file +AllowExternalDownload=Allow external download (without login, using a shared link) diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 5e4da60f0f2..19572c361ad 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -26,7 +26,7 @@ CronCommand=Command CronList=Scheduled jobs CronDelete=Delete scheduled jobs CronConfirmDelete=Are you sure you want to delete these scheduled jobs? -CronExecute=Launch scheduled job +CronExecute=Launch now CronConfirmExecute=Are you sure you want to execute these scheduled jobs now? CronInfo=Scheduled job module allows to schedule jobs to execute them automatically. Jobs can also be started manually. CronTask=Job @@ -58,7 +58,7 @@ CronNote=Comment CronFieldMandatory=Fields %s is mandatory CronErrEndDateStartDt=End date cannot be before start date StatusAtInstall=Status at module installation -CronStatusActiveBtn=Schedule +CronStatusActiveBtn=Enable scheduling CronStatusInactiveBtn=Disable CronTaskInactive=This job is disabled (not scheduled) CronId=Id diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 46cb61ff3f0..d5701ba2224 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -181,6 +181,7 @@ SizeUnitfoot=foot SizeUnitpoint=point BugTracker=Bug tracker SendNewPasswordDesc=This form allows you to request a new password. It will be sent to your email address.
Change will become effective once you click on the confirmation link in the email.
Check your inbox. +EnterNewPasswordHere=Enter your new password here BackToLoginPage=Back to login page AuthenticationDoesNotAllowSendNewPassword=Authentication mode is %s.
In this mode, Dolibarr can't know nor change your password.
Contact your system administrator if you want to change your password. EnableGDLibraryDesc=Install or enable GD library on your PHP installation to use this option. diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 5332b8123e0..b575e7fcd4b 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -271,7 +271,7 @@ InventoryStartedShort=Started ErrorOnElementsInventory=Operation canceled for the following reason: ErrorCantFindCodeInInventory=Can't find the following code in inventory QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool. -StockChangeDisabled=Change on stock disabled +StockChangeDisabled=Stock change disabled NoWarehouseDefinedForTerminal=No warehouse defined for terminal ClearQtys=Clear all quantities ModuleStockTransferName=Advanced Stock Transfer 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).","; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 095eaee313f..81fcb2db701 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -789,6 +789,7 @@ if ($action == 'create') { print $langs->trans("CorrectStock"); print ""; } + if (!empty($conf->global->PRODUCT_USE_UNITS)) { if ($i == 0) { $units = $productstatic->fk_unit; @@ -796,11 +797,13 @@ if ($action == 'create') { $sameunits = false; } } + print ""; $i++; } $db->free($resql); + // Total print ''.$langs->trans("Total").''; print ''; $valtoshow = price2num($totalunit, 'MS'); @@ -818,9 +821,15 @@ if ($action == 'create') { print ' '; print ''.price(price2num($totalvaluesell, 'MT')).''; } - print ' '; - print ' '; - print ' '; + + if ($user->rights->stock->mouvement->creer) { + print ' '; + } + + if ($user->rights->stock->creer) { + print ' '; + } + print ''; } else { dol_print_error($db); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 9afa6ec57d8..9fdae4e0cc7 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -358,6 +358,7 @@ if (empty($reshook)) { $batch = "batch".$i; $cost_price = "cost_price".$i; + //if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS')) || (GETPOST($qty, 'int') < 0 && getDolGlobalString('RECEPTION_ALLOW_NEGATIVE_QTY'))) { if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS)) { $ent = "entl".$i; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 1abfb49fb4c..ebb50154eda 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -571,7 +571,7 @@ class Reception extends CommonObject $qty = $obj->qty; - if ($qty <= 0) { + if ($qty == 0 || ($qty < 0 && !getDolGlobalInt('RECEPTION_ALLOW_NEGATIVE_QTY'))) { continue; } dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 155e5185f57..58df4aaaa70 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,22 @@ 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_billed = ''; $search_status = ''; $search_array_options = array(); @@ -545,6 +577,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 +677,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 +895,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 +923,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 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; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index d5ef1057905..dfb5f5ee279 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1725,7 +1725,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['s.fk_stcomm']['checked'])) { // Prospect status - print '
'; + print '
'; print '
'; print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto); print '
-
'; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index c511d3e0529..fe03139c8a3 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -338,7 +338,7 @@ if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlob print ''.$langs->trans('CashDeskReaderKeyCodeForEnter').''; print ''; -print ''; +print ''; print ''; // Numbering module diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index ec21eea2d60..6f72fa6e7f2 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -554,6 +554,7 @@ div.description_content { padding: 7px 4px 7px 4px; margin: 8px; margin-left: 4px; + border-radius: 3px; } .topnav-left a:hover, .topnav .login_block_other a:hover { background-color: #ddd; @@ -580,6 +581,14 @@ div#moreinfo, div#infowarehouse { padding: 0 8px 0 8px; } +.basketselected { + font-weight: bold; + /* text-decoration: underline; */ +} +.basketnotselected { + opacity: 0.8; +} + .productprice { position: absolute; top: 5px; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 17c4f14060c..dc2bd8b684a 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -583,8 +583,9 @@ function New() { /** * Search products * - * @param {int} keyCodeForEnter Key code for "enter" - * return {void} + * @param string keyCodeForEnter Key code for "enter" or '' if not + * @param int moreorless ?? + * return void */ function Search2(keyCodeForEnter, moreorless) { var eventKeyCode = window.event.keyCode; @@ -599,6 +600,8 @@ function Search2(keyCodeForEnter, moreorless) { search_start = $('#search_start_'+moreorless).val(); } + console.log("search_term="+search_term); + if (search_term == '') { $("[id^=prowatermark]").html(""); $("[id^=prodesc]").text(""); @@ -612,7 +615,7 @@ function Search2(keyCodeForEnter, moreorless) { } var search = false; - if (keyCodeForEnter != '' || eventKeyCode == keyCodeForEnter) { + if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) { search = true; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 47af7d16260..d1f99fc4ab0 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1177,12 +1177,12 @@ $( document ).ready(function() { echo $obj->rowid; echo '\\\'; Refresh();">'; if ($placeid == $obj->rowid) { - echo ""; + echo ''; + } else { + echo ''; } echo ''.dol_print_date($db->jdate($obj->datec), '%H:%M', 'tzuser'); - if ($placeid == $obj->rowid) { - echo ""; - } + echo ''; echo '\');'; } echo '$("#shoppingcart").append(\'country_code).': '.price($line->total_tva); $moreinfo .= '
'.$langs->transcountry("TotalLT1", $mysoc->country_code).': '.price($line->total_localtax1); $moreinfo .= '
'.$langs->transcountry("TotalLT2", $mysoc->country_code).': '.price($line->total_localtax2); - $moreinfo .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).': '.price($line->total_ttc); + $moreinfo .= '
'; + $moreinfo .= $langs->transcountry("TotalTTC", $mysoc->country_code).': '.price($line->total_ttc); //$moreinfo .= $langs->trans("TotalHT").': '.$line->total_ht; if ($line->date_start || $line->date_end) { $htmlforlines .= '
'.get_date_range($line->date_start, $line->date_end).'
'; @@ -1688,7 +1689,7 @@ if (($action == "valid" || $action == "history") && $invoice->type != Facture::T if ($action == "search") { print '
- +
'; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 238724f7ae0..5a5a5d6fc9e 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2111,7 +2111,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; // Firstname - print "".''.$langs->trans("Firstname").''; + print ''.$langs->trans("Firstname").''; print ''; if ($caneditfield && !$object->ldap_sid) { print ''; @@ -2239,7 +2239,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; // Hierarchy - print ''.$langs->trans("HierarchicalResponsible").''; + print ''.$langs->trans("HierarchicalResponsible").''; print ''; if ($caneditfield) { print img_picto('', 'user').$form->select_dolusers($object->fk_user, 'fk_user', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); @@ -2254,7 +2254,7 @@ if ($action == 'create' || $action == 'adduserldap') { // Expense report validator if (isModEnabled('expensereport')) { - print ''; + print ''; $text = $langs->trans("ForceUserExpenseValidator"); print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); print ''; @@ -2273,7 +2273,7 @@ if ($action == 'create' || $action == 'adduserldap') { // Holiday request validator if (isModEnabled('holiday')) { - print ''; + print ''; $text = $langs->trans("ForceUserHolidayValidator"); print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help'); print ''; @@ -2336,8 +2336,11 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; - print '
'; + print '
'; + print '
'; + + print ''; // Date access validity print ''; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 658c45a3753..96054b0d802 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -51,6 +51,8 @@ if (!$mode) { $username = GETPOST('username', 'alphanohtml'); $passworduidhash = GETPOST('passworduidhash', 'alpha'); +$setnewpassword = GETPOST('setnewpassword', 'aZ09'); + $conf->entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : 1); // Instantiate hooks of thirdparty module only if not already define @@ -90,7 +92,7 @@ if (empty($reshook)) { $edituser = new User($db); $result = $edituser->fetch('', $username); if ($result < 0) { - $message = '
'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'
'; + $message = '
'.dol_escape_htmltag($langs->trans("ErrorTechnicalError")).'
'; } else { global $dolibarr_main_instance_unique_id; @@ -98,7 +100,7 @@ if (empty($reshook)) { if ($edituser->pass_temp && dol_verifyHash($edituser->pass_temp.'-'.$edituser->id.'-'.$dolibarr_main_instance_unique_id, $passworduidhash)) { // Clear session unset($_SESSION['dol_login']); - $_SESSION['dol_loginmesg'] = $langs->transnoentitiesnoconv('NewPasswordValidated'); // Save message for the session page + $_SESSION['dol_loginmesg'] = ''.$langs->transnoentitiesnoconv('NewPasswordValidated'); // Save message for the session page $newpassword = $edituser->setPassword($user, $edituser->pass_temp, 0); dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database"); @@ -111,7 +113,8 @@ if (empty($reshook)) { } } } - // Action modif mot de passe + + // Action to set a temporary password and send email for reset if ($action == 'buildnewpassword' && $username) { $sessionkey = 'dol_antispam_value'; $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code')))); @@ -235,4 +238,8 @@ $parameters = array('entity' => GETPOST('entity', 'int')); $reshook = $hookmanager->executeHooks('getPasswordForgottenPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks. $moreloginextracontent = $hookmanager->resPrint; -include $template_dir.'passwordforgotten.tpl.php'; // To use native PHP +if (empty($setnewpassword)) { + include $template_dir.'passwordforgotten.tpl.php'; // To use native PHP +} else { + include $template_dir.'passwordreset.tpl.php'; // To use native PHP +} 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 '
'.$langs->trans("RangeOfLoginValidity").'
'; print dol_get_fiche_end(); diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 30d541f33af..ba33f2b8995 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -105,6 +105,8 @@ class Target extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'index'=>1, 'searchall'=>1, 'validate'=>'1', 'comment'=>"Reference of object"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1',), + 'url' => array('type'=>'varchar(255)', 'label'=>'Url', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>1,), + 'trigger_codes' => array('type'=>'text', 'label'=>'TriggerCodes', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'help'=>"TriggerCodeInfo",), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',), @@ -113,9 +115,7 @@ class Target extends CommonObject 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>3, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validé', '9'=>'Annulé'), 'validate'=>'1',), - 'url' => array('type'=>'varchar(255)', 'label'=>'Url', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>1,), - 'trigger_codes' => array('type'=>'text', 'label'=>'TriggerCodes', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>1, 'help'=>"TriggerCodeInfo",), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled'), 'validate'=>'1',), ); public $rowid; public $ref; diff --git a/htdocs/webhook/lib/webhook_target.lib.php b/htdocs/webhook/lib/webhook_target.lib.php index 894e3134c0c..da342da0065 100644 --- a/htdocs/webhook/lib/webhook_target.lib.php +++ b/htdocs/webhook/lib/webhook_target.lib.php @@ -38,49 +38,6 @@ function targetPrepareHead($object) $head[$h][2] = 'card'; $h++; - if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { - $nbNote = 0; - if (!empty($object->note_private)) { - $nbNote++; - } - if (!empty($object->note_public)) { - $nbNote++; - } - $head[$h][0] = dol_buildpath('/webhook/target_note.php', 1).'?id='.$object->id; - $head[$h][1] = $langs->trans('Notes'); - if ($nbNote > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.$nbNote.'' : ''); - } - $head[$h][2] = 'note'; - $h++; - } - - /*require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->webhook->dir_output."/target/".dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); - $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/webhook/target_document.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans('Documents'); - if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; - } - $head[$h][2] = 'document'; - $h++;*/ - - /*$head[$h][0] = dol_buildpath("/webhook/target_agenda.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans("Events"); - $head[$h][2] = 'agenda'; - $h++;*/ - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - //$this->tabs = array( - // 'entity:+tabname:Title:@webhook:/webhook/mypage.php?id=__ID__' - //); // to add new tab - //$this->tabs = array( - // 'entity:-tabname:Title:@webhook:/webhook/mypage.php?id=__ID__' - //); // to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'target@webhook'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'target@webhook', 'remove'); diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 35e18a9cdbc..83f2008703f 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -160,8 +160,6 @@ if (empty($reshook)) { /* * View - * - * Put here all code to build page */ $form = new Form($db); @@ -459,25 +457,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - if (empty($user->socid)) { + /*if (empty($user->socid)) { print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); - } - - // Back to draft - if ($object->status == $object::STATUS_VALIDATED) { - print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); - } + }*/ print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); - // Validate + // Disable + if ($object->status == $object::STATUS_VALIDATED) { + print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); + } + + // Enable if ($object->status == $object::STATUS_DRAFT) { - if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); - } else { - $langs->load("errors"); - print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); - } + print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); } // Clone @@ -505,61 +498,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print '
'."\n"; } - - - // Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } - - if ($action != 'presend') { - print '
'; - print ''; // ancre - - $includedocgeneration = 0; - - // Documents - if ($includedocgeneration) { - $objref = dol_sanitizeFileName($object->ref); - $relativepath = $objref.'/'.$objref.'.pdf'; - $filedir = $conf->webhook->dir_output.'/'.$object->element.'/'.$objref; - $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $permissiontoread; // If you can read, you can build the PDF to read content - $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('webhook:Target', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); - } - - // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('target')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - - - print '
'; - - $MAXEVENT = 10; - - $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/webhook/target_agenda.php', 1).'?id='.$object->id); - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); - - print '
'; - } - - //Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } - - // Presend form - $modelmail = 'target'; - $defaulttopic = 'InformationMessage'; - $diroutput = $conf->webhook->dir_output; - $trackid = 'target'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } // End of page diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index 5d81bec967f..1db73639103 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -48,10 +48,12 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'ta $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $mode = GETPOST('mode', 'aZ'); +if (empty($mode)) { + $mode = 'modulesetup'; +} $id = GETPOST('id', 'int'); - // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); diff --git a/htdocs/webhook/target_note.php b/htdocs/webhook/target_note.php deleted file mode 100644 index e09ace533a9..00000000000 --- a/htdocs/webhook/target_note.php +++ /dev/null @@ -1,174 +0,0 @@ - - * Copyright (C) 2022 Frédéric France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/webhook/target_note.php - * \ingroup webhook - * \brief Tab for notes on Target - */ - -// Load Dolibarr environment -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/webhook/class/target.class.php'; -require_once DOL_DOCUMENT_ROOT.'/webhook/lib/webhook_target.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('companies')); - -// Get parameters -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); - -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); - -// Initialize technical objects -$object = new Target($db); -$extrafields = new ExtraFields($db); -$diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('targetnote', 'globalcard')); // Note that conf->hooks_modules contains array - -// Fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label($object->table_element); - -// Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->webhook->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; -} - -// Permissions -// There is several ways to check permission. -// Set $enablepermissioncheck to 1 to enable a minimum low level of checks -$enablepermissioncheck = 0; -if ($enablepermissioncheck) { - $permissiontoread = $user->rights->webhook->target->read; - $permissiontoadd = $user->rights->webhook->target->write; - $permissionnote = $user->rights->webhook->target->write; // Used by the include of actions_setnotes.inc.php -} else { - $permissiontoread = 1; - $permissiontoadd = 1; - $permissionnote = 1; -} - -// Security check (enable the most restrictive one) -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (!isModEnabled('webhook') || !$permissiontoread) { - accessforbidden(); -} - - -/* - * Actions - */ - -$parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -} -if (empty($reshook)) { - include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once -} - - -/* - * View - */ - -$form = new Form($db); - -//$help_url='EN:Webhooks|FR:Webhooks_FR|ES:Webhooks_ES'; -$help_url = ''; -$title = $langs->trans('Target').' - '.$langs->trans("Notes"); -llxHeader('', $title, $help_url); - -if ($id > 0 || !empty($ref)) { - $object->fetch_thirdparty(); - - $head = targetPrepareHead($object); - - print dol_get_fiche_head($head, 'note', $langs->trans("Target"), -1, $object->picto); - - // Object card - // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; - - $morehtmlref = '
'; - /* - // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); - // Project - if (isModEnabled('projet')) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($permissiontoadd) - { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(); - } else { - $morehtmlref .= ''; - } - } - }*/ - $morehtmlref .= '
'; - - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - - print '
'; - print '
'; - - - $cssclass = "titlefield"; - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - - print '
'; - - print dol_get_fiche_end(); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 5357f7c8061..12c8683bb8f 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -188,6 +188,8 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase $this->assertEquals($this->savdb->connected, 1, 'Savdb is connected'); $this->assertNotNull($newproduct1->db->db, 'newproduct1->db is not null'); + $newproductcloned2 = dol_clone($newproduct1, 2); + var_dump($newproductcloned2); //print __METHOD__." newproductcloned1->db must be null\n"; //$this->assertNull($newproductcloned1->db, 'newproductcloned1->db is null'); }