Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into pr/bb2a/21596

This commit is contained in:
Anthony Berton 2022-10-29 21:01:28 +02:00
commit 0880893319
59 changed files with 309 additions and 266 deletions

View File

@ -27,6 +27,7 @@ Following changes may create regressions for some external modules, but were nec
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
* All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead
* Code standardization: $user->rights->propale is now $user->rights->propal everywhere.
* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead.
***** ChangeLog for 16.0.1 compared to 16.0.0 *****

View File

@ -127,7 +127,8 @@ print '<td>'.$langs->trans("Example").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("MailingEMailFrom").'</td><td>';
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
print $langs->trans("MailingEMailFrom").' '.$help.'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
if (!empty($conf->global->MAILING_EMAIL_FROM) && !isValidEmail($conf->global->MAILING_EMAIL_FROM)) {
print ' '.img_warning($langs->trans("BadEMail"));

View File

@ -599,7 +599,8 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
// From
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
print '<td><input class="flat minwidth200" name="MAIN_MAIL_EMAIL_FROM" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
print '"></td></tr>';
@ -820,7 +821,8 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) {
print img_warning($langs->trans("Mandatory"));

View File

@ -149,25 +149,26 @@ print '<br>';
// Session
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentSessionTimeOut").' (session.gc_maxlifetime)</td><td>'.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds");
print '</td><td class="right">';
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Session").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionSavePath").'</td><td>'.session_save_path().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionName").'</td><td>'.session_name().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("SessionId").'</td><td>'.session_id().'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentSessionTimeOut").' (session.gc_maxlifetime)</td>';
print '<td>';
print ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds");
print '<!-- session.gc_maxlifetime = '.ini_get("session.gc_maxlifetime").' -->'."\n";
print '<!-- session.gc_probability = '.ini_get("session.gc_probability").' -->'."\n";
print '<!-- session.gc_divisor = '.ini_get("session.gc_divisor").' -->'."\n";
print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor")));
print "</td></tr>\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTheme").'</td><td colspan="2">'.$conf->theme.'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentMenuHandler").'</td><td colspan="2">';
print '<tr class="oddeven"><td>'.$langs->trans("CurrentTheme").'</td><td>'.$conf->theme.'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CurrentMenuHandler").'</td><td>';
print $conf->standard_menu;
print '</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("Screen").'</td><td colspan="2">';
print '<tr class="oddeven"><td>'.$langs->trans("Screen").'</td><td>';
print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];
print '</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("Session").'</td><td colspan="2">';
print '<tr class="oddeven"><td>'.$langs->trans("Session").'</td><td class="wordbreak">';
$i = 0;
foreach ($_SESSION as $key => $val) {
if ($i > 0) {

View File

@ -79,7 +79,7 @@ $workflowcodes = array(
'picto'=>'ticket'
),
'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''),
'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>'', 'enabled'=>((isModEnabled("propal") && isModEnabled('commande')) || (isModEnabled('commande') && isModEnabled('facture')) || (isModEnabled('ticket') && isModEnabled('ficheinter')))),
// Automatic classification of proposal
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array(
@ -118,8 +118,6 @@ $workflowcodes = array(
'warning'=>''
), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card.
'separator2'=>array('family'=>'separator', 'position'=>50),
// Automatic classification supplier proposal
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array(
'family'=>'classify_supplier_proposal',
@ -154,14 +152,6 @@ $workflowcodes = array(
'warning'=>''
),
// Automatic classification reception
'WORKFLOW_BILL_ON_RECEPTION'=>array(
'family'=>'classify_reception',
'position'=>80,
'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
'picto'=>'reception'
),
// Automatic classification shipping
'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array(
'family' => 'classify_shipping',
@ -170,17 +160,27 @@ $workflowcodes = array(
'picto' => 'shipment'
),
// Automatic classification reception
'WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE'=>array(
'family'=>'classify_reception',
'position'=>95,
'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
'picto'=>'reception'
),
'separator2'=>array('family'=>'separator', 'position'=>400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))),
// Automatic link ticket -> contract
'WORKFLOW_TICKET_LINK_CONTRACT' => array(
'family' => 'link_ticket',
'position' => 75,
'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled),
'position' => 500,
'enabled' => (isModEnabled('ticket') && isModEnabled('contract')),
'picto' => 'ticket'
),
'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
'family' => 'link_ticket',
'position' => 76,
'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled),
'position' => 501,
'enabled' => (isModEnabled('ticket') && isModEnabled('contract')),
'picto' => 'ticket'
),
);
@ -235,6 +235,7 @@ foreach ($workflowcodes as $key => $params) {
continue;
}
$reg = array();
if ($oldfamily != $params['family']) {
if ($params['family'] == 'create') {
$header = $langs->trans("AutomaticCreation");
@ -269,7 +270,7 @@ foreach ($workflowcodes as $key => $params) {
print '<tr class="liste_titre">';
print '<th>'.$header.'</th>';
print '<th align="center">'.$langs->trans("Status").'</th>';
print '<th class="right">'.$langs->trans("Status").'</th>';
print '</tr>';
$oldfamily = $params['family'];
@ -286,7 +287,7 @@ foreach ($workflowcodes as $key => $params) {
print '</td>';
print '<td class="center">';
print '<td class="right">';
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff($key);

View File

@ -493,7 +493,7 @@ if ($action == 'makepayment_confirm' && !empty($user->rights->facture->paiement)
$rsql .= " , pfd.date_traite as date_traite";
$rsql .= " , pfd.amount";
$rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$rsql .= " , ".MAIN_DB_PREFIX."user as u";
$rsql .= " WHERE fk_facture = ".((int) $objecttmp->id);
$rsql .= " AND pfd.fk_user_demande = u.rowid";

View File

@ -311,7 +311,7 @@ if ($object->id > 0) {
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$sql .= " , pfd.date_traite as date_traite";
$sql .= " , pfd.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
} else {
@ -686,7 +686,7 @@ if ($object->id > 0) {
// For which amount ?
$sql = "SELECT SUM(pfd.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".((int) $object->id);
} else {
@ -812,7 +812,7 @@ if ($object->id > 0) {
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,";
$sql .= " pfd.date_traite as date_traite, pfd.amount,";
$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
if ($type == 'bank-transfer') {
@ -889,7 +889,7 @@ if ($object->id > 0) {
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
$sql .= " pb.ref,";
$sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons";
if ($type == 'bank-transfer') {

View File

@ -750,7 +750,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$numdirectdebitopen = 0;
$totaldirectdebit = 0;
$sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE fk_facture = ".((int) $objp->facid);
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";

View File

@ -109,7 +109,7 @@ $sql .= " ".MAIN_DB_PREFIX."societe as s";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE s.rowid = f.fk_soc";
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
$sql .= " AND f.total_ttc > 0";

View File

@ -151,7 +151,7 @@ class BonPrelevement extends CommonObject
if ($result == 0) {
if ($line_id > 0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture (";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement (";
if ($type != 'bank-transfer') {
$sql .= "fk_facture";
} else {
@ -577,7 +577,7 @@ class BonPrelevement extends CommonObject
}
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
$sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND p.rowid = ".((int) $this->id);
@ -635,7 +635,7 @@ class BonPrelevement extends CommonObject
} else {
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
}
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
@ -695,7 +695,7 @@ class BonPrelevement extends CommonObject
} else {
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
}
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
@ -788,7 +788,7 @@ class BonPrelevement extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
}
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
if ($type != 'bank-transfer') {
$sql .= " AND f.rowid = pfd.fk_facture";
@ -1014,7 +1014,7 @@ class BonPrelevement extends CommonObject
}
// Update invoice requests as done
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande";
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande";
$sql .= " SET traite = 1";
$sql .= ", date_traite = '".$this->db->idate($now)."'";
$sql .= ", fk_prelevement_bons = ".((int) $this->id);
@ -1147,7 +1147,7 @@ class BonPrelevement extends CommonObject
}
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
$resql1 = $this->db->query($sql);
if (!$resql1) {
dol_print_error($this->db);
@ -1171,7 +1171,7 @@ class BonPrelevement extends CommonObject
}
if (!$error) {
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
$resql4 = $this->db->query($sql);
if (!$resql4) {
dol_print_error($this->db);
@ -1425,7 +1425,7 @@ class BonPrelevement extends CommonObject
$sql .= " FROM";
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql .= " ".MAIN_DB_PREFIX."facture as f,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf,";
$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
@ -1541,7 +1541,7 @@ class BonPrelevement extends CommonObject
$sql .= " FROM";
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf,";
$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
@ -1634,7 +1634,7 @@ class BonPrelevement extends CommonObject
$sql .= " FROM";
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql .= " ".MAIN_DB_PREFIX."facture as f,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf";
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
$sql .= " AND pf.fk_facture = f.rowid";
@ -1660,7 +1660,7 @@ class BonPrelevement extends CommonObject
$sql .= " FROM";
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf";
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
$sql .= " AND pf.fk_facture_fourn = f.rowid";
@ -1691,7 +1691,7 @@ class BonPrelevement extends CommonObject
fclose($this->file);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($this->file, octdec($conf->global->MAIN_UMASK));
@chmod($this->filename, octdec($conf->global->MAIN_UMASK));
}
return $result;

View File

@ -221,7 +221,7 @@ class RejetPrelevement
$userid = 0;
$sql = "SELECT fk_user_demande";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE pfd.fk_prelevement_bons = ".((int) $this->bon_id);
$sql .= " AND pfd.fk_facture".($this->type == 'bank-transfer' ? '_fourn' : '').' = '.((int) $fac->id);
@ -289,7 +289,7 @@ class RejetPrelevement
//Returns all invoices of a withdrawal
$sql = "SELECT f.rowid as facid, pl.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement as pf";
if ($this->type == 'bank-transfer') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)";
} else {

View File

@ -348,7 +348,7 @@ if ($type == 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
}
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE s.rowid = f.fk_soc";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {

View File

@ -137,7 +137,7 @@ if ($type != 'bank-transfer') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
}
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}

View File

@ -111,7 +111,7 @@ if ($id > 0 || $ref) {
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
print ' &nbsp; <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
@ -177,7 +177,7 @@ $sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= ", ".MAIN_DB_PREFIX."prelevement as pf";
if ($object->type != 'bank-transfer') {
$sql .= ", ".MAIN_DB_PREFIX."facture as f";
} else {

View File

@ -106,7 +106,7 @@ if ($id > 0 || $ref) {
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
print ' &nbsp; <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';

View File

@ -100,7 +100,7 @@ if ($id > 0 || $ref) {
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($object->date_trans, 'day');
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
print ' &nbsp; <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
@ -135,7 +135,7 @@ if ($id > 0 || $ref) {
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print '<tr><td class="titlefieldcreate">';
$labelfororderfield = 'WithdrawalFile';
if ($object->type == 'bank-transfer') {
$labelfororderfield = 'CreditTransferFile';

View File

@ -109,7 +109,7 @@ $sql .= " ".MAIN_DB_PREFIX."societe as s";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE s.rowid = f.fk_soc";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= " AND f.total_ttc > 0";

View File

@ -262,7 +262,7 @@ if ($id) {
$sql .= " , s.rowid as socid, s.nom as name";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
if ($type == 'bank-transfer') {
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
} else {

View File

@ -114,7 +114,7 @@ $sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur,
$sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
if ($type == 'bank-transfer') {
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
} else {

View File

@ -75,17 +75,6 @@ $hookmanager->initHooks(array('taxvatcard', 'globalcard'));
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
}
if (empty($action) && empty($id) && empty($ref)) {
$action = 'view';
}

View File

@ -212,7 +212,7 @@ class CMailFile
// On defini alternative_boundary
$this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars)
dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG);
dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext upload_dir_tmp=$upload_dir_tmp", LOG_DEBUG);
dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG);
if (empty($subject)) {
@ -1761,7 +1761,7 @@ class CMailFile
/*
global $dolibarr_main_data_root;
$outputfile = $dolibarr_main_data_root."/dolibarr_mail.log";
$fp = fopen($outputfile, "w");
$fp = fopen($outputfile, "w+");
fwrite($fp, $this->html);
fclose($fp);
*/
@ -1783,7 +1783,7 @@ class CMailFile
foreach ($matches[1] as $key => $ext) {
// We save the image to send in disk
$filecontent = $matches[2][$key];
$cid = dol_hash(uniqid(time()), 3);
$cid = 'cid000'.dol_hash($this->html, 'md5');
$destfiletmp = $images_dir.'/'.$cid.'.'.$ext;
$fhandle = @fopen($destfiletmp, 'w');
@ -1808,7 +1808,7 @@ class CMailFile
// type
$this->html_images[$i]["type"] = 'cidfromdata';
$this->html = preg_replace('/src="data:image\/'.$ext.';base64,'.preg_quote($filecontent, '/').'"/', 'src="cid:'.$this->html_images[$i]["cid"].'"', $this->html);
$this->html = str_replace('src="data:image/'.$ext.';base64,'.$filecontent.'"', 'src="cid:'.$this->html_images[$i]["cid"].'"', $this->html);
}
$i++;
}

View File

@ -756,7 +756,7 @@ abstract class CommonInvoice extends CommonObject
$bac->fetch(0, $this->socid);
$sql = "SELECT count(*)";
$sql .= " FROM ".$this->db->prefix()."prelevement_facture_demande";
$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
if ($type == 'bank-transfer') {
$sql .= " WHERE fk_facture_fourn = ".((int) $this->id);
} else {
@ -786,7 +786,7 @@ abstract class CommonInvoice extends CommonObject
}
if (is_numeric($amount) && $amount != 0) {
$sql = 'INSERT INTO '.$this->db->prefix().'prelevement_facture_demande(';
$sql = 'INSERT INTO '.$this->db->prefix().'prelevement_demande(';
if ($type == 'bank-transfer') {
$sql .= 'fk_facture_fourn, ';
} else {
@ -883,7 +883,7 @@ abstract class CommonInvoice extends CommonObject
}
$sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn";
$sql .= " FROM ".$this->db->prefix()."prelevement_facture_demande";
$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
$sql .= " WHERE rowid = ".((int) $did);
dol_syslog(get_class($this)."::makeStripeSepaRequest 1", LOG_DEBUG);
@ -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_facture_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;
@ -1633,7 +1633,7 @@ abstract class CommonInvoice extends CommonObject
public function demande_prelevement_delete($fuser, $did)
{
// phpcs:enable
$sql = 'DELETE FROM '.$this->db->prefix().'prelevement_facture_demande';
$sql = 'DELETE FROM '.$this->db->prefix().'prelevement_demande';
$sql .= ' WHERE rowid = '.((int) $did);
$sql .= ' AND traite = 0';
if ($this->db->query($sql)) {

View File

@ -2074,14 +2074,21 @@ class ExtraFields
$visibility = 1;
if (isset($this->attributes[$object->table_element]['list'][$key])) { // 'list' is option for visibility
$visibility = dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1');
$visibility = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '1'));
}
$perms = 1;
if (isset($this->attributes[$object->table_element]['perms'][$key])) {
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1, 1, '1');
}
if (empty($enabled)) {
if (empty($enabled)
|| (
$onlykey === '@GETPOSTISSET'
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst'))
&& in_array(abs($enabled), array(2, 5))
&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided
)
) {
continue;
}
if (empty($visibility)) {

View File

@ -2453,9 +2453,10 @@ class Form
* @param string $morecss Add more css on select
* @param string $nooutput No print, return the output into a string
* @param int $forcecombo Force to use combo box
* @param array $TProducts Add filter on a defined product
* @return void|string
*/
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 1, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0)
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 0, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0, $TProducts = [])
{
// phpcs:enable
global $conf, $user, $langs, $db;
@ -2477,8 +2478,9 @@ class Form
$sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
$sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
if (!empty($status)) $sql.= ' AND status = '. (int) $status;
if (!empty($type)) $sql.= ' AND status = '. (int) $type;
if (!empty($limit)) $sql.= 'LIMIT '. (int) $limit;
if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type;
if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit;
$resql = $db->query($sql);
if ($resql) {
if ($showempty) {
@ -2489,8 +2491,9 @@ class Form
while ($obj = $db->fetch_object($resql)) {
$product = new Product($db);
$res = $product->fetch($obj->fk_product);
if ($obj->rowid == $selected) $out .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.' - '. $product->label .' - '.$obj->label.'</option>';
$out .= '<option value="'.$obj->rowid.'">'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
$out .= '<option value="'.$obj->rowid.'"';
if ($obj->rowid == $selected) $out .= 'selected';
$out .= '>'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
}
} else {
$error++;

View File

@ -1724,15 +1724,13 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
print '<div id="example1" class="hidden">';
print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&amp;adminpw=%MAILMAN_ADMINPW%&amp;subscribe_or_invite=0&amp;send_welcome_msg_to_this_batch=0&amp;notification_to_list_owner=0';
print '</div>';
}
if ($const == 'ADHERENT_MAILMAN_UNSUB_URL') {
} elseif ($const == 'ADHERENT_MAILMAN_UNSUB_URL') {
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick2">'.img_down().'</a><br>';
print '<div id="example2" class="hidden">';
print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&amp;adminpw=%MAILMAN_ADMINPW%&amp;send_unsub_ack_to_this_batch=0&amp;send_unsub_notifications_to_list_owner=0';
print '</div>';
//print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
}
if ($const == 'ADHERENT_MAILMAN_LISTS') {
} elseif ($const == 'ADHERENT_MAILMAN_LISTS') {
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick3">'.img_down().'</a><br>';
print '<div id="example3" class="hidden">';
print 'mymailmanlist<br>';
@ -1743,6 +1741,8 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu
}
print '</div>';
//print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
} elseif ($const == 'ADHERENT_MAIL_FROM') {
print ' '.img_help(1, $langs->trans("EMailHelpMsgSPFDKIM"));
}
print "</td>\n";

View File

@ -58,7 +58,7 @@ function facturefourn_prepare_head($object)
if (!empty($conf->paymentbybanktransfer->enabled)) {
$nbStandingOrders = 0;
$sql = "SELECT COUNT(pfd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE pfd.fk_facture_fourn = ".((int) $object->id);
$sql .= " AND pfd.ext_payment_id IS NULL";
$resql = $db->query($sql);

View File

@ -59,7 +59,7 @@ function facture_prepare_head($object)
if (!empty($conf->prelevement->enabled)) {
$nbStandingOrders = 0;
$sql = "SELECT COUNT(pfd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE pfd.fk_facture = ".((int) $object->id);
$sql .= " AND pfd.ext_payment_id IS NULL";
$resql = $db->query($sql);

View File

@ -1282,8 +1282,8 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// Show page nb only on iso languages (so default Helvetica font)
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') {
$pdf->SetXY($dims['wk'] - $dims['rm'] - 18, -$posy);
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
$pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0);
//$pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0);
$pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0);
}
// Show Draft Watermark

View File

@ -1241,13 +1241,14 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin');
$modeinput = 'hours';
// Comment for avoid unnecessary multiple calculation
/*$modeinput = 'hours';
print '<script type="text/javascript">';
print "jQuery(document).ready(function () {\n";
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print "})\n";
print '</script>';
print '</script>';*/
print '</td>';
@ -1628,13 +1629,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
//$tableCell.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">';
print $tableCell;
$modeinput = 'hours';
// Comment for avoid unnecessary multiple calculation
/*$modeinput = 'hours';
print '<script type="text/javascript">';
print "jQuery(document).ready(function () {\n";
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print "})\n";
print '</script>';
print '</script>';*/
print '</td>';

View File

@ -391,6 +391,11 @@ function restrictedArea(User $user, $features, $objectid = 0, $tableandshare = '
return 1;
}
// To avoid access forbidden with numeric ref
if ($dbt_select != 'rowid' && $dbt_select != 'id') {
$objectid = "'".$objectid."'";
}
// Features/modules to check
$featuresarray = array($features);
if (preg_match('/&/', $features)) {

View File

@ -658,16 +658,7 @@ class modProduct extends DolibarrModules
}
// End add extra fields
$this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_regex_array[$r] = array(
'p.ref'=>'[^ ]',
'p.price_base_type' => 'HT|TTC',
'p.tosell'=>'^[0|1]$',
'p.tobuy'=>'^[0|1]$',
'p.fk_product_type'=>'^[0|1]$',
'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
'p.recuperableonly' => '^[0|1]$',
'p.finished' => '^[0|1]$'
);
// field order as per structure of table llx_product
$import_sample = array(
'p.ref' => "ref:PREF123456",

View File

@ -93,7 +93,6 @@ class modWorkflow extends DolibarrModules
6=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0),
7=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0),
8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),
9=>array('WORKFLOW_BILL_ON_RECEPTION', 'chaine', '1', 'WORKFLOW_BILL_ON_RECEPTION', 0, 'current', 0),
10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0),
11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0),
11=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '1', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0)

View File

@ -113,11 +113,15 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
}
if (!empty($conf->global->SYSLOG_FILE_ONEPERSESSION)) {
if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) { // file depend on session key name (Note that session name is same for all users and is not a per user value)
$suffixinfilename .= '_'.session_name();
}
if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on session value sor per user
$suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"];
if (is_numeric($conf->global->SYSLOG_FILE_ONEPERSESSION)) {
if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) { // file depend on instance session key name (Note that session name is same for the instance so for all users and is not a per user value)
$suffixinfilename .= '_'.session_name();
}
if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on instance session key name + ip so nearly per user
$suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"];
}
} else {
$suffixinfilename .= '_'.$conf->global->SYSLOG_FILE_ONEPERSESSION;
}
}

View File

@ -29,6 +29,9 @@ $module = $object->element;
$note_public = 'note_public';
$note_private = 'note_private';
if ($module == "product") {
$module = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
}
$colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : ''));
// Set $permission from the $permissionnote var defined on calling page
$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : (isset($user->rights->$module->create) ? $user->rights->$module->create : (isset($user->rights->$module->creer) ? $user->rights->$module->creer : 0))));
@ -60,37 +63,39 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) {
// Special cases
if ($module == 'propal') {
$permission = $user->rights->propal->creer;
$permission = $user->hasRight("propal", "creer");
} elseif ($module == 'supplier_proposal') {
$permission = $user->rights->supplier_proposal->creer;
$permission = $user->hasRight("supplier_proposal", "creer");
} elseif ($module == 'fichinter') {
$permission = $user->rights->ficheinter->creer;
$permission = $user->hasRight("ficheinter", "creer");
} elseif ($module == 'project') {
$permission = $user->rights->projet->creer;
$permission = $user->hasRight("projet", "creer");
} elseif ($module == 'project_task') {
$permission = $user->rights->projet->creer;
$permission = $user->hasRight("projet", "creer");
} elseif ($module == 'invoice_supplier') {
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->facture->creer;
$permission = $user->hasRight("fournisseur", "facture", "creer");
} else {
$permission = $user->rights->supplier_invoice->creer;
$permission = $user->hasRight("supplier_invoice", "creer");
}
} elseif ($module == 'order_supplier') {
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->commande->creer;
$permission = $user->hasRight("fournisseur", "commande", "creer");
} else {
$permission = $user->rights->supplier_order->creer;
$permission = $user->hasRight("supplier_order", "creer");
}
} elseif ($module == 'societe') {
$permission = $user->rights->societe->creer;
$permission = $user->hasRight("societe", "creer");
} elseif ($module == 'contact') {
$permission = $user->rights->societe->creer;
$permission = $user->hasRight("societe", "creer");
} elseif ($module == 'shipping') {
$permission = $user->rights->expedition->creer;
$permission = $user->hasRight("expedition", "creer");
} elseif ($module == 'product') {
$permission = $user->rights->produit->creer;
$permission = $user->hasRight("produit", "creer");
} elseif ($module == 'service') {
$permission = $user->hasRight("service", "creer");
} elseif ($module == 'ecmfiles') {
$permission = $user->rights->ecm->setup;
$permission = $user->hasRight("ecm", "setup");
} elseif ($module == 'user') {
$permission = $user->hasRight("user", "self", "write");
}

