Merge branch '11.0' into 11.0_FIX_11858_do_not_allow_lines_to_overlap_infotot
This commit is contained in:
commit
7ddf85cd33
@ -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,7 +254,9 @@ if ($result) {
|
|||||||
} else {
|
} else {
|
||||||
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
|
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
|
||||||
}
|
}
|
||||||
$links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
|
|
||||||
|
// 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'=> )
|
||||||
|
|
||||||
//var_dump($i);
|
//var_dump($i);
|
||||||
//var_dump($tabpay);
|
//var_dump($tabpay);
|
||||||
@ -319,7 +321,8 @@ if ($result) {
|
|||||||
$chargestatic->id = $links[$key]['url_id'];
|
$chargestatic->id = $links[$key]['url_id'];
|
||||||
$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,12 +334,14 @@ 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);
|
||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
|
|||||||
@ -41,12 +41,31 @@ $action = GETPOST('action', 'alpha');
|
|||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$reg = array();
|
||||||
|
|
||||||
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||||
{
|
{
|
||||||
$code=$reg[1];
|
$code=$reg[1];
|
||||||
|
|
||||||
|
// If constant is for a unique choice, delete other choices
|
||||||
|
if (in_array($code, array('STOCK_CALCULATE_ON_BILL', 'STOCK_CALCULATE_ON_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_SHIPMENT', 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE'))) {
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_BILL', $conf->entity);
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_VALIDATE_ORDER', $conf->entity);
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT', $conf->entity);
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE', $conf->entity);
|
||||||
|
}
|
||||||
|
if (in_array($code, array('STOCK_CALCULATE_ON_SUPPLIER_BILL', 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_RECEPTION', 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'))) {
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_BILL', $conf->entity);
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', $conf->entity);
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION', $conf->entity);
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', $conf->entity);
|
||||||
|
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', $conf->entity);
|
||||||
|
}
|
||||||
|
|
||||||
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -114,7 +133,7 @@ print '<td class="right">';
|
|||||||
if (! empty($conf->facture->enabled))
|
if (! empty($conf->facture->enabled))
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
|
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
|
||||||
@ -134,7 +153,7 @@ print '<td class="right">';
|
|||||||
if (! empty($conf->commande->enabled))
|
if (! empty($conf->commande->enabled))
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
|
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
|
||||||
@ -156,7 +175,7 @@ print '<td class="right">';
|
|||||||
if (! empty($conf->expedition->enabled))
|
if (! empty($conf->expedition->enabled))
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
|
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
|
||||||
@ -176,7 +195,7 @@ print '<td class="right">';
|
|||||||
if (! empty($conf->expedition->enabled))
|
if (! empty($conf->expedition->enabled))
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
|
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
|
||||||
@ -189,18 +208,12 @@ else
|
|||||||
print "</td>\n</tr>\n";
|
print "</td>\n</tr>\n";
|
||||||
$found++;
|
$found++;
|
||||||
|
|
||||||
/*if (! $found)
|
|
||||||
{
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
}*/
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
// Title rule for stock increase
|
// Title rule for stock increase
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -216,7 +229,7 @@ print '<td class="right">';
|
|||||||
if (! empty($conf->fournisseur->enabled))
|
if (! empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
|
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
|
||||||
@ -237,7 +250,7 @@ print '<td class="right">';
|
|||||||
if (! empty($conf->fournisseur->enabled))
|
if (! empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
|
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
|
||||||
@ -257,7 +270,7 @@ if (!empty($conf->reception->enabled))
|
|||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
|
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
|
||||||
@ -272,7 +285,7 @@ if (!empty($conf->reception->enabled))
|
|||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
|
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
|
||||||
@ -288,7 +301,7 @@ else
|
|||||||
if (! empty($conf->fournisseur->enabled))
|
if (! empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER');
|
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
|
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
|
||||||
|
|||||||
@ -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>';
|
||||||
|
|||||||
@ -781,8 +781,8 @@ class Categorie extends CommonObject
|
|||||||
|
|
||||||
$objs = array();
|
$objs = array();
|
||||||
|
|
||||||
$tmpclass = $this->MAP_OBJ_CLASS[$type];
|
$classnameforobj = $this->MAP_OBJ_CLASS[$type];
|
||||||
$obj = new $tmpclass($this->db);
|
$obj = new $classnameforobj($this->db);
|
||||||
|
|
||||||
$sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type];
|
$sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type];
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c";
|
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c";
|
||||||
@ -810,8 +810,11 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$obj = new $this->MAP_OBJ_CLASS[$type]($this->db);
|
$classnameforobj = $this->MAP_OBJ_CLASS[$type];
|
||||||
$obj->fetch($rec['fk_'.$this->MAP_CAT_FK[$type]]);
|
|
||||||
|
$obj = new $classnameforobj($this->db);
|
||||||
|
$obj->fetch($rec['fk_' . $this->MAP_CAT_FK[$type]]);
|
||||||
|
|
||||||
$objs[] = $obj;
|
$objs[] = $obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -180,6 +180,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
|||||||
$limit=5;
|
$limit=5;
|
||||||
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
|
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||||
|
$sql.= " WHERE entity IN (" . getEntity('prelevement') . ")";
|
||||||
$sql.= " ORDER BY datec DESC";
|
$sql.= " ORDER BY datec DESC";
|
||||||
$sql.= $db->plimit($limit);
|
$sql.= $db->plimit($limit);
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -94,7 +94,7 @@ class box_contacts extends ModeleBoxes
|
|||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sp.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($user->socid) $sql .= " AND sp.fk_soc = ".$user->socid;
|
if ($user->socid) $sql .= " AND sp.fk_soc = ".$user->socid;
|
||||||
$sql .= " ORDER BY sp.tms DESC";
|
$sql .= " ORDER BY sp.tms DESC";
|
||||||
$sql .= $this->db->plimit($max, 0);
|
$sql .= $this->db->plimit($max, 0);
|
||||||
|
|||||||
@ -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>';
|
||||||
|
|||||||
@ -354,7 +354,7 @@ class FormFile
|
|||||||
|
|
||||||
// Add entity in $param if not already exists
|
// Add entity in $param if not already exists
|
||||||
if (!preg_match('/entity\=[0-9]+/', $param)) {
|
if (!preg_match('/entity\=[0-9]+/', $param)) {
|
||||||
$param .= 'entity='.(!empty($object->entity) ? $object->entity : $conf->entity);
|
$param .= ($param ? '&' : '').'entity='.(!empty($object->entity) ? $object->entity : $conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
$printer = 0;
|
$printer = 0;
|
||||||
|
|||||||
@ -428,7 +428,7 @@ class SMTPs
|
|||||||
$host=preg_replace('@ssl://@i', '', $host); // Remove prefix
|
$host=preg_replace('@ssl://@i', '', $host); // Remove prefix
|
||||||
$host=preg_replace('@tls://@i', '', $host); // Remove prefix
|
$host=preg_replace('@tls://@i', '', $host); // Remove prefix
|
||||||
|
|
||||||
if ($usetls) $host='tls://'.$host;
|
if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host;
|
||||||
|
|
||||||
$hosth = $host;
|
$hosth = $host;
|
||||||
|
|
||||||
@ -568,6 +568,8 @@ class SMTPs
|
|||||||
$host=preg_replace('@ssl://@i', '', $host); // Remove prefix
|
$host=preg_replace('@ssl://@i', '', $host); // Remove prefix
|
||||||
$host=preg_replace('@tls://@i', '', $host); // Remove prefix
|
$host=preg_replace('@tls://@i', '', $host); // Remove prefix
|
||||||
|
|
||||||
|
if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host;
|
||||||
|
|
||||||
$hosth = $host;
|
$hosth = $host;
|
||||||
|
|
||||||
if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO))
|
if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO))
|
||||||
|
|||||||
@ -25,25 +25,26 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php).
|
* Generic function that return javascript to add to a page to transform a common input field into an autocomplete field by calling an Ajax page (ex: /societe/ajaxcompanies.php).
|
||||||
* The HTML field must be an input text with id=search_$htmlname.
|
* The HTML field must be an input text with id=search_$htmlname.
|
||||||
* This use the jQuery "autocomplete" function. If we want to use the select2, we must also convert the input into select on funcntions that call this method.
|
* This use the jQuery "autocomplete" function. If we want to use the select2, we must also convert the input into select on funcntions that call this method.
|
||||||
*
|
*
|
||||||
* @param string $selected Preselected value
|
* @param string $selected Preselected value
|
||||||
* @param string $htmlname HTML name of input field
|
* @param string $htmlname HTML name of input field
|
||||||
* @param string $url Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
|
* @param string $url Ajax Url to call for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
|
||||||
* @param string $urloption More parameters on URL request
|
* @param string $urloption More parameters on URL request
|
||||||
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
* @param int $minLength Minimum number of chars to trigger that Ajax search
|
||||||
* @param int $autoselect Automatic selection if just one value
|
* @param int $autoselect Automatic selection if just one value
|
||||||
* @param array $ajaxoptions Multiple options array
|
* @param array $ajaxoptions Multiple options array
|
||||||
* - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
|
* - Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
|
||||||
* - Ex: array('disabled'=> )
|
* - Ex: array('disabled'=> )
|
||||||
* - 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)
|
||||||
* @return string Script
|
* @param string $moreparams More params provided to ajax call
|
||||||
|
* @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";
|
||||||
@ -478,16 +479,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
|||||||
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
|
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
|
||||||
* @param int $entity Entity to set
|
* @param int $entity Entity to set
|
||||||
* @param int $revertonoff Revert on/off
|
* @param int $revertonoff Revert on/off
|
||||||
* @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
||||||
|
* @param int $forcenoajax 1=Force to use a ahref link instead of ajax code.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0)
|
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcenoajax = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
|
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
|
||||||
|
|
||||||
if (empty($conf->use_javascript_ajax))
|
if (empty($conf->use_javascript_ajax) || $forcenoajax)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||||
else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||||
|
|||||||
@ -8507,7 +8507,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
|
|||||||
$attr['class'] .= ' classfortooltip';
|
$attr['class'] .= ' classfortooltip';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($id)) {
|
if (!empty($id)) {
|
||||||
$attr['id'] = $id;
|
$attr['id'] = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,114 +24,131 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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;
|
||||||
}
|
|
||||||
$TNum = explode('.', $num);
|
|
||||||
$num = (int) $TNum[0];
|
|
||||||
$words = array();
|
|
||||||
$list1 = array(
|
|
||||||
'',
|
|
||||||
$langs->transnoentitiesnoconv('one'),
|
|
||||||
$langs->transnoentitiesnoconv('two'),
|
|
||||||
$langs->transnoentitiesnoconv('three'),
|
|
||||||
$langs->transnoentitiesnoconv('four'),
|
|
||||||
$langs->transnoentitiesnoconv('five'),
|
|
||||||
$langs->transnoentitiesnoconv('six'),
|
|
||||||
$langs->transnoentitiesnoconv('seven'),
|
|
||||||
$langs->transnoentitiesnoconv('eight'),
|
|
||||||
$langs->transnoentitiesnoconv('nine'),
|
|
||||||
$langs->transnoentitiesnoconv('ten'),
|
|
||||||
$langs->transnoentitiesnoconv('eleven'),
|
|
||||||
$langs->transnoentitiesnoconv('twelve'),
|
|
||||||
$langs->transnoentitiesnoconv('thirteen'),
|
|
||||||
$langs->transnoentitiesnoconv('fourteen'),
|
|
||||||
$langs->transnoentitiesnoconv('fifteen'),
|
|
||||||
$langs->transnoentitiesnoconv('sixteen'),
|
|
||||||
$langs->transnoentitiesnoconv('seventeen'),
|
|
||||||
$langs->transnoentitiesnoconv('eighteen'),
|
|
||||||
$langs->transnoentitiesnoconv('nineteen')
|
|
||||||
);
|
|
||||||
$list2 = array(
|
|
||||||
'',
|
|
||||||
$langs->transnoentitiesnoconv('ten'),
|
|
||||||
$langs->transnoentitiesnoconv('twenty'),
|
|
||||||
$langs->transnoentitiesnoconv('thirty'),
|
|
||||||
$langs->transnoentitiesnoconv('forty'),
|
|
||||||
$langs->transnoentitiesnoconv('fifty'),
|
|
||||||
$langs->transnoentitiesnoconv('sixty'),
|
|
||||||
$langs->transnoentitiesnoconv('seventy'),
|
|
||||||
$langs->transnoentitiesnoconv('eighty'),
|
|
||||||
$langs->transnoentitiesnoconv('ninety'),
|
|
||||||
$langs->transnoentitiesnoconv('hundred')
|
|
||||||
);
|
|
||||||
$list3 = array(
|
|
||||||
'',
|
|
||||||
$langs->transnoentitiesnoconv('thousand'),
|
|
||||||
$langs->transnoentitiesnoconv('million'),
|
|
||||||
$langs->transnoentitiesnoconv('billion'),
|
|
||||||
$langs->transnoentitiesnoconv('trillion'),
|
|
||||||
$langs->transnoentitiesnoconv('quadrillion')
|
|
||||||
);
|
|
||||||
|
|
||||||
$num_length = strlen($num);
|
|
||||||
$levels = (int) (($num_length + 2) / 3);
|
|
||||||
$max_length = $levels * 3;
|
|
||||||
$num = substr('00' . $num, -$max_length);
|
|
||||||
$num_levels = str_split($num, 3);
|
|
||||||
$nboflevels = count($num_levels);
|
|
||||||
for ($i = 0; $i < $nboflevels; $i++) {
|
|
||||||
$levels--;
|
|
||||||
$hundreds = (int) ($num_levels[$i] / 100);
|
|
||||||
$hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' '.$langs->transnoentities('hundred') . ( $hundreds == 1 ? '' : 's' ) . ' ': '');
|
|
||||||
$tens = (int) ($num_levels[$i] % 100);
|
|
||||||
$singles = '';
|
|
||||||
if ( $tens < 20 ) {
|
|
||||||
$tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' );
|
|
||||||
} else {
|
|
||||||
$tens = (int) ($tens / 10);
|
|
||||||
$tens = ' ' . $list2[$tens] . ' ';
|
|
||||||
$singles = (int) ($num_levels[$i] % 10);
|
|
||||||
$singles = ' ' . $list1[$singles] . ' ';
|
|
||||||
}
|
|
||||||
$words[] = $hundreds . $tens . $singles . ( ( $levels && ( int ) ( $num_levels[$i] ) ) ? ' ' . $list3[$levels] . ' ' : '' );
|
|
||||||
} //end for loop
|
|
||||||
$commas = count($words);
|
|
||||||
if ($commas > 1) {
|
|
||||||
$commas = $commas - 1;
|
|
||||||
}
|
|
||||||
$concatWords = implode(' ', $words);
|
|
||||||
// Delete multi whitespaces
|
|
||||||
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
|
|
||||||
|
|
||||||
if(!empty($currency)) {
|
|
||||||
$concatWords .= ' '.$currency;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we need to write cents call again this function for cents
|
if (!empty($conf->global->MAIN_MODULE_NUMBERWORDS)) {
|
||||||
if(!empty($TNum[1])) {
|
if ($currency) {
|
||||||
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
|
$type = 1;
|
||||||
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
|
} else {
|
||||||
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
|
$type = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$concatWords = $langs->getLabelFromNumber($num, $type);
|
||||||
|
return $concatWords;
|
||||||
|
} else {
|
||||||
|
$TNum = explode('.', $num);
|
||||||
|
$num = (int) $TNum[0];
|
||||||
|
$words = array();
|
||||||
|
$list1 = array(
|
||||||
|
'',
|
||||||
|
$langs->transnoentitiesnoconv('one'),
|
||||||
|
$langs->transnoentitiesnoconv('two'),
|
||||||
|
$langs->transnoentitiesnoconv('three'),
|
||||||
|
$langs->transnoentitiesnoconv('four'),
|
||||||
|
$langs->transnoentitiesnoconv('five'),
|
||||||
|
$langs->transnoentitiesnoconv('six'),
|
||||||
|
$langs->transnoentitiesnoconv('seven'),
|
||||||
|
$langs->transnoentitiesnoconv('eight'),
|
||||||
|
$langs->transnoentitiesnoconv('nine'),
|
||||||
|
$langs->transnoentitiesnoconv('ten'),
|
||||||
|
$langs->transnoentitiesnoconv('eleven'),
|
||||||
|
$langs->transnoentitiesnoconv('twelve'),
|
||||||
|
$langs->transnoentitiesnoconv('thirteen'),
|
||||||
|
$langs->transnoentitiesnoconv('fourteen'),
|
||||||
|
$langs->transnoentitiesnoconv('fifteen'),
|
||||||
|
$langs->transnoentitiesnoconv('sixteen'),
|
||||||
|
$langs->transnoentitiesnoconv('seventeen'),
|
||||||
|
$langs->transnoentitiesnoconv('eighteen'),
|
||||||
|
$langs->transnoentitiesnoconv('nineteen')
|
||||||
|
);
|
||||||
|
$list2 = array(
|
||||||
|
'',
|
||||||
|
$langs->transnoentitiesnoconv('ten'),
|
||||||
|
$langs->transnoentitiesnoconv('twenty'),
|
||||||
|
$langs->transnoentitiesnoconv('thirty'),
|
||||||
|
$langs->transnoentitiesnoconv('forty'),
|
||||||
|
$langs->transnoentitiesnoconv('fifty'),
|
||||||
|
$langs->transnoentitiesnoconv('sixty'),
|
||||||
|
$langs->transnoentitiesnoconv('seventy'),
|
||||||
|
$langs->transnoentitiesnoconv('eighty'),
|
||||||
|
$langs->transnoentitiesnoconv('ninety'),
|
||||||
|
$langs->transnoentitiesnoconv('hundred')
|
||||||
|
);
|
||||||
|
$list3 = array(
|
||||||
|
'',
|
||||||
|
$langs->transnoentitiesnoconv('thousand'),
|
||||||
|
$langs->transnoentitiesnoconv('million'),
|
||||||
|
$langs->transnoentitiesnoconv('billion'),
|
||||||
|
$langs->transnoentitiesnoconv('trillion'),
|
||||||
|
$langs->transnoentitiesnoconv('quadrillion')
|
||||||
|
);
|
||||||
|
|
||||||
|
$num_length = strlen($num);
|
||||||
|
$levels = (int) (($num_length + 2) / 3);
|
||||||
|
$max_length = $levels * 3;
|
||||||
|
$num = substr('00'.$num, -$max_length);
|
||||||
|
$num_levels = str_split($num, 3);
|
||||||
|
$nboflevels = count($num_levels);
|
||||||
|
for ($i = 0; $i < $nboflevels; $i++) {
|
||||||
|
$levels--;
|
||||||
|
$hundreds = (int) ($num_levels[$i] / 100);
|
||||||
|
$hundreds = ($hundreds ? ' '.$list1[$hundreds].' '.$langs->transnoentities('hundred').($hundreds == 1 ? '' : 's').' ' : '');
|
||||||
|
$tens = (int) ($num_levels[$i] % 100);
|
||||||
|
$singles = '';
|
||||||
|
if ($tens < 20) {
|
||||||
|
$tens = ($tens ? ' '.$list1[$tens].' ' : '');
|
||||||
|
} else {
|
||||||
|
$tens = (int) ($tens / 10);
|
||||||
|
$tens = ' '.$list2[$tens].' ';
|
||||||
|
$singles = (int) ($num_levels[$i] % 10);
|
||||||
|
$singles = ' '.$list1[$singles].' ';
|
||||||
|
}
|
||||||
|
$words[] = $hundreds.$tens.$singles.(($levels && (int) ($num_levels[$i])) ? ' '.$list3[$levels].' ' : '');
|
||||||
|
} //end for loop
|
||||||
|
$commas = count($words);
|
||||||
|
if ($commas > 1) {
|
||||||
|
$commas = $commas - 1;
|
||||||
|
}
|
||||||
|
$concatWords = implode(' ', $words);
|
||||||
|
// Delete multi whitespaces
|
||||||
|
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
|
||||||
|
|
||||||
|
if (!empty($currency)) {
|
||||||
|
$concatWords .= ' '.$currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we need to write cents call again this function for cents
|
||||||
|
$decimalpart = $TNum[1];
|
||||||
|
$decimalpart = preg_replace('/0+$/', '', $decimalpart);
|
||||||
|
|
||||||
|
if ($decimalpart) {
|
||||||
|
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
|
||||||
|
|
||||||
|
$concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true);
|
||||||
|
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
|
||||||
|
}
|
||||||
|
return $concatWords;
|
||||||
}
|
}
|
||||||
return $concatWords;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,41 +163,43 @@ 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);
|
||||||
for ($i=0; $i<$len; $i++)
|
for ($i = 0; $i < $len; $i++)
|
||||||
{
|
{
|
||||||
if ($strnumber[$i]=='.') {
|
if ($strnumber[$i] == '.') {
|
||||||
$parte_decimal = $strnumber[$i+1].$strnumber[$i+2];
|
$parte_decimal = $strnumber[$i + 1].$strnumber[$i + 2];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and
|
/*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and
|
||||||
in case exist why ask $lang like a parameter?*/
|
in case exist why ask $lang like a parameter?*/
|
||||||
if (((is_object($langs) && $langs->default == 'es_MX') || (! is_object($langs) && $langs == 'es_MX')) && $numorcurrency == 'currency')
|
if (((is_object($langs) && $langs->default == 'es_MX') || (!is_object($langs) && $langs == 'es_MX')) && $numorcurrency == 'currency')
|
||||||
{
|
{
|
||||||
if ($numero>=1 && $numero<2) {
|
if ($numero >= 1 && $numero < 2) {
|
||||||
return ("UN PESO ".$parte_decimal." / 100 M.N.");
|
return ("UN PESO ".$parte_decimal." / 100 M.N.");
|
||||||
}
|
}
|
||||||
elseif ($numero>=0 && $numero<1){
|
elseif ($numero >= 0 && $numero < 1) {
|
||||||
return ("CERO PESOS ".$parte_decimal." / 100 M.N.");
|
return ("CERO PESOS ".$parte_decimal." / 100 M.N.");
|
||||||
}
|
}
|
||||||
elseif ($numero>=1000000 && $numero<1000001){
|
elseif ($numero >= 1000000 && $numero < 1000001) {
|
||||||
return ("UN MILLÓN DE PESOS ".$parte_decimal." / 100 M.N.");
|
return ("UN MILLÓN DE PESOS ".$parte_decimal." / 100 M.N.");
|
||||||
}
|
}
|
||||||
elseif ($numero>=1000000000000 && $numero<1000000000001){
|
elseif ($numero >= 1000000000000 && $numero < 1000000000001) {
|
||||||
return ("UN BILLÓN DE PESOS ".$parte_decimal." / 100 M.N.");
|
return ("UN BILLÓN DE PESOS ".$parte_decimal." / 100 M.N.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$entexto ="";
|
$entexto = "";
|
||||||
$number = $numero;
|
$number = $numero;
|
||||||
if ($number >= 1000000000){
|
if ($number >= 1000000000) {
|
||||||
$CdMMillon = (int) ($numero / 100000000000);
|
$CdMMillon = (int) ($numero / 100000000000);
|
||||||
$numero = $numero - $CdMMillon * 100000000000;
|
$numero = $numero - $CdMMillon * 100000000000;
|
||||||
$DdMMillon = (int) ($numero / 10000000000);
|
$DdMMillon = (int) ($numero / 10000000000);
|
||||||
@ -190,7 +209,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
|
|||||||
$entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon);
|
$entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon);
|
||||||
$entexto .= " MIL ";
|
$entexto .= " MIL ";
|
||||||
}
|
}
|
||||||
if ($number >= 1000000){
|
if ($number >= 1000000) {
|
||||||
$CdMILLON = (int) ($numero / 100000000);
|
$CdMILLON = (int) ($numero / 100000000);
|
||||||
$numero = $numero - $CdMILLON * 100000000;
|
$numero = $numero - $CdMILLON * 100000000;
|
||||||
$DdMILLON = (int) ($numero / 10000000);
|
$DdMILLON = (int) ($numero / 10000000);
|
||||||
@ -198,7 +217,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
|
|||||||
$udMILLON = (int) ($numero / 1000000);
|
$udMILLON = (int) ($numero / 1000000);
|
||||||
$numero = $numero - $udMILLON * 1000000;
|
$numero = $numero - $udMILLON * 1000000;
|
||||||
$entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON);
|
$entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON);
|
||||||
if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON==1)
|
if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON == 1)
|
||||||
$entexto .= " MILLÓN ";
|
$entexto .= " MILLÓN ";
|
||||||
else
|
else
|
||||||
$entexto .= " MILLONES ";
|
$entexto .= " MILLONES ";
|
||||||
@ -219,7 +238,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
|
|||||||
$d = (int) ($numero / 10);
|
$d = (int) ($numero / 10);
|
||||||
$u = (int) $numero - $d * 10;
|
$u = (int) $numero - $d * 10;
|
||||||
$entexto .= hundreds2text($c, $d, $u);
|
$entexto .= hundreds2text($c, $d, $u);
|
||||||
if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number>1000000)
|
if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number > 1000000)
|
||||||
$entexto .= " DE";
|
$entexto .= " DE";
|
||||||
$entexto .= " PESOS ".$parte_decimal." / 100 M.N.";
|
$entexto .= " PESOS ".$parte_decimal." / 100 M.N.";
|
||||||
}
|
}
|
||||||
@ -237,40 +256,40 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
|
|||||||
*/
|
*/
|
||||||
function hundreds2text($hundreds, $tens, $units)
|
function hundreds2text($hundreds, $tens, $units)
|
||||||
{
|
{
|
||||||
if ($hundreds==1 && $tens==0 && $units==0){
|
if ($hundreds == 1 && $tens == 0 && $units == 0) {
|
||||||
return "CIEN";
|
return "CIEN";
|
||||||
}
|
}
|
||||||
$centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS");
|
$centenas = array("CIENTO", "DOSCIENTOS", "TRESCIENTOS", "CUATROCIENTOS", "QUINIENTOS", "SEISCIENTOS", "SETECIENTOS", "OCHOCIENTOS", "NOVECIENTOS");
|
||||||
$decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA ");
|
$decenas = array("", "", "TREINTA ", "CUARENTA ", "CINCUENTA ", "SESENTA ", "SETENTA ", "OCHENTA ", "NOVENTA ");
|
||||||
$veintis = array("VEINTE","VEINTIUN","VEINTIDÓS","VEINTITRÉS","VEINTICUATRO","VEINTICINCO","VEINTISÉIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE");
|
$veintis = array("VEINTE", "VEINTIUN", "VEINTIDÓS", "VEINTITRÉS", "VEINTICUATRO", "VEINTICINCO", "VEINTISÉIS", "VEINTISIETE", "VEINTIOCHO", "VEINTINUEVE");
|
||||||
$diecis = array("DIEZ","ONCE","DOCE","TRECE","CATORCE","QUINCE","DIECISÉIS","DIECISIETE","DIECIOCHO","DIECINUEVE");
|
$diecis = array("DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECISÉIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE");
|
||||||
$unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE");
|
$unidades = array("UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE");
|
||||||
$entexto = "";
|
$entexto = "";
|
||||||
if ($hundreds!=0){
|
if ($hundreds != 0) {
|
||||||
$entexto .= $centenas[$hundreds-1];
|
$entexto .= $centenas[$hundreds - 1];
|
||||||
}
|
}
|
||||||
if ($tens>2){
|
if ($tens > 2) {
|
||||||
if ($hundreds!=0) $entexto .= " ";
|
if ($hundreds != 0) $entexto .= " ";
|
||||||
$entexto .= $decenas[$tens-1];
|
$entexto .= $decenas[$tens - 1];
|
||||||
if ($units!=0){
|
if ($units != 0) {
|
||||||
$entexto .= " Y ";
|
$entexto .= " Y ";
|
||||||
$entexto .= $unidades[$units-1];
|
$entexto .= $unidades[$units - 1];
|
||||||
}
|
}
|
||||||
return $entexto;
|
return $entexto;
|
||||||
}
|
}
|
||||||
elseif ($tens==2){
|
elseif ($tens == 2) {
|
||||||
if ($hundreds!=0) $entexto .= " ";
|
if ($hundreds != 0) $entexto .= " ";
|
||||||
$entexto .= " ".$veintis[$units];
|
$entexto .= " ".$veintis[$units];
|
||||||
return $entexto;
|
return $entexto;
|
||||||
}
|
}
|
||||||
elseif ($tens==1){
|
elseif ($tens == 1) {
|
||||||
if ($hundreds!=0) $entexto .= " ";
|
if ($hundreds != 0) $entexto .= " ";
|
||||||
$entexto .= $diecis[$units];
|
$entexto .= $diecis[$units];
|
||||||
return $entexto;
|
return $entexto;
|
||||||
}
|
}
|
||||||
if ($units!=0) {
|
if ($units != 0) {
|
||||||
if ($hundreds!=0 || $tens!=0) $entexto .= " ";
|
if ($hundreds != 0 || $tens != 0) $entexto .= " ";
|
||||||
$entexto .= $unidades[$units-1];
|
$entexto .= $unidades[$units - 1];
|
||||||
}
|
}
|
||||||
return $entexto;
|
return $entexto;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
@ -2108,7 +2107,7 @@ function pdf_getTotalQty($object, $type, $outputlangs)
|
|||||||
*/
|
*/
|
||||||
function pdf_getLinkedObjects($object, $outputlangs)
|
function pdf_getLinkedObjects($object, $outputlangs)
|
||||||
{
|
{
|
||||||
global $hookmanager;
|
global $db, $hookmanager;
|
||||||
|
|
||||||
$linkedobjects = array();
|
$linkedobjects = array();
|
||||||
|
|
||||||
@ -2175,8 +2174,13 @@ function pdf_getLinkedObjects($object, $outputlangs)
|
|||||||
// We concat this record info into fields xxx_value. title is overwrote.
|
// We concat this record info into fields xxx_value. title is overwrote.
|
||||||
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order
|
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order
|
||||||
{
|
{
|
||||||
$elementobject->fetchObjectLinked();
|
$elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
|
||||||
if (!empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']);
|
if (! empty($elementobject->linkedObjectsIds['commande'])){
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
|
$order = new Commande($db);
|
||||||
|
$ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande']));
|
||||||
|
if ($ret < 1) { $order=null; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!is_object($order))
|
if (!is_object($order))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
|
* Copyright (C) 2020 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -309,6 +310,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
|
||||||
{
|
{
|
||||||
@ -571,6 +576,18 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
|
|||||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||||
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($feature == 'agenda')// Also check myactions rights
|
||||||
|
{
|
||||||
|
if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
|
||||||
|
$action = new ActionComm($db);
|
||||||
|
$action->fetch($objectid);
|
||||||
|
if ($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id, $action->userassigned))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif (in_array($feature, $checkproject))
|
elseif (in_array($feature, $checkproject))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -234,12 +234,14 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
|
|||||||
!empty($conf->ficheinter->enabled)
|
!empty($conf->ficheinter->enabled)
|
||||||
) ? 1 : 0,
|
) ? 1 : 0,
|
||||||
'perms'=>(!empty($user->rights->propal->lire) ||
|
'perms'=>(!empty($user->rights->propal->lire) ||
|
||||||
!empty($user->rights->commande->lire) ||
|
!empty($user->rights->commande->lire) ||
|
||||||
!empty($user->rights->fournisseur->lire) ||
|
!empty($user->rights->fournisseur->lire) ||
|
||||||
!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,8 +1524,11 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
if ($subj == 0) // Line not shown yet, we show it
|
if ($subj == 0) // Line not shown yet, we show it
|
||||||
{
|
{
|
||||||
print '<!-- line not shown yet, we show it -->';
|
$warehouse_selected_id = GETPOST('entrepot_id', 'int');
|
||||||
print '<tr class="oddeven"><td colspan="3" ></td><td class="center">';
|
|
||||||
|
print '<!-- line not shown yet, we show it -->';
|
||||||
|
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 = '';
|
||||||
@ -1533,6 +1536,9 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
$disabled = 'disabled="disabled"';
|
$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"';
|
||||||
|
}
|
||||||
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 : '').'> ';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -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 = {};
|
||||||
|
|||||||
@ -242,7 +242,7 @@ class DoliStorage implements TokenStorageInterface
|
|||||||
$sql.= " WHERE service='".$this->db->escape($service)."'";
|
$sql.= " WHERE service='".$this->db->escape($service)."'";
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
$result = $this->db->fetch_array($resql);
|
$result = $this->db->fetch_array($resql);
|
||||||
$states[$service] = $result[state];
|
$states[$service] = $result['state'];
|
||||||
$this->states[$service] = $states[$service];
|
$this->states[$service] = $states[$service];
|
||||||
|
|
||||||
return is_array($states)
|
return is_array($states)
|
||||||
|
|||||||
@ -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=U.P. (inc. tax)
|
|||||||
Amount=Amount
|
Amount=Amount
|
||||||
AmountInvoice=Invoice amount
|
AmountInvoice=Invoice amount
|
||||||
AmountInvoiced=Amount invoiced
|
AmountInvoiced=Amount invoiced
|
||||||
AmountInvoicedHT=Amount invoiced (incl. tax)
|
AmountInvoicedHT=Amount invoiced (excl. tax)
|
||||||
AmountInvoicedTTC=Amount invoiced (excl. tax)
|
AmountInvoicedTTC=Amount invoiced (inc. tax)
|
||||||
AmountPayment=Payment amount
|
AmountPayment=Payment amount
|
||||||
AmountHTShort=Amount (excl.)
|
AmountHTShort=Amount (excl.)
|
||||||
AmountTTCShort=Amount (inc. tax)
|
AmountTTCShort=Amount (inc. tax)
|
||||||
|
|||||||
@ -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; }
|
||||||
|
|||||||
@ -552,7 +552,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Links with users
|
// Links with users
|
||||||
$salesreps = GETPOST('commercial', 'array');
|
$salesreps = GETPOST('commercial', 'array');
|
||||||
$result = $object->setSalesRep($salesreps);
|
$result = $object->setSalesRep($salesreps, true);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -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';
|
||||||
|
|||||||
@ -4270,9 +4270,10 @@ class Societe extends CommonObject
|
|||||||
* Sets sales representatives of the thirdparty
|
* Sets sales representatives of the thirdparty
|
||||||
*
|
*
|
||||||
* @param int[]|int $salesrep User ID or array of user IDs
|
* @param int[]|int $salesrep User ID or array of user IDs
|
||||||
|
* @param bool $onlyAdd Only add (no delete before)
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function setSalesRep($salesrep)
|
public function setSalesRep($salesrep, $onlyAdd = false)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
@ -4281,16 +4282,18 @@ class Societe extends CommonObject
|
|||||||
$salesrep = array($salesrep);
|
$salesrep = array($salesrep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current users
|
|
||||||
$existing = $this->getSalesRepresentatives($user, 1);
|
|
||||||
|
|
||||||
// Diff
|
$to_del = array(); // Nothing to delete
|
||||||
if (is_array($existing)) {
|
$to_add = $salesrep;
|
||||||
$to_del = array_diff($existing, $salesrep);
|
if ($onlyAdd === false) {
|
||||||
$to_add = array_diff($salesrep, $existing);
|
// Get current users
|
||||||
} else {
|
$existing = $this->getSalesRepresentatives($user, 1);
|
||||||
$to_del = array(); // Nothing to delete
|
|
||||||
$to_add = $salesrep;
|
// Diff
|
||||||
|
if (is_array($existing)) {
|
||||||
|
$to_del = array_diff($existing, $salesrep);
|
||||||
|
$to_add = array_diff($salesrep, $existing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -156,7 +156,10 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
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";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user