Merge branch '11.0' of https://github.com/dolibarr/dolibarr into 11.0
This commit is contained in:
commit
2b393d04e1
@ -8,6 +8,7 @@ ALL:
|
|||||||
Check "@CHANGE"
|
Check "@CHANGE"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PrestaShopWebservice:
|
PrestaShopWebservice:
|
||||||
---------------------
|
---------------------
|
||||||
Replace
|
Replace
|
||||||
@ -27,6 +28,19 @@ With
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DEBUGBAR:
|
||||||
|
---------
|
||||||
|
|
||||||
|
Move
|
||||||
|
this.options = {
|
||||||
|
bodyMarginBottom: true,
|
||||||
|
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom')),
|
||||||
|
};
|
||||||
|
few line lower in the
|
||||||
|
initialize: function() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ESCPOS:
|
ESCPOS:
|
||||||
-------
|
-------
|
||||||
Replace
|
Replace
|
||||||
|
|||||||
@ -254,6 +254,8 @@ if ($result) {
|
|||||||
} else {
|
} else {
|
||||||
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
|
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load of url links to the line into llx_bank
|
||||||
$links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
|
$links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
|
||||||
|
|
||||||
//var_dump($i);
|
//var_dump($i);
|
||||||
@ -320,6 +322,7 @@ if ($result) {
|
|||||||
$chargestatic->ref = $links[$key]['url_id'];
|
$chargestatic->ref = $links[$key]['url_id'];
|
||||||
|
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2);
|
||||||
|
$reg = array();
|
||||||
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
||||||
if ($reg[1] == 'socialcontribution')
|
if ($reg[1] == 'socialcontribution')
|
||||||
$reg[1] = 'SocialContribution';
|
$reg[1] = 'SocialContribution';
|
||||||
@ -331,11 +334,13 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
|
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
|
||||||
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
|
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
|
||||||
|
|
||||||
|
// Retreive the accounting code of the social contribution of the payment from link of payment.
|
||||||
|
// Note: We have the social contribution id, it can be faster to get accounting code from social contribution id.
|
||||||
$sqlmid = 'SELECT cchgsoc.accountancy_code';
|
$sqlmid = 'SELECT cchgsoc.accountancy_code';
|
||||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc";
|
$sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc";
|
||||||
$sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
|
$sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
|
||||||
$sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
|
$sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
|
||||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
|
$sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid AND bkurl.type = 'payment_sc'";
|
||||||
$sqlmid .= " WHERE bkurl.fk_bank=".$obj->rowid;
|
$sqlmid .= " WHERE bkurl.fk_bank=".$obj->rowid;
|
||||||
|
|
||||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||||
|
|||||||
@ -302,7 +302,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
||||||
print '<input type="checkbox" name="nobin_drop"'.((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''.' id="checkbox_dump_drop" />';
|
print '<input type="checkbox" name="nobin_drop"'.(((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':'').' id="checkbox_dump_drop" />';
|
||||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</fieldset>';
|
print '</fieldset>';
|
||||||
|
|||||||
@ -1014,7 +1014,7 @@ class Commande extends CommonOrder
|
|||||||
// Complete vat rate with code
|
// Complete vat rate with code
|
||||||
$vatrate = $line->tva_tx;
|
$vatrate = $line->tva_tx;
|
||||||
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
||||||
|
$origin = (!empty($line->origin) ? $line->origin : $this->element);
|
||||||
$result = $this->addline(
|
$result = $this->addline(
|
||||||
$line->desc,
|
$line->desc,
|
||||||
$line->subprice,
|
$line->subprice,
|
||||||
@ -1039,7 +1039,7 @@ class Commande extends CommonOrder
|
|||||||
$line->label,
|
$line->label,
|
||||||
$line->array_options,
|
$line->array_options,
|
||||||
$line->fk_unit,
|
$line->fk_unit,
|
||||||
$this->element,
|
$origin,
|
||||||
$line->id
|
$line->id
|
||||||
);
|
);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
|
|||||||
@ -1442,7 +1442,7 @@ if (empty($reshook))
|
|||||||
if ($_POST['type'] == Facture::TYPE_DEPOSIT)
|
if ($_POST['type'] == Facture::TYPE_DEPOSIT)
|
||||||
{
|
{
|
||||||
$typeamount = GETPOST('typedeposit', 'alpha');
|
$typeamount = GETPOST('typedeposit', 'alpha');
|
||||||
$valuedeposit = GETPOST('valuedeposit', 'int');
|
$valuedeposit = price2num(GETPOST('valuedeposit', 'alpha'), 'MU');
|
||||||
|
|
||||||
$amountdeposit = array();
|
$amountdeposit = array();
|
||||||
if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA))
|
if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA))
|
||||||
|
|||||||
@ -416,7 +416,7 @@ class Facture extends CommonInvoice
|
|||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
||||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,6 +53,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inv
|
|||||||
|
|
||||||
$socid = GETPOST('socid', 'int');
|
$socid = GETPOST('socid', 'int');
|
||||||
|
|
||||||
|
$socid = GETPOST('socid', 'int');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
||||||
$lineid = GETPOST('lineid', 'int');
|
$lineid = GETPOST('lineid', 'int');
|
||||||
@ -151,6 +153,11 @@ if ($socid > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($socid > 0) {
|
||||||
|
$tmpthirdparty = new Societe($db);
|
||||||
|
$res = $tmpthirdparty->fetch($socid);
|
||||||
|
if ($res > 0) $search_societe = $tmpthirdparty->name;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
|
|||||||
@ -499,7 +499,7 @@ elseif ($modecompta == "BOOKKEEPING")
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Charges sociales non deductibles
|
* Social contributions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$subtotal_ht = 0;
|
$subtotal_ht = 0;
|
||||||
@ -512,7 +512,6 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql .= " WHERE cs.fk_type = c.id";
|
$sql .= " WHERE cs.fk_type = c.id";
|
||||||
$sql .= " AND c.deductible = 0";
|
|
||||||
if (!empty($date_start) && !empty($date_end))
|
if (!empty($date_start) && !empty($date_end))
|
||||||
$sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
$sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
@ -524,7 +523,6 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql .= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
$sql .= " WHERE p.fk_charge = cs.rowid";
|
$sql .= " WHERE p.fk_charge = cs.rowid";
|
||||||
$sql .= " AND cs.fk_type = c.id";
|
$sql .= " AND cs.fk_type = c.id";
|
||||||
$sql .= " AND c.deductible = 0";
|
|
||||||
if (!empty($date_start) && !empty($date_end))
|
if (!empty($date_start) && !empty($date_end))
|
||||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
@ -532,69 +530,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
|||||||
$sql .= " AND cs.entity = ".$conf->entity;
|
$sql .= " AND cs.entity = ".$conf->entity;
|
||||||
$sql .= " GROUP BY c.libelle, dm";
|
$sql .= " GROUP BY c.libelle, dm";
|
||||||
|
|
||||||
dol_syslog("get social contributions deductible=0 ", LOG_DEBUG);
|
dol_syslog("get social contributions", LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result) {
|
|
||||||
$num = $db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
if ($num) {
|
|
||||||
while ($i < $num) {
|
|
||||||
$obj = $db->fetch_object($result);
|
|
||||||
|
|
||||||
if (!isset($decaiss[$obj->dm])) $decaiss[$obj->dm] = 0;
|
|
||||||
$decaiss[$obj->dm] += $obj->amount;
|
|
||||||
|
|
||||||
if (!isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm] = 0;
|
|
||||||
$decaiss_ttc[$obj->dm] += $obj->amount;
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($modecompta == "BOOKKEEPING")
|
|
||||||
{
|
|
||||||
// Nothing from this table
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Charges sociales deductibles
|
|
||||||
*/
|
|
||||||
|
|
||||||
$subtotal_ht = 0;
|
|
||||||
$subtotal_ttc = 0;
|
|
||||||
if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES"))
|
|
||||||
{
|
|
||||||
if ($modecompta == 'CREANCES-DETTES')
|
|
||||||
{
|
|
||||||
$sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
|
||||||
$sql .= " WHERE cs.fk_type = c.id";
|
|
||||||
$sql .= " AND c.deductible = 1";
|
|
||||||
if (!empty($date_start) && !empty($date_end))
|
|
||||||
$sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
|
||||||
}
|
|
||||||
elseif ($modecompta == "RECETTES-DEPENSES")
|
|
||||||
{
|
|
||||||
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
|
||||||
$sql .= " WHERE p.fk_charge = cs.rowid";
|
|
||||||
$sql .= " AND cs.fk_type = c.id";
|
|
||||||
$sql .= " AND c.deductible = 1";
|
|
||||||
if (!empty($date_start) && !empty($date_end))
|
|
||||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= " AND cs.entity = ".$conf->entity;
|
|
||||||
$sql .= " GROUP BY c.libelle, dm";
|
|
||||||
|
|
||||||
dol_syslog("get social contributions paid deductible=1", LOG_DEBUG);
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
@ -734,7 +670,7 @@ elseif ($modecompta == 'BOOKKEEPING') {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Donation get dunning paiement
|
* Donation get dunning payments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES"))
|
if (!empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES"))
|
||||||
|
|||||||
@ -410,8 +410,8 @@ else
|
|||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
{
|
{
|
||||||
$page = 0;
|
$page = 0;
|
||||||
@ -421,14 +421,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (!$result)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
|
|
||||||
@ -784,7 +784,7 @@ $i = 0;
|
|||||||
$totalarray = array();
|
$totalarray = array();
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
$arraysocialnetworks = (array) json_decode($obj->socialnetworks, true);
|
$arraysocialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||||
$contactstatic->lastname = $obj->lastname;
|
$contactstatic->lastname = $obj->lastname;
|
||||||
@ -984,7 +984,7 @@ while ($i < min($num, $limit))
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($resql);
|
||||||
|
|
||||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
|||||||
@ -513,7 +513,7 @@ abstract class CommonDocGenerator
|
|||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
if (is_array($object->array_options) && count($object->array_options))
|
if (is_array($object->array_options) && count($object->array_options))
|
||||||
{
|
{
|
||||||
$extrafieldkey = $object->element;
|
$extrafieldkey = $object->table_element;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
$extrafields = new ExtraFields($this->db);
|
$extrafields = new ExtraFields($this->db);
|
||||||
|
|||||||
@ -7543,18 +7543,17 @@ abstract class CommonObject
|
|||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$fieldvalues = $this->setSaveQuery();
|
$fieldvalues = $this->setSaveQuery();
|
||||||
|
|
||||||
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now);
|
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now);
|
||||||
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id;
|
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id;
|
||||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
|
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
|
||||||
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
|
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
|
||||||
|
|
||||||
$keys = array();
|
$keys = array();
|
||||||
$values = array();
|
$values = array(); // Array to store string forged for SQL syntax
|
||||||
foreach ($fieldvalues as $k => $v) {
|
foreach ($fieldvalues as $k => $v) {
|
||||||
$keys[$k] = $k;
|
$keys[$k] = $k;
|
||||||
$value = $this->fields[$k];
|
$value = $this->fields[$k];
|
||||||
$values[$k] = $this->quote($v, $value);
|
$values[$k] = $this->quote($v, $value); // May return string 'NULL' if $value is null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean and check mandatory
|
// Clean and check mandatory
|
||||||
@ -7564,8 +7563,7 @@ abstract class CommonObject
|
|||||||
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = '';
|
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = '';
|
||||||
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
|
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
|
||||||
|
|
||||||
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
|
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && (!isset($values[$key]) || $values[$key] === 'NULL') && is_null($this->fields[$key]['default']))
|
||||||
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($this->fields[$key]['default']))
|
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
|
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
|
||||||
|
|||||||
@ -5842,7 +5842,7 @@ class Form
|
|||||||
}
|
}
|
||||||
elseif ($typehour == 'text' || $typehour == 'textselect')
|
elseif ($typehour == 'text' || $typehour == 'textselect')
|
||||||
{
|
{
|
||||||
$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" size="1" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
|
$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
|
||||||
}
|
}
|
||||||
else return 'BadValueForParameterTypeHour';
|
else return 'BadValueForParameterTypeHour';
|
||||||
|
|
||||||
@ -5866,7 +5866,7 @@ class Form
|
|||||||
}
|
}
|
||||||
elseif ($typehour == 'text')
|
elseif ($typehour == 'text')
|
||||||
{
|
{
|
||||||
$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" size="1" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
|
$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($typehour != 'text') $retstring .= ' '.$langs->trans('MinuteShort');
|
if ($typehour != 'text') $retstring .= ' '.$langs->trans('MinuteShort');
|
||||||
@ -5953,7 +5953,7 @@ class Form
|
|||||||
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
|
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
|
||||||
|
|
||||||
// No immediate load of all database
|
// No immediate load of all database
|
||||||
$urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter).($moreparams ? $moreparams : '');
|
$urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter);
|
||||||
// Activate the auto complete using ajax call.
|
// Activate the auto complete using ajax call.
|
||||||
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
|
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
|
||||||
$out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
|
$out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';
|
||||||
|
|||||||
@ -41,9 +41,10 @@
|
|||||||
* - Ex: array('show'=> )
|
* - Ex: array('show'=> )
|
||||||
* - Ex: array('update_textarea'=> )
|
* - Ex: array('update_textarea'=> )
|
||||||
* - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax)
|
* - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax)
|
||||||
|
* @param string $moreparams More params provided to ajax call
|
||||||
* @return string Script
|
* @return string Script
|
||||||
*/
|
*/
|
||||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array())
|
function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array(), $moreparams = '')
|
||||||
{
|
{
|
||||||
if (empty($minLength)) $minLength=1;
|
if (empty($minLength)) $minLength=1;
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
|||||||
|
|
||||||
// Input search_htmlname is original field
|
// Input search_htmlname is original field
|
||||||
// Input htmlname is a second input field used when using ajax autocomplete.
|
// Input htmlname is a second input field used when using ajax autocomplete.
|
||||||
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
|
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" '.($moreparams ? $moreparams : '').' />';
|
||||||
|
|
||||||
$script.= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
|
$script.= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
|
||||||
$script.= '<script>'."\n";
|
$script.= '<script>'."\n";
|
||||||
|
|||||||
@ -24,26 +24,38 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to return number in text.
|
* Function to return a number into a text.
|
||||||
|
* May use module NUMBERWORDS if found.
|
||||||
*
|
*
|
||||||
*
|
* @param float $num Number to convert (must be a numeric value, like reported by price2num())
|
||||||
* @param float $num Number to convert
|
|
||||||
* @param Translate $langs Language
|
* @param Translate $langs Language
|
||||||
* @param boolean $currency 0=number to translate | 1=currency to translate
|
* @param boolean $currency 0=number to translate | 1=currency to translate
|
||||||
* @param boolean $centimes 0=no centimes | 1=centimes to translate
|
* @param boolean $centimes 0=no cents/centimes | 1=there is cents/centimes to translate
|
||||||
* @return string|false Text of the number
|
* @return string|false Text of the number
|
||||||
*/
|
*/
|
||||||
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$num = str_replace(array(',', ' '), '', trim($num));
|
//$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value
|
||||||
if (!$num) {
|
if (!$num) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($centimes && strlen($num) == 1) {
|
if ($centimes && strlen($num) == 1) {
|
||||||
$num = $num * 10;
|
$num = $num * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_MODULE_NUMBERWORDS)) {
|
||||||
|
if ($currency) {
|
||||||
|
$type = 1;
|
||||||
|
} else {
|
||||||
|
$type = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$concatWords = $langs->getLabelFromNumber($num, $type);
|
||||||
|
return $concatWords;
|
||||||
|
} else {
|
||||||
$TNum = explode('.', $num);
|
$TNum = explode('.', $num);
|
||||||
$num = (int) $TNum[0];
|
$num = (int) $TNum[0];
|
||||||
$words = array();
|
$words = array();
|
||||||
@ -126,13 +138,18 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we need to write cents call again this function for cents
|
// If we need to write cents call again this function for cents
|
||||||
if(!empty($TNum[1])) {
|
$decimalpart = $TNum[1];
|
||||||
|
$decimalpart = preg_replace('/0+$/', '', $decimalpart);
|
||||||
|
|
||||||
|
if ($decimalpart) {
|
||||||
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
|
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
|
||||||
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
|
|
||||||
|
$concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true);
|
||||||
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
|
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
|
||||||
}
|
}
|
||||||
return $concatWords;
|
return $concatWords;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,10 +163,12 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
|||||||
*/
|
*/
|
||||||
function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
|
function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
|
||||||
{
|
{
|
||||||
// If the number is negative convert to positive and return -1 if is too long
|
// If the number is negative convert to positive and return -1 if it is too long
|
||||||
if ($numero < 0) $numero *= -1;
|
if ($numero < 0) $numero *= -1;
|
||||||
if ($numero >= 1000000000001)
|
if ($numero >= 1000000000001) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Get 2 decimals to cents, another functions round or truncate
|
// Get 2 decimals to cents, another functions round or truncate
|
||||||
$strnumber = number_format($numero, 10);
|
$strnumber = number_format($numero, 10);
|
||||||
$len = strlen($strnumber);
|
$len = strlen($strnumber);
|
||||||
|
|||||||
@ -1859,7 +1859,6 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag
|
|||||||
}
|
}
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($object->lines[$i]->special_code == 3) return '';
|
|
||||||
if (empty($hidedetails) || $hidedetails > 1) $result .= $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
|
if (empty($hidedetails) || $hidedetails > 1) $result .= $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -309,6 +309,10 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
|||||||
elseif ($feature == 'cheque')
|
elseif ($feature == 'cheque')
|
||||||
{
|
{
|
||||||
if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; }
|
if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; }
|
||||||
|
} elseif ($feature == 'import') {
|
||||||
|
if (!$user->rights->import->run) { $createok = 0; $nbko++; }
|
||||||
|
} elseif ($feature == 'ecm') {
|
||||||
|
if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; }
|
||||||
}
|
}
|
||||||
elseif (!empty($feature2)) // This is for permissions on one level
|
elseif (!empty($feature2)) // This is for permissions on one level
|
||||||
{
|
{
|
||||||
|
|||||||
@ -239,7 +239,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
|||||||
!empty($user->rights->supplier_proposal->lire) ||
|
!empty($user->rights->supplier_proposal->lire) ||
|
||||||
!empty($user->rights->supplier_order->lire) ||
|
!empty($user->rights->supplier_order->lire) ||
|
||||||
!empty($user->rights->contrat->lire) ||
|
!empty($user->rights->contrat->lire) ||
|
||||||
!empty($user->rights->ficheinter->lire)
|
!empty($user->rights->ficheinter->lire) ||
|
||||||
|
!empty($user->rights->supplier_order->lire) ||
|
||||||
|
!empty($user->rights->fournisseur->commande->lire)
|
||||||
),
|
),
|
||||||
'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
|
'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
|
||||||
);
|
);
|
||||||
@ -1704,7 +1706,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||||
{
|
{
|
||||||
// Project affected to user
|
// Project affected to user
|
||||||
$newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire);
|
$newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks');
|
||||||
$newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
|
$newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
|
||||||
$newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire);
|
$newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire);
|
||||||
$newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
|
$newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);
|
||||||
|
|||||||
@ -777,7 +777,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
|||||||
|
|
||||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||||
|
|
||||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact))?$object->contact:null), $usecontact, 'target', $object);
|
$usecontact = 0;
|
||||||
|
|
||||||
|
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact))?$object->contact:null), $usecontact, 'target', $object);
|
||||||
|
|
||||||
// Show recipient
|
// Show recipient
|
||||||
$widthrecbox=90;
|
$widthrecbox=90;
|
||||||
|
|||||||
@ -131,6 +131,21 @@ if ($action == 'presend')
|
|||||||
{
|
{
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
}
|
}
|
||||||
|
if ($object->element === 'facture' && !empty($conf->global->INVOICE_EMAIL_SENDER)) {
|
||||||
|
$formmail->frommail = $conf->global->INVOICE_EMAIL_SENDER;
|
||||||
|
$formmail->fromname = '';
|
||||||
|
$formmail->fromtype = 'special';
|
||||||
|
}
|
||||||
|
if ($object->element === 'shipping' && !empty($conf->global->SHIPPING_EMAIL_SENDER)) {
|
||||||
|
$formmail->frommail = $conf->global->SHIPPING_EMAIL_SENDER;
|
||||||
|
$formmail->fromname = '';
|
||||||
|
$formmail->fromtype = 'special';
|
||||||
|
}
|
||||||
|
if ($object->element === 'commande' && !empty($conf->global->COMMANDE_EMAIL_SENDER)) {
|
||||||
|
$formmail->frommail = $conf->global->COMMANDE_EMAIL_SENDER;
|
||||||
|
$formmail->fromname = '';
|
||||||
|
$formmail->fromtype = 'special';
|
||||||
|
}
|
||||||
$formmail->trackid=$trackid;
|
$formmail->trackid=$trackid;
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||||
{
|
{
|
||||||
|
|||||||
@ -60,7 +60,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
|
|||||||
// we keep position for the first line
|
// we keep position for the first line
|
||||||
$totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield'];
|
$totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield'];
|
||||||
}
|
}
|
||||||
$totalarray['totalizable'][$key]['total'] += $obj->$tmpkey;
|
if (is_numeric($obj->$tmpkey)) $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey;
|
||||||
}
|
}
|
||||||
if (!empty($val['isameasure']))
|
if (!empty($val['isameasure']))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1524,13 +1524,19 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
if ($subj == 0) // Line not shown yet, we show it
|
if ($subj == 0) // Line not shown yet, we show it
|
||||||
{
|
{
|
||||||
|
$warehouse_selected_id = GETPOST('entrepot_id', 'int');
|
||||||
|
|
||||||
print '<!-- line not shown yet, we show it -->';
|
print '<!-- line not shown yet, we show it -->';
|
||||||
print '<tr class="oddeven"><td colspan="3"></td><td class="center">';
|
print '<tr class="oddeven"><td colspan="3"></td><td class="center">';
|
||||||
|
|
||||||
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
{
|
{
|
||||||
$disabled = '';
|
$disabled = '';
|
||||||
if (!empty($conf->productbatch->enabled) && $product->hasbatch())
|
if (!empty($conf->productbatch->enabled) && $product->hasbatch())
|
||||||
{
|
{
|
||||||
|
$disabled = 'disabled="disabled"';
|
||||||
|
}
|
||||||
|
if ($warehouse_selected_id <= 0) { // We did not force a given warehouse, so we won't have no warehouse to change qty.
|
||||||
$disabled = 'disabled="disabled"';
|
$disabled = 'disabled="disabled"';
|
||||||
}
|
}
|
||||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
|
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
|
||||||
@ -1544,7 +1550,6 @@ if ($action == 'create')
|
|||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
{
|
{
|
||||||
$warehouse_selected_id = GETPOST('entrepot_id', 'int');
|
|
||||||
if ($warehouse_selected_id > 0)
|
if ($warehouse_selected_id > 0)
|
||||||
{
|
{
|
||||||
$warehouseObject = new Entrepot($db);
|
$warehouseObject = new Entrepot($db);
|
||||||
|
|||||||
@ -323,10 +323,10 @@ class Expedition extends CommonObject
|
|||||||
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null");
|
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null");
|
||||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null");
|
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null");
|
||||||
$sql.= ", '".$this->db->escape($this->tracking_number)."'";
|
$sql.= ", '".$this->db->escape($this->tracking_number)."'";
|
||||||
$sql.= ", ".$this->weight;
|
$sql.= ", ".(is_numeric($this->weight)?$this->weight:'NULL');
|
||||||
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
|
$sql.= ", ".(is_numeric($this->sizeS)?$this->sizeS:'NULL'); // TODO Should use this->trueDepth
|
||||||
$sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth
|
$sql.= ", ".(is_numeric($this->sizeW)?$this->sizeW:'NULL'); // TODO Should use this->trueWidth
|
||||||
$sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight
|
$sql.= ", ".(is_numeric($this->sizeH)?$this->sizeH:'NULL'); // TODO Should use this->trueHeight
|
||||||
$sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
|
$sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
|
||||||
$sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
|
$sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
|
||||||
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
|
|||||||
@ -330,9 +330,11 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method";
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||||
$sql .= " WHERE c.entity = ".$conf->entity;
|
|
||||||
|
if (empty($id)) $sql .= " WHERE c.entity IN (".getEntity('supplier_order').")";
|
||||||
|
else $sql .= " WHERE c.rowid=".$id;
|
||||||
|
|
||||||
if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'";
|
if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'";
|
||||||
else $sql .= " AND c.rowid=".$id;
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -892,6 +894,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1';
|
||||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
if (!$error)
|
if (!$error)
|
||||||
@ -1270,11 +1273,15 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
// $date_commande is deprecated
|
||||||
|
$date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set
|
||||||
|
if(empty($date)) $date = $now;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($this->source)) $this->source = 0;
|
if (empty($this->source)) $this->source = 0;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date);
|
||||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -359,7 +359,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$remise = $this->remise;
|
$remise = $this->remise;
|
||||||
|
|
||||||
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
|
||||||
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
|
||||||
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1008,7 +1008,7 @@ class ProductFournisseur extends Product
|
|||||||
//$out .= '<td class="liste_titre right">'.$langs->trans("QtyMin").'</td>';
|
//$out .= '<td class="liste_titre right">'.$langs->trans("QtyMin").'</td>';
|
||||||
$out .= '<td class="liste_titre">'.$langs->trans("User").'</td></tr>';
|
$out .= '<td class="liste_titre">'.$langs->trans("User").'</td></tr>';
|
||||||
foreach ($productFournLogList as $productFournLog) {
|
foreach ($productFournLogList as $productFournLog) {
|
||||||
$out .= '<tr><td class="right">'.dol_print_date($this->db->jdate($productFournLog['datec']), 'dayhour', 'tzuser').'</td>';
|
$out .= '<tr><td class="right">'.dol_print_date($productFournLog['datec'], 'dayhour', 'tzuser').'</td>';
|
||||||
$out .= '<td class="right">'.price($productFournLog['price']).'</td>';
|
$out .= '<td class="right">'.price($productFournLog['price']).'</td>';
|
||||||
//$out.= '<td class="right">'.$productFournLog['quantity'].'</td>';
|
//$out.= '<td class="right">'.$productFournLog['quantity'].'</td>';
|
||||||
$out .= '<td>'.$productFournLog['lastname'].'</td></tr>';
|
$out .= '<td>'.$productFournLog['lastname'].'</td></tr>';
|
||||||
|
|||||||
@ -460,11 +460,26 @@ if (empty($reshook))
|
|||||||
if ($idprod > 0)
|
if ($idprod > 0)
|
||||||
{
|
{
|
||||||
$label = $productsupplier->label;
|
$label = $productsupplier->label;
|
||||||
|
// Define output language
|
||||||
|
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = '';
|
||||||
|
if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
|
||||||
|
$newlang = GETPOST('lang_id', 'aZ09');
|
||||||
|
if (empty($newlang))
|
||||||
|
$newlang = $object->thirdparty->default_lang;
|
||||||
|
if (!empty($newlang)) {
|
||||||
|
$outputlangs = new Translate("", $conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
$desc = (!empty($productsupplier->multilangs [$outputlangs->defaultlang] ["description"])) ? $productsupplier->multilangs [$outputlangs->defaultlang] ["description"] : $productsupplier->description;
|
||||||
|
} else {
|
||||||
|
$desc = $productsupplier->description;
|
||||||
|
}
|
||||||
// if we use supplier description of the products
|
// if we use supplier description of the products
|
||||||
if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
|
if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
|
||||||
$desc = $productsupplier->desc_supplier;
|
$desc = $productsupplier->desc_supplier;
|
||||||
} else $desc = $productsupplier->description;
|
}
|
||||||
|
|
||||||
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
|
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||||
|
|
||||||
|
|||||||
@ -27,10 +27,10 @@
|
|||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||||
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||||
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
|
||||||
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers'));
|
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers'));
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ if ($result > 0)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->montant, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>';
|
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>';
|
||||||
|
|
||||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -409,12 +409,11 @@ if (typeof(PhpDebugBar) == 'undefined') {
|
|||||||
|
|
||||||
className: "phpdebugbar " + csscls('minimized'),
|
className: "phpdebugbar " + csscls('minimized'),
|
||||||
|
|
||||||
options: {
|
|
||||||
bodyMarginBottom: true,
|
|
||||||
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom'))
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
this.options = {
|
||||||
|
bodyMarginBottom: true,
|
||||||
|
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom')),
|
||||||
|
};
|
||||||
this.controls = {};
|
this.controls = {};
|
||||||
this.dataMap = {};
|
this.dataMap = {};
|
||||||
this.datasets = {};
|
this.datasets = {};
|
||||||
|
|||||||
@ -98,7 +98,7 @@ ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
|
|||||||
ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
|
ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
|
||||||
ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
|
ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
|
||||||
|
|
||||||
ALTER TABLE llx_bom_bomline DROP COLUMN rank;
|
ALTER TABLE llx_bom_bomline DROP COLUMN `rank`;
|
||||||
|
|
||||||
create table llx_categorie_warehouse
|
create table llx_categorie_warehouse
|
||||||
(
|
(
|
||||||
|
|||||||
@ -353,8 +353,8 @@ PriceUTTC=P.U TTC
|
|||||||
Amount=Montant
|
Amount=Montant
|
||||||
AmountInvoice=Montant facture
|
AmountInvoice=Montant facture
|
||||||
AmountInvoiced=Montant facturé
|
AmountInvoiced=Montant facturé
|
||||||
AmountInvoicedHT=Montant facturé (TTC)
|
AmountInvoicedHT=Montant facturé (HT)
|
||||||
AmountInvoicedTTC=Montant facturé (HT)
|
AmountInvoicedTTC=Montant facturé (TTC)
|
||||||
AmountPayment=Montant paiement
|
AmountPayment=Montant paiement
|
||||||
AmountHTShort=Montant HT
|
AmountHTShort=Montant HT
|
||||||
AmountTTCShort=Montant TTC
|
AmountTTCShort=Montant TTC
|
||||||
|
|||||||
@ -530,7 +530,7 @@ class MultiCurrency extends CommonObject
|
|||||||
$sql1.= " AND m.entity IN (".getEntity('multicurrency').")";
|
$sql1.= " AND m.entity IN (".getEntity('multicurrency').")";
|
||||||
$sql2= '';
|
$sql2= '';
|
||||||
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) $sql2.= ' AND DATE_FORMAT(mc.date_sync, "%Y-%m-%d") = "'.date('Y-m-d', $date_document).'"';
|
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) $sql2.= ' AND DATE_FORMAT(mc.date_sync, "%Y-%m-%d") = "'.date('Y-m-d', $date_document).'"';
|
||||||
$sql3.= ' ORDER BY mc.date_sync DESC LIMIT 1';
|
$sql3 = ' ORDER BY mc.date_sync DESC LIMIT 1';
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
$resql = $db->query($sql1.$sql2.$sql3);
|
$resql = $db->query($sql1.$sql2.$sql3);
|
||||||
|
|||||||
@ -66,12 +66,13 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if ($cancel) $action ='';
|
if ($cancel) $action ='';
|
||||||
|
|
||||||
// Action association d'un sousproduit
|
// Add subproduct to product
|
||||||
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
for ($i=0; $i < GETPOST("max_prod", 'int'); $i++)
|
$maxprod = GETPOST("max_prod", 'int');
|
||||||
|
for ($i=0; $i < $maxprod; $i++)
|
||||||
{
|
{
|
||||||
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
||||||
if ($qty > 0)
|
if ($qty > 0)
|
||||||
|
|||||||
@ -225,7 +225,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder);
|
print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total", "", $option, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "d.total_ht", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -208,7 +208,7 @@ if ($id > 0 || !empty($ref))
|
|||||||
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder);
|
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("DatePropal", $_SERVER["PHP_SELF"], "p.datep", "", $option, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("DatePropal", $_SERVER["PHP_SELF"], "p.datep", "", $option, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "p.total", "", $option, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "d.total_ht", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -104,6 +104,7 @@ class Entrepot extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $fields=array(
|
public $fields=array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10),
|
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10),
|
||||||
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>15),
|
||||||
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25),
|
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25),
|
||||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30),
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30),
|
||||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35),
|
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35),
|
||||||
@ -441,6 +442,7 @@ class Entrepot extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id";
|
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id";
|
||||||
|
$sql .= " , entity";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
|
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
@ -460,6 +462,7 @@ class Entrepot extends CommonObject
|
|||||||
$obj=$this->db->fetch_object($result);
|
$obj=$this->db->fetch_object($result);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
$this->entity = $obj->entity;
|
||||||
$this->fk_parent = $obj->fk_parent;
|
$this->fk_parent = $obj->fk_parent;
|
||||||
$this->ref = $obj->label;
|
$this->ref = $obj->label;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
|
|||||||
@ -209,13 +209,13 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as ccount ON ccount.rowid = t.fk
|
|||||||
$sql .= " WHERE t.entity IN (".getEntity('stock').")";
|
$sql .= " WHERE t.entity IN (".getEntity('stock').")";
|
||||||
foreach ($search as $key => $val)
|
foreach ($search as $key => $val)
|
||||||
{
|
{
|
||||||
if ($key == 'status' && $search[$key] == -1) continue;
|
if (($key == 'status' && $search[$key] == -1) || $key=='entity') continue;
|
||||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||||
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
||||||
if ($search[$key] == '-1') $search[$key] = '';
|
if ($search[$key] == '-1') $search[$key] = '';
|
||||||
$mode_search = 2;
|
$mode_search = 2;
|
||||||
}
|
}
|
||||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : $key), $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||||
}
|
}
|
||||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
|
|||||||
@ -78,6 +78,7 @@ $cancel != $langs->trans("Cancel") &&
|
|||||||
$object->label = $_POST["libelle"];
|
$object->label = $_POST["libelle"];
|
||||||
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
|
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
|
||||||
$object->other = dol_htmlcleanlastbr($_POST["other"]);
|
$object->other = dol_htmlcleanlastbr($_POST["other"]);
|
||||||
|
$object->update($object->id, $user);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,7 +63,7 @@ $search_agenda_label = GETPOST('search_agenda_label');
|
|||||||
$id = GETPOST("id", 'int');
|
$id = GETPOST("id", 'int');
|
||||||
$socid = 0;
|
$socid = 0;
|
||||||
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||||
$result = restrictedArea($user, 'projet', $id, '');
|
$result = restrictedArea($user, 'projet', $id, 'projet&project');
|
||||||
|
|
||||||
if (!$user->rights->projet->lire) accessforbidden();
|
if (!$user->rights->projet->lire) accessforbidden();
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,7 @@ $search_task_label = GETPOST('search_task_label');
|
|||||||
$search_task_description = GETPOST('search_task_description');
|
$search_task_description = GETPOST('search_task_description');
|
||||||
$search_project_user = GETPOST('search_project_user');
|
$search_project_user = GETPOST('search_project_user');
|
||||||
$search_task_user = GETPOST('search_task_user');
|
$search_task_user = GETPOST('search_task_user');
|
||||||
|
$search_societe = GETPOST('search_societe');
|
||||||
|
|
||||||
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
|
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
|
||||||
if ($mine) { $search_task_user = $user->id; $mine = 0; }
|
if ($mine) { $search_task_user = $user->id; $mine = 0; }
|
||||||
|
|||||||
@ -861,6 +861,11 @@ if (empty($reshook))
|
|||||||
$id = $socid;
|
$id = $socid;
|
||||||
$object->fetch($socid);
|
$object->fetch($socid);
|
||||||
|
|
||||||
|
// Selection of new fields
|
||||||
|
if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD) && (empty($conf->global->SOCIETE_DISABLE_CONTACTS) || !empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))) {
|
||||||
|
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$triggersendname = 'COMPANY_SENTBYMAIL';
|
$triggersendname = 'COMPANY_SENTBYMAIL';
|
||||||
$paramname = 'socid';
|
$paramname = 'socid';
|
||||||
|
|||||||
@ -891,7 +891,7 @@ class SupplierProposal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code);
|
if (!empty($this->multicurrency_code)) list($this->fk_multicurrency,$this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $now);
|
||||||
if (empty($this->fk_multicurrency))
|
if (empty($this->fk_multicurrency))
|
||||||
{
|
{
|
||||||
$this->multicurrency_code = $conf->currency;
|
$this->multicurrency_code = $conf->currency;
|
||||||
|
|||||||
@ -158,6 +158,9 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
|
|||||||
print 'Check sql file '.$file."\n";
|
print 'Check sql file '.$file."\n";
|
||||||
$filecontent = file_get_contents($dir.'/'.$file);
|
$filecontent = file_get_contents($dir.'/'.$file);
|
||||||
|
|
||||||
|
// Allow ` for 'rank' column name
|
||||||
|
$filecontent = str_replace('`rank`', '_rank_', $filecontent);
|
||||||
|
|
||||||
$result=strpos($filecontent, '`');
|
$result=strpos($filecontent, '`');
|
||||||
print __METHOD__." Result for checking we don't have back quote = ".$result."\n";
|
print __METHOD__." Result for checking we don't have back quote = ".$result."\n";
|
||||||
$this->assertTrue($result===false, 'Found back quote into '.$file.'. Bad.');
|
$this->assertTrue($result===false, 'Found back quote into '.$file.'. Bad.');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user