View File

@ -181,14 +181,23 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
if (isModEnabled("expedition") && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE)) {
/** @var Facture $object */
$object->fetchObjectLinked('', 'shipping', $object->id, $object->element);
if (!empty($object->linkedObjects)) {
/** @var Expedition $shipment */
$shipment = array_shift($object->linkedObjects['shipping']);
$ret = $shipment->setClosed();
$totalonlinkedelements = 0;
foreach ($object->linkedObjects['shipping'] as $element) {
if ($element->statut == Expedition::STATUS_VALIDATED) {
$totalonlinkedelements += $element->total_ht;
}
}
dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
if ($totalonlinkedelements == $object->total_ht) {
foreach ($object->linkedObjects['shipping'] as $element) {
$ret = $element->setClosed();
if ($ret < 0) {
return $ret;
}
}
}
}
}
@ -244,8 +253,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
// Then set reception to "Billed" if WORKFLOW_BILL_ON_RECEPTION is set
if (isModEnabled("reception") && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) {
// Then set reception to "Billed" if WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE is set
if (isModEnabled("reception") && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE)) {
$object->fetchObjectLinked('', 'reception', $object->id, $object->element);
if (!empty($object->linkedObjects)) {
$totalonlinkedelements = 0;

View File

@ -2243,21 +2243,6 @@ class Expedition extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*
* @deprecated
* @see setBilled()
* @return int <0 if ko, >0 if ok
*/
public function set_billed()
{
// phpcs:enable
dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE);
return $this->setBilled();
}
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*

View File

@ -526,7 +526,7 @@ $param .= $hookmanager->resPrint;
$arrayofmassactions = array(
'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
'classifyclose'=>$langs->trans("Close"),
'classifyclose' => img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("Close"),
'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if (in_array($massaction, array('presend'))) {

View File

@ -418,7 +418,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_author);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailTo && $emailFrom) {
$filename = array(); $filedir = array(); $mimetype = array();
@ -525,7 +525,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_author);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();
@ -641,7 +641,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_approve > 0 ? $object->fk_user_approve : $object->fk_user_validator);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();
@ -749,7 +749,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_refuse);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();
@ -863,7 +863,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($object->fk_user_cancel);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();
@ -1043,7 +1043,7 @@ if (empty($reshook)) {
// FROM
$expediteur = new User($db);
$expediteur->fetch($user->id);
$emailFrom = $expediteur->email;
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
if ($emailFrom && $emailTo) {
$filename = array(); $filedir = array(); $mimetype = array();

View File

@ -345,7 +345,7 @@ if (empty($reshook)) {
$rsql .= " , pfd.date_traite as date_traite";
$rsql .= " , pfd.amount";
$rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$rsql .= " , ".MAIN_DB_PREFIX."user as u";
$rsql .= " WHERE fk_facture_fourn = ".((int) $objecttmp->id);
$rsql .= " AND pfd.fk_user_demande = u.rowid";

View File

@ -718,7 +718,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$numdirectdebitopen = 0;
$totaldirectdebit = 0;
$sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE fk_facture_fourn = ".((int) $objp->facid);
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";

View File

@ -126,7 +126,7 @@ $arrayfields = array(
'cp.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>40),
'cp.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>42),
'cp.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'position'=>60),
'cp.date_approve'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1, 'position'=>70),
'cp.date_approval'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1, 'position'=>70),
'cp.date_create'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'cp.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>501),
'cp.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
@ -271,6 +271,8 @@ $sql .= " cp.statut as status,";
$sql .= " cp.fk_validator,";
$sql .= " cp.date_valid,";
$sql .= " cp.fk_user_valid,";
$sql .= " cp.date_approval,";
$sql .= " cp.fk_user_approve,";
$sql .= " cp.date_refuse,";
$sql .= " cp.fk_user_refuse,";
$sql .= " cp.date_cancel,";
@ -636,12 +638,18 @@ if ($resql) {
print '</td>';
}
// End date
// Date validation
if (!empty($arrayfields['cp.date_valid']['checked'])) {
print '<td class="liste_titre center nowraponall">';
print '</td>';
}
// Date appoval
if (!empty($arrayfields['cp.date_approval']['checked'])) {
print '<td class="liste_titre center nowraponall">';
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
@ -705,6 +713,9 @@ if ($resql) {
if (!empty($arrayfields['cp.date_valid']['checked'])) {
print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
}
if (!empty($arrayfields['cp.date_approval']['checked'])) {
print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center ');
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -839,18 +850,20 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Date validation
if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval
print '<td class="center">';
print '<td class="center" title="'.dol_print_date($db->jdate($obj->date_valid), 'dayhour').'">';
print dol_print_date($db->jdate($obj->date_valid), 'day');
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
/*if (!empty($arrayfields['cp.date_approve']['checked'])) {
print '<td class="center">';
print dol_print_date($db->jdate($obj->date_approve), 'day');
print '</td>';
if (!$i) $totalarray['nbfield']++;
}*/
// Date approval
if (!empty($arrayfields['cp.date_approval']['checked'])) {
print '<td class="center" title="'.dol_print_date($db->jdate($obj->date_approval), 'dayhour').'">';
print dol_print_date($db->jdate($obj->date_approval), 'day');
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';

View File

@ -361,3 +361,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903);
ALTER TABLE llx_prelevement_facture RENAME TO llx_prelevement;
ALTER TABLE llx_prelevement_facture_demande RENAME TO llx_prelevement_demande;

View File

@ -18,8 +18,8 @@
-- ============================================================================
ALTER TABLE llx_prelevement_facture ADD INDEX idx_prelevement_facture_fk_prelevement_lignes (fk_prelevement_lignes);
ALTER TABLE llx_prelevement ADD INDEX idx_prelevement_fk_prelevement_lignes (fk_prelevement_lignes);
ALTER TABLE llx_prelevement_facture ADD CONSTRAINT fk_prelevement_facture_fk_prelevement_lignes FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid);
ALTER TABLE llx_prelevement ADD CONSTRAINT fk_prelevement_facture_fk_prelevement_lignes FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid);

View File

@ -16,7 +16,7 @@
--
-- ===================================================================
create table llx_prelevement_facture
create table llx_prelevement
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_facture integer NULL,

View File

@ -17,6 +17,6 @@
-- ===================================================================
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);
ALTER TABLE llx_prelevement_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
ALTER TABLE llx_prelevement_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);

View File

@ -17,7 +17,7 @@
-- ===================================================================
create table llx_prelevement_facture_demande
create table llx_prelevement_demande
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL,

View File

@ -292,6 +292,7 @@ MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (default value in php.ini: <b>%s</b>)
MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix-like systems)
MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP/SMTPS Host (Not defined into PHP on Unix-like systems)
MAIN_MAIL_EMAIL_FROM=Sender email for automatic emails (default value in php.ini: <b>%s</b>)
EMailHelpMsgSPFDKIM=To prevent Dolibarr emails to be classified as spam, make sure that the server is authorized to send e-mails from this address by SPF and DKIM configuration
MAIN_MAIL_ERRORS_TO=Email used for error returns emails (fields 'Errors-To' in emails sent)
MAIN_MAIL_AUTOCOPY_TO= Copy (Bcc) all sent emails to
MAIN_DISABLE_ALL_MAILS=Disable all email sending (for test purposes or demos)

