Merge branch 'develop' of github.com:Dolibarr/dolibarr into develop

This commit is contained in:
Laurent Destailleur 2022-11-07 20:26:22 +01:00
commit 32e1d2b023
49 changed files with 827 additions and 437 deletions

View File

@ -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') {

View File

@ -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 (";

View File

@ -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") . '<br>';
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';

View File

@ -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").'<br>';
$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$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);

View File

@ -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 = '';

View File

@ -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 = '';

View File

@ -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

View File

@ -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);
}

View File

@ -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()) {

View File

@ -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();
}
}
}

View File

@ -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;

View File

@ -96,6 +96,9 @@ class FormCron extends Form
$out .= '</SELECT>';
}
if (empty($readonly)) {
$out .= ajax_combobox($htmlname);
}
return $out;
}

View File

@ -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
*/

View File

@ -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);

View File

@ -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

View File

@ -102,7 +102,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$texte .= '<input type="hidden" name="param2" value="COMPANY_DIGITARIA_MASK_CUSTOMER">';
$texte .= '<input type="hidden" name="param3" value="COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER">';
$texte .= '<input type="hidden" name="param4" value="COMPANY_DIGITARIA_MASK_NBCHARACTER_CUSTOMER">';
$texte .= '<table class="nobordernopadding" width="100%">';
$texte .= '<input type="hidden" name="param5" value="COMPANY_DIGITARIA_CLEAN_WORDS">';
$texte .= '<table class="nobordernopadding centpercent">';
$s1 = $form->textwithpicto('<input type="text" class="flat" size="4" name="value1" value="'.$conf->global->COMPANY_DIGITARIA_MASK_SUPPLIER.'">', $tooltip, 1, 1);
$s2 = $form->textwithpicto('<input type="text" class="flat" size="4" name="value2" value="'.$conf->global->COMPANY_DIGITARIA_MASK_CUSTOMER.'">', $tooltip, 1, 1);
$s3 = $form->textwithpicto('<input type="text" class="flat" size="2" name="value3" value="'.$conf->global->COMPANY_DIGITARIA_MASK_NBCHARACTER_SUPPLIER.'">', $tooltip, 1, 1);
@ -127,7 +128,23 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
}
$texte .= '</td>';
$texte .= '<td class="right"><input type="submit" class="button button-edit reposition" name="modify" value="'.$langs->trans("Modify").'"></td>';
$texte .= '</tr>';
$texte .= '<tr><td>';
$texte .= "<br>\n";
$texthelp = $langs->trans("RemoveSpecialWordsHelp");
$texttitle = $langs->trans("RemoveSpecialWords");
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= "<br>\n";
$texte .= '<textarea class="flat" cols="60" name="value5">';
if (!empty($conf->global->COMPANY_DIGITARIA_CLEAN_WORDS)) {
$texte .= $conf->global->COMPANY_DIGITARIA_CLEAN_WORDS;
}
$texte .= '</textarea>';
$texte .= '</tr></table>';
$texte .= '</form>';
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) {

View File

@ -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'])) {
?>
<div class="center login_main_message"><div class="error">
<?php echo dol_escape_htmltag($_SESSION['dol_loginmesg']); ?>
</div></div>
<div class="center login_main_message">
<?php
$message = $_SESSION['dol_loginmesg']; // By default this is an error message
if (preg_match('/<!-- warning -->/', $message)) { // if it contains this comment, this is a warning message
$message = str_replace('<!-- warning -->', '', $message);
print '<div class="warning">';
} else {
print '<div class="error">';
}
print dol_escape_htmltag($message);
print '</div>';
?>
</div>
<?php
}

View File

@ -16,7 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', 1);
}
@ -234,15 +233,19 @@ if (!empty($morelogincontent)) {
<div class="center login_main_home divpasswordmessagedesc paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent boxshadow'; ?>" style="max-width: 70%">
<?php if ($mode == 'dolibarr' || !$disabled) { ?>
<span class="passwordmessagedesc">
<?php echo $langs->trans('SendNewPasswordDesc'); ?>
</span>
<?php } else { ?>
<div class="warning center">
<?php echo $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode); ?>
</div>
<?php } ?>
<?php
if ($mode == 'dolibarr' || !$disabled) {
if ($action != 'validatenewpassword' && empty($message)) {
print '<span class="passwordmessagedesc opacitymedium">';
print $langs->trans('SendNewPasswordDesc');
print '</span>';
}
} else {
print '<div class="warning center">';
print $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode);
print '</div>';
}
?>
</div>

View File

