Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
61cf47aa16
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -164,7 +164,7 @@ if ($action == 'export_csv')
|
||||
print $object->get_compte_desc($line->numero_compte) . $sep;
|
||||
print price($line->debit) . $sep;
|
||||
print price($line->credit) . $sep;
|
||||
print price($line->credit - $line->debit) . $sep;
|
||||
print price($line->debit - $line->credit) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
@ -293,9 +293,9 @@ if ($action != 'export_csv')
|
||||
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
print '<td>' . $description . '</td>';
|
||||
print '<td class="right">' . price($line->debit) . '</td>';
|
||||
print '<td class="right">' . price($line->credit) . '</td>';
|
||||
print '<td class="right">' . price($line->credit - $line->debit) . '</td>';
|
||||
print '<td class="nowraponall right">' . price($line->debit) . '</td>';
|
||||
print '<td class="nowraponall right">' . price($line->credit) . '</td>';
|
||||
print '<td class="nowraponall right">' . price($line->debit - $line->credit) . '</td>';
|
||||
print '<td class="center">' . $link;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
@ -305,11 +305,11 @@ if ($action != 'export_csv')
|
||||
$sous_total_credit += $line->credit;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap right">' . price($sous_total_debit) . '</td><td class="nowrap right">' . price($sous_total_credit) . '</td><td class="nowrap right">' . price(price2num($sous_total_credit - $sous_total_debit)) . '</td>';
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap right">' . price($sous_total_debit) . '</td><td class="nowrap right">' . price($sous_total_credit) . '</td><td class="nowrap right">' . price(price2num($sous_total_debit - $sous_total_credit)) . '</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">' . $langs->trans("AccountBalance") . ':</td><td class="nowrap right">' . price($total_debit) . '</td><td class="nowrap right">' . price($total_credit) . '</td><td class="nowrap right">' . price(price2num($total_credit - $total_debit)) . '</td>';
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">' . $langs->trans("AccountBalance") . ':</td><td class="nowrap right">' . price($total_debit) . '</td><td class="nowrap right">' . price($total_credit) . '</td><td class="nowrap right">' . price(price2num($total_debit - $total_credit)) . '</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -424,7 +424,7 @@ class AdherentType extends CommonObject
|
||||
global $langs;
|
||||
if ($morphy == 'phy') { return $langs->trans("Physical"); }
|
||||
elseif ($morphy == 'mor') { return $langs->trans("Moral"); }
|
||||
else return $langs->trans("Physical & Morale");
|
||||
else return $langs->trans("MorPhy");
|
||||
//return $morphy;
|
||||
}
|
||||
|
||||
|
||||
@ -283,7 +283,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
print '<td class="center">';
|
||||
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); }
|
||||
elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); }
|
||||
else print $langs->trans("Physical & Morale");
|
||||
else print $langs->trans("MorPhy");
|
||||
print '</td>';
|
||||
print '<td class="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
|
||||
@ -40,7 +40,7 @@ $type = GETPOST('type', 'az09');
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$removeelem = GETPOST('removeelem', 'int');
|
||||
$elemid = GETPOST('elemid', 'alpha');
|
||||
$elemid = GETPOST('elemid', 'int');
|
||||
|
||||
if ($id == "" && $label == "")
|
||||
{
|
||||
|
||||
@ -835,7 +835,7 @@ else
|
||||
{
|
||||
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
|
||||
// You ensure that every user is using its own SMTP server when using the mass emailing module.
|
||||
$linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails.php">';
|
||||
$linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails_emailing.php">';
|
||||
$linktoadminemailend='</a>';
|
||||
setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
|
||||
setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings');
|
||||
|
||||
@ -335,15 +335,15 @@ class Mailing extends CommonObject
|
||||
|
||||
$target_array=array();
|
||||
|
||||
$sql = "SELECT fk_contact, ";
|
||||
$sql.=" lastname, ";
|
||||
$sql.=" firstname,";
|
||||
$sql.=" email,";
|
||||
$sql.=" other,";
|
||||
$sql.=" source_url,";
|
||||
$sql.=" source_id ,";
|
||||
$sql.=" source_type ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles ";
|
||||
$sql = "SELECT fk_contact,";
|
||||
$sql.= " lastname,";
|
||||
$sql.= " firstname,";
|
||||
$sql.= " email,";
|
||||
$sql.= " other,";
|
||||
$sql.= " source_url,";
|
||||
$sql.= " source_id ,";
|
||||
$sql.= " source_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.= " WHERE fk_mailing = ".$fromid;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
@ -353,14 +353,16 @@ class Mailing extends CommonObject
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($result)) {
|
||||
|
||||
$target_array[]=array('fk_contact'=>$obj->fk_contact,
|
||||
'lastname'=>$obj->lastname,
|
||||
'firstname'=>$obj->firstname,
|
||||
'email'=>$obj->email,
|
||||
'other'=>$obj->other,
|
||||
'source_url'=>$obj->source_url,
|
||||
'source_id'=>$obj->source_id,
|
||||
'source_type'=>$obj->source_type);
|
||||
$target_array[]=array(
|
||||
'fk_contact'=>$obj->fk_contact,
|
||||
'lastname'=>$obj->lastname,
|
||||
'firstname'=>$obj->firstname,
|
||||
'email'=>$obj->email,
|
||||
'other'=>$obj->other,
|
||||
'source_url'=>$obj->source_url,
|
||||
'source_id'=>$obj->source_id,
|
||||
'source_type'=>$obj->source_type
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -739,8 +739,11 @@ class BonPrelevement extends CommonObject
|
||||
$sql = "SELECT count(f.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql.= " WHERE f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql.= " WHERE f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
{
|
||||
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
$sql.= " AND f.rowid = pfd.fk_facture";
|
||||
$sql.= " AND pfd.traite = 0";
|
||||
$sql.= " AND f.total_ttc > 0";
|
||||
|
||||
@ -208,7 +208,10 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql.= " WHERE s.rowid = f.fk_soc";
|
||||
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
{
|
||||
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
$sql.= " AND f.total_ttc > 0";
|
||||
$sql.= " AND pfd.traite = 0";
|
||||
$sql.= " AND pfd.fk_facture = f.rowid";
|
||||
|
||||
@ -93,7 +93,10 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
if (!$status) $sql.= " AND pfd.traite = 0";
|
||||
if ($status) $sql.= " AND pfd.traite = ".$status;
|
||||
$sql.= " AND f.total_ttc > 0";
|
||||
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
{
|
||||
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
$sql.= " AND pfd.fk_facture = f.rowid";
|
||||
if (dol_strlen(trim(GETPOST('search_societe', 'alpha'))))
|
||||
{
|
||||
|
||||
@ -102,7 +102,10 @@ $sql.= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql.= " WHERE s.rowid = f.fk_soc";
|
||||
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql.= " AND f.total_ttc > 0";
|
||||
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
|
||||
{
|
||||
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
|
||||
}
|
||||
$sql.= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
|
||||
@ -433,7 +433,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$remise_percent = GETPOST('remise_percent'.$predef);
|
||||
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
|
||||
|
||||
if ($qty == '')
|
||||
{
|
||||
@ -566,7 +566,8 @@ if (empty($reshook))
|
||||
$info_bits=0;
|
||||
if ($tva_npr) $info_bits |= 0x01;
|
||||
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))))
|
||||
if (((! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance))
|
||||
|| empty($conf->global->MAIN_USE_ADVANCED_PERMS) ) && ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))))
|
||||
{
|
||||
$object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
|
||||
$result = -1 ;
|
||||
|
||||
@ -173,7 +173,7 @@ class box_activity extends ModeleBoxes
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="nowrap right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
@ -256,7 +256,7 @@ class box_activity extends ModeleBoxes
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="nowrap right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
@ -340,7 +340,7 @@ class box_activity extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="nowrap right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency)
|
||||
);
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ class box_comptes extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="right nowraponall"',
|
||||
'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code)
|
||||
);
|
||||
|
||||
|
||||
@ -179,12 +179,12 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
}
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="right nowraponall"',
|
||||
'text' => $price,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="nowrap"',
|
||||
'td' => 'class="right"',
|
||||
'text' => $price_base_type,
|
||||
);
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ class box_supplier_orders extends ModeleBoxes
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'td' => 'class="right nowrap"',
|
||||
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
||||
);
|
||||
|
||||
|
||||
@ -4237,7 +4237,7 @@ class Form
|
||||
$formconfirm.= '<td class="valid">';
|
||||
$formconfirm.= $this->selectyesno("confirm", $newselectedchoice);
|
||||
$formconfirm.= '</td>';
|
||||
$formconfirm.= '<td class="valid center"><input class="button valignmiddle" type="submit" onclick="this.disabled=\'disabled\' value="'.$langs->trans("Validate").'"></td>';
|
||||
$formconfirm.= '<td class="valid center"><input class="button valignmiddle" type="submit" value="'.$langs->trans("Validate").'"></td>';
|
||||
$formconfirm.= '</tr>'."\n";
|
||||
|
||||
$formconfirm.= '</table>'."\n";
|
||||
|
||||
@ -88,7 +88,6 @@ class mailing_advthirdparties extends MailingTargets
|
||||
|
||||
dol_syslog(get_class($this)."::add_to_target_spec mailing ".$num." targets found", LOG_DEBUG);
|
||||
|
||||
$old = '';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@ -144,7 +143,6 @@ class mailing_advthirdparties extends MailingTargets
|
||||
|
||||
dol_syslog(get_class($this)."::add_to_target_spec mailing ".$num." targets found");
|
||||
|
||||
$old = '';
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
@ -78,6 +78,7 @@ print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('
|
||||
print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'<br>'."\n";
|
||||
print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'<br>'."\n";
|
||||
print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'<br>'."\n";
|
||||
print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha')?GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha'):'undefined').'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
|
||||
@ -1275,6 +1276,144 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha'))
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
|
||||
/*
|
||||
* This script is meant to be run when upgrading from a dolibarr version < 3.8
|
||||
* to a newer version.
|
||||
*
|
||||
* Version 3.8 introduces a new column in llx_commande_fournisseur_dispatch, which
|
||||
* matches the dispatch to a specific supplier order line (so that if there are
|
||||
* several with the same product, the user can specifically tell which products of
|
||||
* which line were dispatched where).
|
||||
*
|
||||
* However when migrating, the new column has a default value of 0, which means that
|
||||
* old supplier orders whose lines were dispatched using the old dolibarr version
|
||||
* have unspecific dispatch lines, which are not taken into account by the new version,
|
||||
* thus making the order look like it was never dispatched at all.
|
||||
*
|
||||
* This scripts sets this foreign key to the first matching supplier order line whose
|
||||
* product (and supplier order of course) are the same as the dispatch’s.
|
||||
*
|
||||
* If the dispatched quantity is more than indicated on the order line (this happens if
|
||||
* there are several order lines for the same product), it creates new dispatch lines
|
||||
* pointing to the other order lines accordingly, until all the dispatched quantity is
|
||||
* accounted for.
|
||||
*/
|
||||
|
||||
$repair_link_dispatch_lines_supplier_order_lines = GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha');
|
||||
|
||||
|
||||
echo '<tr><th>Repair llx_commande_fournisseur_dispatch.fk_commandefourndet</th></tr>';
|
||||
echo '<tr><td>Repair in progress. This may take a while.</td></tr>';
|
||||
|
||||
$sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0';
|
||||
$db->begin();
|
||||
$resql_dispatch = $db->query($sql_dispatch);
|
||||
$n_processed_rows = 0;
|
||||
$errors = array();
|
||||
if ($resql_dispatch) {
|
||||
if ($db->num_rows($resql_dispatch) == 0) {
|
||||
echo '<tr><td>Nothing to do.</td></tr>';
|
||||
exit;
|
||||
}
|
||||
while ($obj_dispatch = $db->fetch_object($resql_dispatch)) {
|
||||
$sql_line = 'SELECT line.rowid, line.qty FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet AS line'
|
||||
. ' WHERE line.fk_commande = ' . $obj_dispatch->fk_commande
|
||||
. ' AND line.fk_product = ' . $obj_dispatch->fk_product;
|
||||
$resql_line = $db->query($sql_line);
|
||||
|
||||
// s’il y a plusieurs lignes avec le même produit sur cette commande fournisseur,
|
||||
// on divise la ligne de dispatch en autant de lignes qu’on en a sur la commande pour le produit
|
||||
// et on met la quantité de la ligne dans la limite du "budget" indiqué par dispatch.qty
|
||||
|
||||
$remaining_qty = $obj_dispatch->qty;
|
||||
$first_iteration = true;
|
||||
if (!$resql_line) {
|
||||
echo '<tr><td>Unable to find a matching supplier order line for dispatch #' . $obj_dispatch->rowid . '</td></tr>';
|
||||
$errors[] = $sql_line;
|
||||
$n_processed_rows++;
|
||||
continue;
|
||||
}
|
||||
if ($db->num_rows($resql_line) == 0) continue;
|
||||
while ($obj_line = $db->fetch_object($resql_line)) {
|
||||
if (!$remaining_qty) break;
|
||||
if (!$obj_line->rowid) {
|
||||
continue;
|
||||
}
|
||||
$qty_for_line = min($remaining_qty, $obj_line->qty);
|
||||
if ($first_iteration) {
|
||||
$sql_attach = 'UPDATE ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'
|
||||
. ' SET fk_commandefourndet = ' . $obj_line->rowid . ', qty = ' . $qty_for_line
|
||||
. ' WHERE rowid = ' . $obj_dispatch->rowid;
|
||||
$first_iteration = false;
|
||||
} else {
|
||||
$sql_attach_values = array(
|
||||
$obj_dispatch->fk_commande,
|
||||
$obj_dispatch->fk_product,
|
||||
$obj_line->rowid,
|
||||
$qty_for_line,
|
||||
$obj_dispatch->fk_entrepot,
|
||||
$obj_dispatch->fk_user,
|
||||
$obj_dispatch->datec ? '"' . $db->escape($obj_dispatch->datec) . '"' : 'NULL',
|
||||
$obj_dispatch->comment ? '"' . $db->escape($obj_dispatch->comment) . '"' : 'NULL',
|
||||
$obj_dispatch->status ?: 'NULL',
|
||||
$obj_dispatch->tms ? '"' . $db->escape($obj_dispatch->tms) . '"': 'NULL',
|
||||
$obj_dispatch->batch ?: 'NULL',
|
||||
$obj_dispatch->eatby ? '"' . $db->escape($obj_dispatch->eatby) . '"': 'NULL',
|
||||
$obj_dispatch->sellby ? '"' . $db->escape($obj_dispatch->sellby) . '"': 'NULL'
|
||||
);
|
||||
$sql_attach_values = join(', ', $sql_attach_values);
|
||||
|
||||
$sql_attach = 'INSERT INTO ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'
|
||||
. ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'
|
||||
. ' VALUES (' . $sql_attach_values . ')';
|
||||
}
|
||||
|
||||
if ($repair_link_dispatch_lines_supplier_order_lines == 'confirmed')
|
||||
{
|
||||
$resql_attach = $db->query($sql_attach);
|
||||
}
|
||||
else
|
||||
{
|
||||
$resql_attach = true; // Force success in test mode
|
||||
}
|
||||
|
||||
if ($resql_attach) {
|
||||
$remaining_qty -= $qty_for_line;
|
||||
} else {
|
||||
$errors[] = $sql_attach;
|
||||
}
|
||||
|
||||
$first_iteration = false;
|
||||
}
|
||||
$n_processed_rows++;
|
||||
|
||||
// report progress every 256th row
|
||||
if (!($n_processed_rows & 0xff)) {
|
||||
echo '<tr><td>Processed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "</td></tr>\n";
|
||||
flush();
|
||||
ob_flush();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo '<tr><td>Unable to find any dispatch without an fk_commandefourndet.' . "</td></tr>\n";
|
||||
echo $sql_dispatch . "\n";
|
||||
}
|
||||
echo '<tr><td>Fixed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "</td></tr>\n";
|
||||
echo '<tr><td>DONE.' . "</td></tr>\n";
|
||||
|
||||
if (count($errors)) {
|
||||
$db->rollback();
|
||||
echo '<tr><td>The transaction was rolled back due to errors: nothing was changed by the script.</td></tr>';
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
$db->close();
|
||||
|
||||
echo '<tr><td><h3>SQL queries with errors:</h3></tr></td>';
|
||||
echo '<tr><td>' . join('</td></tr><tr><td>', $errors) . '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -97,16 +97,14 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
|
||||
* This is the main function that returns the array of emails
|
||||
*
|
||||
* @param int $mailing_id Id of emailing
|
||||
* @param array $cibles Array with targets
|
||||
* @return int <0 if error, number of emails added if ok
|
||||
*/
|
||||
public function add_to_target($mailing_id, $cibles)
|
||||
public function add_to_target($mailing_id)
|
||||
{
|
||||
// phpcs:enable
|
||||
$target = array();
|
||||
$j = 0;
|
||||
|
||||
|
||||
$sql = " select rowid as id, email, firstname, lastname, plan, partner";
|
||||
$sql.= " from ".MAIN_DB_PREFIX."myobject";
|
||||
$sql.= " where email IS NOT NULL AND email != ''";
|
||||
|
||||
@ -284,14 +284,14 @@ class Product extends CommonObject
|
||||
* @var int
|
||||
*/
|
||||
public $barcode_type;
|
||||
|
||||
|
||||
/**
|
||||
* Main Barcode type code
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $barcode_type_code;
|
||||
|
||||
|
||||
/**
|
||||
* Additional barcodes (Some products have different barcodes according to the country of origin of manufacture)
|
||||
*
|
||||
@ -447,7 +447,7 @@ class Product extends CommonObject
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
$this->ref = dol_string_nospecial(trim($this->ref));
|
||||
$this->ref = dol_sanitizeFileName(dol_string_nospecial(trim($this->ref)));
|
||||
$this->label = trim($this->label);
|
||||
$this->price_ttc=price2num($this->price_ttc);
|
||||
$this->price=price2num($this->price);
|
||||
@ -2052,7 +2052,7 @@ class Product extends CommonObject
|
||||
$sql.= " fk_price_expression, price_autogen";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
if ($id) {
|
||||
$sql.= " WHERE rowid = ".$this->db->escape($id);
|
||||
$sql.= " WHERE rowid = ".(int) $id;
|
||||
} else {
|
||||
$sql.= " WHERE entity IN (".getEntity($this->element).")";
|
||||
if ($ref) {
|
||||
|
||||
@ -515,7 +515,7 @@ $moreforfilter='';
|
||||
// If the user can view user other than himself
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.='<div class="inline-block hideonsmartphone">'.$langs->trans('User'). ' </div>';
|
||||
$includeonly='hierachyme';
|
||||
$includeonly='hierarchyme';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200 marginleftonly');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
@ -564,7 +564,7 @@ if (! empty($conf->categorie->enabled))
|
||||
// If the user can view user other than himself
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.='<div class="inline-block hideonsmartphone">'.$langs->trans('User'). ' </div>';
|
||||
$includeonly='hierachyme';
|
||||
$includeonly='hierarchyme';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
@ -515,7 +515,7 @@ if (! empty($conf->categorie->enabled))
|
||||
// If the user can view user other than himself
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
|
||||
$includeonly='hierachyme';
|
||||
$includeonly='hierarchyme';
|
||||
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
|
||||
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
$moreforfilter.='</div>';
|
||||
|
||||
@ -393,6 +393,7 @@ class Stripe extends CommonObject
|
||||
{
|
||||
$metadata['dol_type'] = $object->element;
|
||||
$metadata['dol_id'] = $object->id;
|
||||
if (is_object($object->thirdparty) && $object->thirdparty->id > 0) $metadata['dol_thirdparty_id'] = $object->thirdparty->id;
|
||||
}
|
||||
|
||||
$dataforintent = array(
|
||||
|
||||
BIN
htdocs/theme/md/img/title_ticket.png
Normal file
BIN
htdocs/theme/md/img/title_ticket.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 234 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue
Block a user