View File

@ -250,7 +250,9 @@ CountryMF=Saint Martin
##### Civilities #####
CivilityMME=Mrs.
CivilityMMEShort=Mrs.
CivilityMR=Mr.
CivilityMRShort=Mr.
CivilityMLE=Ms.
CivilityMTRE=Master
CivilityDR=Doctor

View File

@ -22,7 +22,7 @@ descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classify linked sourc
descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION=Classify linked source purchase order as received when a reception is validated (and if the quantity received by all receptions is the same as in the purchase order to update)
descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED=Classify linked source purchase order as received when a reception is closed (and if the quantity received by all rceptions is the same as in the purchase order to update)
# Autoclassify purchase invoice
descWORKFLOW_BILL_ON_RECEPTION=Classify receptions to "billed" when a linked supplier order is validated
descWORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE=Classify receptions to "billed" when a linked purchase invoice is validated (and if the amount of the invoice is the same as the total amount of the linked receptions)
# Automatically link ticket to contract
descWORKFLOW_TICKET_LINK_CONTRACT=When creating a ticket, link available contracts of matching thirdparty
descWORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS=When linking contracts, search among those of parents companies
@ -31,6 +31,6 @@ descWORKFLOW_TICKET_CLOSE_INTERVENTION=Close all interventions linked to the tic
AutomaticCreation=Automatic creation
AutomaticClassification=Automatic classification
# Autoclassify shipment
descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when customer invoice is validated
descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when customer invoice is validated (and if the amount of the invoice is the same as the total amount of the linked shipments)
AutomaticClosing=Automatic closing
AutomaticLinking=Automatic linking