@ -0,0 +1,367 @@
<?php
/* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 <https://www.gnu.org/licenses/>.
*/
// 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('<center>'.$langs->trans("ErrorRequestTooLarge").'<br><a href="'.DOL_URL_ROOT.'">'.$langs->trans("ClickHereToGoToApp").'</a></center>', 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 = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorTechnicalError")).'</div>';
} 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 = '<div class="error">'.$langs->trans("ErrorFailedToValidatePasswordReset").'</div>';
}
}
} else {
$langs->load("errors");
$message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePasswordReset").'</div>';
}
?>
<!-- BEGIN PHP TEMPLATE PASSWORDFORGOTTEN.TPL.PHP -->
<body class="body bodylogin"<?php print empty($conf->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).'\')"'; ?>>
<?php if (empty($conf->dol_use_jmobile)) { ?>
<script>
$(document).ready(function () {
// Set focus on correct field
<?php if ($focus_element) {
?>$('#<?php echo $focus_element; ?>').focus(); <?php
} ?> // Warning to use this only on visible element
});
</script>
<?php } ?>
<div class="login_center center"<?php print empty($conf->global->MAIN_LOGIN_BACKGROUND) ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));"' : '' ?>>
<div class="login_vertical_align">
<form id="login" name="login" method="POST" action="<?php echo $php_self; ?>">
<input type="hidden" name="token" value="<?php echo newToken(); ?>">
<input type="hidden" name="action" value="buildnewpassword">
<!-- Title with version -->
<div class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<?php
if (!empty($disablenofollow)) {
echo '<a class="login_table_title" href="https://www.dolibarr.org" target="_blank" rel="noopener noreferrer external">';
}
echo dol_escape_htmltag($title);
if (!empty($disablenofollow)) {
echo '</a>';
}
?>
</div>
<div class="login_table">
<div id="login_line1">
<div id="login_left">
<img alt="" title="" src="<?php echo $urllogo; ?>" id="img_logo" />
</div>
<br>
<div id="login_right">
<div class="tagtable centpercent" title="Login pass" >
<!-- New pass 1 -->
<div class="trinputlogin">
<div class="tagtd nowraponall center valignmiddle tdinputlogin">
<!-- <span class="span-icon-user">-->
<span class="fa fa-user"></span>
<input type="text" maxlength="255" placeholder="<?php echo $langs->trans("NewPassword"); ?>" <?php echo $disabled; ?> id="newpass1" name="newpass1" class="flat input-icon-user minwidth150" value="<?php echo dol_escape_htmltag($newpass1); ?>" tabindex="1" autofocus />
</div>
</div>
<div class="trinputlogin">
<div class="tagtd nowraponall center valignmiddle tdinputlogin">
<!-- <span class="span-icon-user">-->
<span class="fa fa-user"></span>
<input type="text" maxlength="255" placeholder="<?php echo $langs->trans("PasswordRetype"); ?>" <?php echo $disabled; ?> id="newpass2" name="newpass2" class="flat input-icon-user minwidth150" value="<?php echo dol_escape_htmltag($newpass2); ?>" tabindex="1" />
</div>
</div>
<?php
$captcha = 0;
if (!empty($captcha)) {
// Add a variable param to force not using cache (jmobile)
$php_self = preg_replace('/[&\?]time=(\d+)/', '', $php_self); // Remove param time
if (preg_match('/\?/', $php_self)) {
$php_self .= '&time='.dol_print_date(dol_now(), 'dayhourlog');
} else {
$php_self .= '?time='.dol_print_date(dol_now(), 'dayhourlog');
}
// TODO: provide accessible captcha variants
?>
<!-- Captcha -->
<div class="trinputlogin">
<div class="tagtd tdinputlogin nowrap none valignmiddle">
<span class="fa fa-unlock"></span>
<span class="nofa inline-block">
<input id="securitycode" placeholder="<?php echo $langs->trans("SecurityCode"); ?>" class="flat input-icon-security width125" type="text" maxlength="5" name="code" tabindex="3" autocomplete="off" />
</span>
<span class="nowrap inline-block">
<img class="inline-block valignmiddle" src="<?php echo DOL_URL_ROOT ?>/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />
<a class="inline-block valignmiddle" href="<?php echo $php_self; ?>" tabindex="4"><?php echo $captcha_refresh; ?></a>
</span>
</div></div>
<?php
}
if (!empty($morelogincontent)) {
if (is_array($morelogincontent)) {
foreach ($morelogincontent as $format => $option) {
if ($format == 'table') {
echo '<!-- Option by hook -->';
echo $option;
}
}
} else {
echo '<!-- Option by hook -->';
echo $morelogincontent;
}
}
?>
</div>
</div> <!-- end div login_right -->
</div> <!-- end div login_line1 -->
<div id="login_line2" style="clear: both">
<!-- Button "Regenerate and Send password" -->
<br><input type="submit" <?php echo $disabled; ?> class="button small" name="button_password" value="<?php echo $langs->trans('Save'); ?>" tabindex="4" />
<br>
<div class="center" style="margin-top: 15px;">
<?php
$moreparam = '';
if (!empty($conf->dol_hide_topmenu)) {
$moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_topmenu='.$conf->dol_hide_topmenu;
}
if (!empty($conf->dol_hide_leftmenu)) {
$moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_hide_leftmenu='.$conf->dol_hide_leftmenu;
}
if (!empty($conf->dol_no_mouse_hover)) {
$moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover;
}
if (!empty($conf->dol_use_jmobile)) {
$moreparam .= (strpos($moreparam, '?') === false ? '?' : '&').'dol_use_jmobile='.$conf->dol_use_jmobile;
}
print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>';
?>
</div>
</div>
</div>
</form>
<div class="center login_main_home divpasswordmessagedesc paddingtopbottom<?php echo empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent boxshadow'; ?>" style="max-width: 70%">
<?php
if ($mode == 'dolibarr' || !$disabled) {
if (empty($message)) {
print '<span class="passwordmessagedesc opacitymedium">';
print $langs->trans('EnterNewPasswordHere');
print '</span>';
}
} else {
print '<div class="warning center">';
print $langs->trans('AuthenticationDoesNotAllowSendNewPassword', $mode);
print '</div>';
}
?>
</div>
<br>
<?php if (!empty($message)) { ?>
<div class="center login_main_message">
<?php echo dol_htmloutput_mesg($message, '', '', 1); ?>
</div>
<?php } ?>
<!-- Common footer is not used for passwordforgotten page, this is same than footer but inside passwordforgotten tpl -->
<?php
if (!empty($conf->global->MAIN_HTML_FOOTER)) {
print $conf->global->MAIN_HTML_FOOTER;
}
if (!empty($morelogincontent) && is_array($morelogincontent)) {
foreach ($morelogincontent as $format => $option) {
if ($format == 'js') {
echo "\n".'<!-- Javascript by hook -->';
echo $option."\n";
}
}
} elseif (!empty($moreloginextracontent)) {
echo '<!-- Javascript by hook -->';
echo $moreloginextracontent;
}
// Google Analytics
// TODO Add a hook here
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
$tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID);
foreach ($tmptagarray as $tmptag) {
print "\n";
print "<!-- JS CODE TO ENABLE for google analtics tag -->\n";
print "
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=\"https://www.googletagmanager.com/gtag/js?id=".trim($tmptag)."\"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '".trim($tmptag)."');
</script>";
print "\n";
}
}
// TODO Replace this with a hook
// Google Adsense (need Google module)
if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) {
if (empty($conf->dol_use_jmobile)) {
?>
<div class="center"><br>
<script><!--
google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
//-->
</script>
<script src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<?php
}
}
?>
</div>
</div> <!-- end of center -->
</body>
</html>
<!-- END PHP TEMPLATE -->