View File

@ -1014,7 +1014,7 @@ class Products extends DolibarrApi
throw new RestException(401);
}
$sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.rang, t.entity";
$sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.position, t.entity";
$sql .= " FROM ".$this->db->prefix()."product_attribute as t";
$sql .= ' WHERE t.entity IN ('.getEntity('product').')';
@ -1051,7 +1051,7 @@ class Products extends DolibarrApi
$tmp->ref = $result->ref;
$tmp->ref_ext = $result->ref_ext;
$tmp->label = $result->label;
$tmp->rang = $result->rang;
$tmp->position = $result->position;
$tmp->entity = $result->entity;
$return[] = $this->_cleanObjectDatas($tmp);
@ -1088,7 +1088,7 @@ class Products extends DolibarrApi
throw new RestException(404, "Product attribute not found");
}
$fields = ["id", "ref", "ref_ext", "label", "rang", "entity"];
$fields = ["id", "ref", "ref_ext", "label", "position", "entity"];
foreach ($prodattr as $field => $value) {
if (!in_array($field, $fields)) {

View File

@ -795,12 +795,12 @@ print '</div>';
print '</form>';
$modeinput = 'hours';
if ($conf->use_javascript_ajax) {
if (!empty($conf->use_javascript_ajax)) {
$modeinput = 'hours';
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
print '<script type="text/javascript">'."\n";
print "jQuery(document).ready(function () {\n";
print " updateTotal(0,\''.$modeinput.'\');\n";
print ' jQuery(".timesheetalreadyrecorded").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { effect:\'toggle\', delay: 50 },
@ -809,8 +809,7 @@ if ($conf->use_javascript_ajax) {
return \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).'\';
}
});'."\n";
print ' updateTotal(0,\''.$modeinput.'\');';
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print "\n});\n";
print '</script>';
}

View File

@ -926,7 +926,7 @@ class Project extends CommonObject
}
// Fetch tasks
$this->getLinesArray($user);
$this->getLinesArray($user, 0);
// Delete tasks
$ret = $this->deleteTasks($user);
@ -2300,14 +2300,15 @@ class Project extends CommonObject
/**
* Create an array of tasks of current project
*
* @param User $user Object user we want project allowed to
* @return int >0 if OK, <0 if KO
* @param User $user Object user we want project allowed to
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
* @return int >0 if OK, <0 if KO
*/
public function getLinesArray($user)
public function getLinesArray($user, $loadRoleMode = 1)
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$taskstatic = new Task($this->db);
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0);
$this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode);
}
}

View File

@ -811,9 +811,10 @@ class Task extends CommonObjectLine
* @param int $includebilltime Calculate also the time to bill and billed
* @param array $search_array_options Array of search
* @param int $loadextras Fetch all Extrafields on each task
* @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action
* @return array Array of tasks
*/
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0)
public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1)
{
global $conf, $hookmanager;
@ -968,14 +969,16 @@ class Task extends CommonObjectLine
$obj = $this->db->fetch_object($resql);
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
$error++;
if ($loadRoleMode) {
if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user
if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) {
$error++;
}
}
}
if (is_object($usert)) { // If we ask a filter on a user affected to a task
if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) {
$error++;
if (is_object($usert)) { // If we ask a filter on a user affected to a task
if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) {
$error++;
}
}
}