View File

@ -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 ++;

View File

@ -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 "</td>";
print "<td>";
@ -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 "</td>";
print "<td>";
@ -518,7 +518,7 @@ if (($action == "create") || ($action == "edit")) {
if (!empty($object->priority)) {
$priority = $object->priority;
}
print "<td><input type=\"text\" size=\"2\" name=\"priority\" value=\"".$priority."\" /> ";
print '<td><input type="text" class="width50" name="priority" value="'.$priority.'" /> ';
print "</td>";
print "<td>";
print "</td>";
@ -530,7 +530,7 @@ if (($action == "create") || ($action == "edit")) {
$maxrun = $object->maxrun;
}
print $langs->trans('CronMaxRun')."</td>";
print "<td><input type=\"text\" size=\"2\" name=\"maxrun\" value=\"".$maxrun."\" /> ";
print '<td><input type="text" class="width50" name="maxrun" value="'.$maxrun.'" /> ';
print "</td>";
print "<td>";
print "</td>";
@ -538,12 +538,12 @@ if (($action == "create") || ($action == "edit")) {
print '<tr><td class="fieldrequired">';
print $langs->trans('CronDtNextLaunch');
print ' ('.$langs->trans('CronFrom').')';
//print ' ('.$langs->trans('CronFrom').')';
print "</td><td>";
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 "</td>";
print "<td>";
@ -774,7 +774,7 @@ if (($action == "create") || ($action == "edit")) {
print '<tr><td>';
print $langs->trans('CronLastOutput')."</td><td>";
print nl2br($object->lastoutput);
print '<span class="small">'.nl2br($object->lastoutput).'</span>';
print "</td></tr>";
print '</table>';
@ -787,7 +787,7 @@ if (($action == "create") || ($action == "edit")) {
print dol_get_fiche_end();
print "\n\n<div class=\"tabsAction\">\n";
print "\n\n".'<div class="tabsAction">'."\n";
if (!$user->rights->cron->create) {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")).'">'.$langs->trans("Edit").'</a>';
} else {

View File

@ -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 '<br>';
//print '<br>';
//$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = '';
@ -447,7 +447,7 @@ print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre center"><input type="text" class="width50" name="search_lastresult" value="'.$search_lastresult.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="center">';
print '<td class="liste_titre center">';
print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Scheduled")), $search_status, 1);
print '</td><td class="liste_titre right">';
$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 "</tr>\n";
@ -560,19 +560,20 @@ if ($num > 0) {
print $form->textwithpicto($text, $texttoshow, 1);
print '</td>';
print '<td>';
$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 '<td class="tdoverflowmax125" title="'.$s.'">';
print $s;
print '</td>';
/*

View File

@ -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;

View File

@ -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);

View File

@ -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 <b>%s</b> - <b>%s</b>
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 <span class="warning">(to modify a line, you will need to delete the whole transaction and re-transfert it into accounting)</span>
NotifiedValidationDate=Validate and Lock the exported entries <span class="warning">(same effect than the "%s" feature, modification and deletion of the lines will DEFINITELY not be possible)</span>
DateValidationAndLock=Date validation and lock

View File

@ -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)
AllowExternalDownload=Allow external download (without login, using a shared link)

View File

@ -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

View File

@ -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.<br>Change will become effective once you click on the confirmation link in the email.<br>Check your inbox.
EnterNewPasswordHere=Enter your new password here
BackToLoginPage=Back to login page
AuthenticationDoesNotAllowSendNewPassword=Authentication mode is <b>%s</b>.<br>In this mode, Dolibarr can't know nor change your password.<br>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.

View File

@ -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

View File

@ -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).",";

View File

@ -789,6 +789,7 @@ if ($action == 'create') {
print $langs->trans("CorrectStock");
print "</a></td>";
}
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
if ($i == 0) {
$units = $productstatic->fk_unit;
@ -796,11 +797,13 @@ if ($action == 'create') {
$sameunits = false;
}
}
print "</tr>";
$i++;
}
$db->free($resql);
// Total
print '<tr class="liste_total"><td class="liste_total" colspan="2">'.$langs->trans("Total").'</td>';
print '<td class="liste_total right">';
$valtoshow = price2num($totalunit, 'MS');
@ -818,9 +821,15 @@ if ($action == 'create') {
print '<td class="liste_total">&nbsp;</td>';
print '<td class="liste_total right">'.price(price2num($totalvaluesell, 'MT')).'</td>';
}
print '<td class="liste_total">&nbsp;</td>';
print '<td class="liste_total">&nbsp;</td>';
print '<td class="liste_total">&nbsp;</td>';
if ($user->rights->stock->mouvement->creer) {
print '<td class="liste_total">&nbsp;</td>';
}
if ($user->rights->stock->creer) {
print '<td class="liste_total">&nbsp;</td>';
}
print '</tr>';
} else {
dol_print_error($db);

View File

@ -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;

View File

@ -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);

View File

@ -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 '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
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 '</div>';
print '<div class="nowrap">';
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 '</div>';
print '</td>';
}
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 '<td class="liste_titre">';
print '<td class="liste_titre center">';
print '<div class="nowrap">';
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 '</div>';
print '<div class="nowrap">';
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 '</div>';
print '</td>';
}
// Date modification

View File

@ -15,7 +15,7 @@
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2019-2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2022 ButterflyOfFire <butterflyoffire+dolibarr@protonmail.com>
*
@ -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;

View File

@ -1725,7 +1725,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
// Prospect status
print '<td class="center nowrap"><div class="nowrap">';
print '<td class="center nowrap"><div class="nowraponall">';
print '<div class="inline-block">';
print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
print '</div> - <div class="inline-block">';

View File

@ -338,7 +338,7 @@ if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlob
print '<tr class="oddeven"><td>'.$langs->trans('CashDeskReaderKeyCodeForEnter').'</td>';
print '<td>';
print '<input type="text" name="CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse.'" value="'.getDolGlobalString('CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse).'" />';
print '<input type="text" class="width50" name="CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse.'" value="'.getDolGlobalString('CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse).'" />';
print '</td></tr>';
// Numbering module

View File

@ -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;

View File

@ -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;
}

View File

@ -1177,12 +1177,12 @@ $( document ).ready(function() {
echo $obj->rowid;
echo '\\\'; Refresh();">';
if ($placeid == $obj->rowid) {
echo "<b>";
echo '<span class="basketselected">';
} else {
echo '<span class="basketnotselected">';
}
echo '<span class="fa fa-shopping-cart paddingright"></span>'.dol_print_date($db->jdate($obj->datec), '%H:%M', 'tzuser');
if ($placeid == $obj->rowid) {
echo "</b>";
}
echo '</span>';
echo '</a>\');';
}
echo '$("#shoppingcart").append(\'<a onclick="place=\\\'0-';
@ -1586,7 +1586,8 @@ if ($placeid > 0) {
$moreinfo .= '<br>'.$langs->transcountry("TotalVAT", $mysoc->country_code).': '.price($line->total_tva);
$moreinfo .= '<br>'.$langs->transcountry("TotalLT1", $mysoc->country_code).': '.price($line->total_localtax1);
$moreinfo .= '<br>'.$langs->transcountry("TotalLT2", $mysoc->country_code).': '.price($line->total_localtax2);
$moreinfo .= '<br>'.$langs->transcountry("TotalTTC", $mysoc->country_code).': '.price($line->total_ttc);
$moreinfo .= '<hr>';
$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 .= '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end).'</div>';
@ -1688,7 +1689,7 @@ if (($action == "valid" || $action == "history") && $invoice->type != Facture::T
if ($action == "search") {
print '<center>
<input type="text" id="search" class="input-search-takepos" name="search" onkeyup="Search2();" style="width: 80%; font-size: 150%;" placeholder="'.dol_escape_htmltag($langs->trans('Search')).'">
<input type="text" id="search" class="input-search-takepos" name="search" onkeyup="Search2(\'\', null);" style="width: 80%; font-size: 150%;" placeholder="'.dol_escape_htmltag($langs->trans('Search')).'">
</center>';
}

View File

@ -2111,7 +2111,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '</tr>';
// Firstname
print "<tr>".'<td>'.$langs->trans("Firstname").'</td>';
print '<tr><td>'.$langs->trans("Firstname").'</td>';
print '<td>';
if ($caneditfield && !$object->ldap_sid) {
print '<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.'">';
@ -2239,7 +2239,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '</td></tr>';
// Hierarchy
print '<tr><td class="titlefield">'.$langs->trans("HierarchicalResponsible").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("HierarchicalResponsible").'</td>';
print '<td>';
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 '<tr><td class="titlefield">';
print '<tr><td class="titlefieldcreate">';
$text = $langs->trans("ForceUserExpenseValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
@ -2273,7 +2273,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// Holiday request validator
if (isModEnabled('holiday')) {
print '<tr><td class="titlefield">';
print '<tr><td class="titlefieldcreate">';
$text = $langs->trans("ForceUserHolidayValidator");
print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help');
print '</td>';
@ -2336,8 +2336,11 @@ if ($action == 'create' || $action == 'adduserldap') {
print '</td></tr>';
print '</table><hr><table class="border centpercent">';
print '</table>';
print '<hr>';
print '<table class="border centpercent">';
// Date access validity
print '<tr><td>'.$langs->trans("RangeOfLoginValidity").'</td>';

View File

@ -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 = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'</div>';
$message = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorTechnicalError")).'</div>';
} 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'] = '<!-- warning -->'.$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
}

View File

@ -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 '</table>';
print dol_get_fiche_end();

View File

@ -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;

View File

@ -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) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
}
$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] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
}
$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');

View File

@ -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 '</div>'."\n";
}
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend') {
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // 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 '</div><div class="fichehalfright">';
$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 '</div></div>';
}
//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

View File

@ -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');

View File

@ -1,174 +0,0 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \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 = '<a href="'.dol_buildpath('/webhook/target_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
/*
// 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.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (isModEnabled('projet'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd)
{
if ($action != 'classify')
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$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.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} 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 .= '</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$cssclass = "titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print '</div>';
print dol_get_fiche_end();
}
// End of page
llxFooter();
$db->close();

View File

@ -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');
}