View File

@ -342,9 +342,9 @@ $creditor = $mysoc->name;
$paramcreditor = 'ONLINE_PAYMENT_CREDITOR';
$paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix;
if (!empty($conf->global->$paramcreditorlong)) {
$creditor = $conf->global->$paramcreditorlong;
$creditor = $conf->global->$paramcreditorlong; // use label long of the seller to show
} elseif (!empty($conf->global->$paramcreditor)) {
$creditor = $conf->global->$paramcreditor;
$creditor = $conf->global->$paramcreditor; // use label short of the seller to show
}
$mesg = '';
@ -356,6 +356,8 @@ $mesg = '';
// Action dopayment is called after clicking/choosing the payment mode
if ($action == 'dopayment') {
dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment');
if ($paymentmethod == 'paypal') {
$PAYPAL_API_PRICE = price2num(GETPOST("newamount", 'alpha'), 'MT');
$PAYPAL_PAYMENT_TYPE = 'Sale';
@ -491,9 +493,9 @@ if ($action == 'charge' && isModEnabled('stripe')) {
$amountstripe = $amountstripe * 100;
}
dol_syslog("--- newpayment.php Execute action = ".$action." STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION'), LOG_DEBUG, 0, '_stripe');
dol_syslog("GET=".var_export($_GET, true), LOG_DEBUG, 0, '_stripe');
dol_syslog("POST=".var_export($_POST, true), LOG_DEBUG, 0, '_stripe');
dol_syslog("--- newpayment.php Execute action = ".$action." STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION'), LOG_DEBUG, 0, '_payment');
dol_syslog("GET=".var_export($_GET, true), LOG_DEBUG, 0, '_payment');
dol_syslog("POST=".var_export($_POST, true), LOG_DEBUG, 0, '_payment');
$stripeToken = GETPOST("stripeToken", 'alpha');
$email = GETPOST("email", 'alpha');
@ -503,10 +505,10 @@ if ($action == 'charge' && isModEnabled('stripe')) {
$vatnumber = GETPOST('vatnumber', 'alpha');
$savesource = GETPOSTISSET('savesource') ? GETPOST('savesource', 'int') : 1;
dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe');
dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_stripe');
dol_syslog("POST thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_stripe');
dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe');
dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_payment');
dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_payment');
dol_syslog("POST thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_payment');
dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_payment');
$error = 0;
$errormessage = '';
@ -527,7 +529,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
}
if ($thirdparty_id > 0) {
dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe');
dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_payment');
$service = 'StripeTest';
$servicestatus = 0;
@ -546,7 +548,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1);
if (empty($customer)) {
$error++;
dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERR, 0, '_stripe');
dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERR, 0, '_payment');
setEventMessages('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, null, 'errors');
$action = '';
}
@ -561,7 +563,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
if (empty($card)) {
$error++;
dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe');
dol_syslog('Failed to create card record', LOG_WARNING, 0, '_payment');
setEventMessages('Failed to create card record', null, 'errors');
$action = '';
} else {
@ -575,7 +577,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
$metadata["dol_type"] = $dol_type;
}
dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe');
dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_payment');
$charge = \Stripe\Charge::create(array(
'amount' => price2num($amountstripe, 'MU'),
'currency' => $currency,
@ -589,7 +591,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge)) {
$error++;
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe');
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_payment');
setEventMessages('Failed to charge card', null, 'errors');
$action = '';
}
@ -607,7 +609,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
if (empty($vatcleaned)) $taxinfo=null;
*/
dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe');
dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_payment');
$customer = \Stripe\Customer::create(array(
'email' => $email,
@ -644,7 +646,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
// The customer was just created with a source, so we can make a charge
// with no card defined, the source just used for customer creation will be used.
dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe');
dol_syslog("Create charge", LOG_DEBUG, 0, '_payment');
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => price2num($amountstripe, 'MU'),
@ -657,7 +659,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
if (empty($charge)) {
$error++;
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe');
dol_syslog('Failed to charge card', LOG_WARNING, 0, '_payment');
setEventMessages('Failed to charge card', null, 'errors');
$action = '';
}
@ -676,21 +678,21 @@ if ($action == 'charge' && isModEnabled('stripe')) {
$error++;
$errormessage = "ErrorCard ".$e->getMessage()." err=".var_export($err, true);
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\RateLimit $e) {
// Too many requests made to the API too quickly
$error++;
$errormessage = "ErrorRateLimit ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\InvalidRequest $e) {
// Invalid parameters were supplied to Stripe's API
$error++;
$errormessage = "ErrorInvalidRequest ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\Authentication $e) {
@ -698,14 +700,14 @@ if ($action == 'charge' && isModEnabled('stripe')) {
// (maybe you changed API keys recently)
$error++;
$errormessage = "ErrorAuthentication ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\ApiConnection $e) {
// Network communication with Stripe failed
$error++;
$errormessage = "ErrorApiConnection ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (\Stripe\Error\Base $e) {
@ -713,14 +715,14 @@ if ($action == 'charge' && isModEnabled('stripe')) {
// yourself an email
$error++;
$errormessage = "ErrorBase ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
} catch (Exception $e) {
// Something else happened, completely unrelated to Stripe
$error++;
$errormessage = "ErrorException ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
}
@ -755,7 +757,7 @@ if ($action == 'charge' && isModEnabled('stripe')) {
} catch (Exception $e) {
$error++;
$errormessage = "CantRetrievePaymentIntent ".$e->getMessage();
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($e->getMessage(), null, 'errors');
$action = '';
}
@ -763,13 +765,13 @@ if ($action == 'charge' && isModEnabled('stripe')) {
if ($paymentintent->status != 'succeeded') {
$error++;
$errormessage = "StatusOfRetrievedIntent is not succeeded: ".$paymentintent->status;
dol_syslog($errormessage, LOG_WARNING, 0, '_stripe');
dol_syslog($errormessage, LOG_WARNING, 0, '_payment');
setEventMessages($paymentintent->status, null, 'errors');
$action = '';
} else {
// TODO We can also record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method
// Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here.
//dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe');
//dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_payment');
// Get here amount and currency used for payment and force value into $amount and $currency so the real amount is saved into session instead
// of the amount and currency retreived from the POST.
@ -799,11 +801,11 @@ if ($action == 'charge' && isModEnabled('stripe')) {
$_SESSION['TRANSACTIONID'] = (is_object($charge) ? $charge->id : (is_object($paymentintent) ? $paymentintent->id : ''));
$_SESSION['errormessage'] = $errormessage;
dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_stripe');
dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_stripe');
dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_stripe');
dol_syslog("error=".$error." errormessage=".$errormessage, LOG_DEBUG, 0, '_stripe');
dol_syslog("Now call the redirect to paymentok or paymentko, URL = ".($error ? $urlko : $urlok), LOG_DEBUG, 0, '_stripe');
dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_payment');
dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_payment');
dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_payment');
dol_syslog("error=".$error." errormessage=".$errormessage, LOG_DEBUG, 0, '_payment');
dol_syslog("Now call the redirect to paymentok or paymentko, URL = ".($error ? $urlko : $urlok), LOG_DEBUG, 0, '_payment');
if ($error) {
header("Location: ".$urlko);
@ -832,6 +834,8 @@ $conf->dol_hide_leftmenu = 1;
$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea);
dol_syslog("newpayment.php show page paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment');
// Check link validity
if ($source && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', 'donation_ref', ''))) {
$langs->load("errors");
@ -2354,7 +2358,17 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
// Code for payment with option STRIPE_USE_NEW_CHECKOUT set
// Create a Stripe client.
<?php
if (empty($stripeacc)) {
?>
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>');
<?php
} else {
?>
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>', { stripeAccount: '<?php echo $stripeacc; ?>' });
<?php
}
?>
// Create an instance of Elements
var elements = stripe.elements();
@ -2397,9 +2411,19 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
} elseif (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) {
?>
// Code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION set to 1 or 2
// Create a Stripe client.
<?php
if (empty($stripeacc)) {
?>
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>');
<?php
} else {
?>
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>', { stripeAccount: '<?php echo $stripeacc; ?>' });
<?php
}
?>
<?php
if (getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION') == 2) {

View File

@ -1641,23 +1641,8 @@ class Reception extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on)
*
* @deprecated
* @see setBilled()
* @return int <0 if ko, >0 if ok
*/
public function set_billed()
{
// phpcs:enable
dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE);
return $this->setBilled();
}
/**
* Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on)
* Classify the reception as invoiced (used when WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE is on)
*
* @return int <0 if ko, >0 if ok
*/

View File

@ -1094,7 +1094,7 @@ class Thirdparties extends DolibarrApi
$invoice = new Facture($this->db);
$result = $invoice->list_replacable_invoices($id);
if ($result < 0) {
throw new RestException(405, $this->thirdparty->error);
throw new RestException(405, $invoice->error);
}
return $result;
@ -1137,7 +1137,7 @@ class Thirdparties extends DolibarrApi
$invoice = new Facture($this->db);
$result = $invoice->list_qualified_avoir_invoices($id);
if ($result < 0) {
throw new RestException(405, $this->thirdparty->error);
throw new RestException(405, $invoice->error);
}
return $result;
@ -1176,10 +1176,9 @@ class Thirdparties extends DolibarrApi
$sql .= " WHERE fk_soc = ".((int) $id);
}
$result = $this->db->query($sql);
if ($result->num_rows == 0) {
if ($this->db->num_rows($result) == 0) {
throw new RestException(404, 'Account not found');
}
@ -1421,7 +1420,7 @@ class Thirdparties extends DolibarrApi
if ($result > 0) {
return array("success" => $result);
} else {
throw new RestException(500, 'Error generating the document '.$this->error);
throw new RestException(500, 'Error generating the document '.$this->company->error);
}
}

View File

@ -1474,7 +1474,7 @@ class Societe extends CommonObject
$sql .= ",fk_effectif = ".($this->effectif_id > 0 ? ((int) $this->effectif_id) : "null");
if (isset($this->stcomm_id)) {
$sql .= ",fk_stcomm=".($this->stcomm_id > 0 ? ((int) $this->stcomm_id) : "0");
$sql .= ",fk_stcomm=".(int) $this->stcomm_id;
}
if (isset($this->typent_id)) {
$sql .= ",fk_typent = ".($this->typent_id > 0 ? ((int) $this->typent_id) : "0");

View File

@ -386,7 +386,7 @@ class Stripe extends CommonObject
// That's why we can comment the part of code to retrieve a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used)
$sql = "SELECT pi.ext_payment_id, pi.entity, pi.fk_facture, pi.sourcetype, pi.ext_payment_site";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pi";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pi";
$sql .= " WHERE pi.fk_facture = ".((int) $object->id);
$sql .= " AND pi.sourcetype = '".$this->db->escape($object->element)."'";
$sql .= " AND pi.entity IN (".getEntity('societe').")";
@ -530,12 +530,12 @@ class Stripe extends CommonObject
$paymentintentalreadyexists = 0;
// Check that payment intent $paymentintent->id is not already recorded.
$sql = "SELECT pi.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pi";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pi";
$sql .= " WHERE pi.entity IN (".getEntity('societe').")";
$sql .= " AND pi.ext_payment_site = '".$this->db->escape($service)."'";
$sql .= " AND pi.ext_payment_id = '".$this->db->escape($paymentintent->id)."'";
dol_syslog(get_class($this)."::getPaymentIntent search if payment intent already in prelevement_facture_demande", LOG_DEBUG);
dol_syslog(get_class($this)."::getPaymentIntent search if payment intent already in prelevement_demande", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@ -552,7 +552,7 @@ class Stripe extends CommonObject
// If not, we create it.
if (!$paymentintentalreadyexists) {
$now = dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site, amount)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site, amount)";
$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $user->id).", '".$this->db->escape($paymentintent->id)."', ".((int) $object->id).", '".$this->db->escape($object->element)."', ".((int) $conf->entity).", '".$this->db->escape($service)."', ".((float) $amount).")";
$resql = $this->db->query($sql);
if (!$resql) {
@ -696,12 +696,12 @@ class Stripe extends CommonObject
$setupintentalreadyexists = 0;
// Check that payment intent $setupintent->id is not already recorded.
$sql = "SELECT pi.rowid";
$sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi";
$sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_demande as pi";
$sql.= " WHERE pi.entity IN (".getEntity('societe').")";
$sql.= " AND pi.ext_payment_site = '" . $this->db->escape($service) . "'";
$sql.= " AND pi.ext_payment_id = '".$this->db->escape($setupintent->id)."'";
dol_syslog(get_class($this) . "::getPaymentIntent search if payment intent already in prelevement_facture_demande", LOG_DEBUG);
dol_syslog(get_class($this) . "::getPaymentIntent search if payment intent already in prelevement_demande", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
@ -717,7 +717,7 @@ class Stripe extends CommonObject
if (! $setupintentalreadyexists)
{
$now=dol_now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_facture_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site)";
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site)";
$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $user->id).", '".$this->db->escape($setupintent->id)."', ".((int) $object->id).", '".$this->db->escape($object->element)."', " . ((int) $conf->entity) . ", '" . $this->db->escape($service) . "', ".((float) $amount).")";
$resql = $this->db->query($sql);
if (! $resql)

View File

@ -92,7 +92,7 @@ $hookmanager->initHooks(array('cli'));
$now = dol_now();
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=".$userlogin." ***** ".dol_print_date($now, 'dayhourrfc')." *****\n";
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." - userlogin=".$userlogin." - ".dol_print_date($now, 'dayhourrfc')." *****\n";
// Check module cron is activated
if (empty($conf->cron->enabled)) {
@ -164,6 +164,10 @@ $user->getrights();
if (isset($argv[3]) && $argv[3]) {
$id = $argv[3];
}
$forcequalified = 0;
if (isset($argv[4]) && $argv[4] == '--force') {
$forcequalified = 1;
}
// create a jobs object
$object = new Cronjob($db);
@ -246,7 +250,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
}
//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database
if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) {
if ($forcequalified || (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now))) {
echo " - qualified";
dol_syslog("cron_run_jobs.php line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc'));
@ -313,7 +317,7 @@ exit(0);
*/
function usage($path, $script_file)
{
print "Usage: ".$script_file." securitykey userlogin|'firstadmin' [cronjobid]\n";
print "Usage: ".$script_file." securitykey userlogin|'firstadmin' [cronjobid] [--force]\n";
print "The script return 0 when everything worked successfully.\n";
print "\n";
print "On Linux system, you can have cron jobs ran automatically by adding an entry into cron.\n";
@ -321,4 +325,6 @@ function usage($path, $script_file)
print "30 3 * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n";
print "For example, to run pending tasks every 5mn, you can add this line:\n";
print "*/5 * * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n";
print "\n";
print "The option --force allow to bypass the check on date of execution so job will be executed even if date is not yet reached.\n";
}