forked from Wavyzz/dolibarr
Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -362,31 +362,31 @@ if ($type == 'directory') {
|
||||
if ($module == 'medias') {
|
||||
$useinecm = 6;
|
||||
$modulepart = 'medias';
|
||||
$perm = ($user->rights->website->write || $user->rights->emailing->creer);
|
||||
$perm = ($user->hasRight("website", "write") || $user->hasRight("emailing", "creer"));
|
||||
$title = 'none';
|
||||
} elseif ($module == 'ecm') { // DMS/ECM -> manual structure
|
||||
if ($user->rights->ecm->read) {
|
||||
if ($user->hasRight("ecm", "read")) {
|
||||
// Buttons: Preview
|
||||
$useinecm = 2;
|
||||
}
|
||||
|
||||
if ($user->rights->ecm->upload) {
|
||||
if ($user->hasRight("ecm", "upload")) {
|
||||
// Buttons: Preview + Delete
|
||||
$useinecm = 4;
|
||||
}
|
||||
|
||||
if ($user->rights->ecm->setup) {
|
||||
if ($user->hasRight("ecm", "setup")) {
|
||||
// Buttons: Preview + Delete + Edit
|
||||
$useinecm = 5;
|
||||
}
|
||||
|
||||
$perm = $user->rights->ecm->upload;
|
||||
$perm = $user->hasRight("ecm", "upload");
|
||||
$modulepart = 'ecm';
|
||||
$title = ''; // Use default
|
||||
} else {
|
||||
$useinecm = 5;
|
||||
$modulepart = 'ecm';
|
||||
$perm = $user->rights->ecm->upload;
|
||||
$perm = $user->hasRight("ecm", "upload");
|
||||
$title = ''; // Use default
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class box_activity extends ModeleBoxes
|
||||
$totalnb = 0;
|
||||
$line = 0;
|
||||
$cachetime = 3600;
|
||||
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir ? '1' : '0').'.cache';
|
||||
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->hasRight("societe", "client", "voir") ? '1' : '0').'.cache';
|
||||
$now = dol_now();
|
||||
$nbofperiod = 3;
|
||||
|
||||
@@ -102,7 +102,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
|
||||
// list the summary of the propals
|
||||
if (isModEnabled("propal") && $user->rights->propal->lire) {
|
||||
if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$propalstatic = new Propal($this->db);
|
||||
|
||||
@@ -189,7 +189,7 @@ class box_activity extends ModeleBoxes
|
||||
}
|
||||
|
||||
// list the summary of the orders
|
||||
if (isModEnabled('commande') && $user->rights->commande->lire) {
|
||||
if (isModEnabled('commande') && $user->hasRight("commande", "lire")) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$commandestatic = new Commande($this->db);
|
||||
|
||||
@@ -278,7 +278,7 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
|
||||
// list the summary of the bills
|
||||
if (isModEnabled('facture') && $user->rights->facture->lire) {
|
||||
if (isModEnabled('facture') && $user->hasRight("facture", "lire")) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$facturestatic = new Facture($this->db);
|
||||
|
||||
|
||||
@@ -131,8 +131,10 @@ class HookManager
|
||||
dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG);
|
||||
}
|
||||
|
||||
if (!empty($this->hooks[$context])) {
|
||||
ksort($this->hooks[$context], SORT_NATURAL);
|
||||
foreach ($arraycontext as $context) {
|
||||
if (!empty($this->hooks[$context])) {
|
||||
ksort($this->hooks[$context], SORT_NATURAL);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -3275,7 +3275,7 @@ class Form
|
||||
$langs->load('other');
|
||||
}
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock,";
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, p.fk_product_type, p.stock, p.tva_tx as tva_tx_sale, p.default_vat_code as default_vat_code_sale,";
|
||||
$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
|
||||
$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name,";
|
||||
$sql .= " pfp.supplier_reputation";
|
||||
@@ -3371,6 +3371,12 @@ class Form
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
if (is_null($objp->idprodfournprice)) {
|
||||
// There is no supplier price found, we will use the vat rate for sale
|
||||
$objp->tva_tx = $objp->tva_tx_sale;
|
||||
$objp->default_vat_code = $objp->default_vat_code_sale;
|
||||
}
|
||||
|
||||
$outkey = $objp->idprodfournprice; // id in table of price
|
||||
if (!$outkey && $alsoproductwithnosupplierprice) {
|
||||
$outkey = 'idprod_'.$objp->rowid; // id of product
|
||||
@@ -3566,14 +3572,17 @@ class Form
|
||||
if (empty($objp->idprodfournprice) && empty($alsoproductwithnosupplierprice)) {
|
||||
$optstart .= ' disabled';
|
||||
}
|
||||
|
||||
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
|
||||
$opt .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
|
||||
$opt .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
|
||||
$opt .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
|
||||
$opt .= ' data-up="'.dol_escape_htmltag($objp->unitprice).'"';
|
||||
$opt .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
|
||||
$opt .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
|
||||
$opt .= ' data-tvatx="'.dol_escape_htmltag($objp->tva_tx).'"';
|
||||
$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
|
||||
$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
|
||||
$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
|
||||
$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
|
||||
$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
|
||||
$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
|
||||
$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
|
||||
$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
|
||||
$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
|
||||
}
|
||||
$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
|
||||
|
||||
@@ -3585,7 +3594,8 @@ class Form
|
||||
'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
|
||||
'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
|
||||
'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
|
||||
'tva_tx' => $objp->tva_tx,
|
||||
'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
|
||||
'tva_tx' => price2num($objp->tva_tx),
|
||||
'default_vat_code' => $objp->default_vat_code,
|
||||
'discount' => $outdiscount,
|
||||
'type' => $outtype,
|
||||
@@ -3613,14 +3623,15 @@ class Form
|
||||
$outarray,
|
||||
array('key'=>$outkey,
|
||||
'value'=>$outref,
|
||||
'label'=>$outval,
|
||||
'label'=>$outvallabel,
|
||||
'qty'=>$outqty,
|
||||
'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
|
||||
'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
|
||||
'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
|
||||
'price_qty_ht_locale'=>price($objp->fprice),
|
||||
'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
|
||||
'price_unit_ht_locale'=>price($objp->unitprice),
|
||||
'tva_tx'=>$objp->tva_tx,
|
||||
'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
|
||||
'tva_tx_formated' => price($objp->tva_tx),
|
||||
'tva_tx'=>price2num($objp->tva_tx),
|
||||
'default_vat_code'=>$objp->default_vat_code,
|
||||
'discount'=>$outdiscount,
|
||||
'type'=>$outtype,
|
||||
@@ -5047,9 +5058,9 @@ class Form
|
||||
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
|
||||
|
||||
if ($input['type'] == 'text') {
|
||||
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n";
|
||||
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
|
||||
} elseif ($input['type'] == 'password') {
|
||||
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.$input['value'].'"'.$moreattr.' /></div></div>'."\n";
|
||||
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
|
||||
} elseif ($input['type'] == 'textarea') {
|
||||
/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
|
||||
$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
|
||||
|
||||
@@ -32,18 +32,19 @@ class FormMailing extends Form
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
|
||||
/**
|
||||
* Output a select with destinaries status
|
||||
*
|
||||
* @param string $selectedid The selected id
|
||||
* @param string $htmlname Name of controm
|
||||
* @param integer $show_empty Show empty option
|
||||
* @return string HTML select
|
||||
* @param string $selectedid The selected id
|
||||
* @param string $htmlname Name of controm
|
||||
* @param integer $show_empty Show empty option
|
||||
* @return string HTML select
|
||||
*/
|
||||
public function selectDestinariesStatus($selectedid = '', $htmlname = 'dest_status', $show_empty = 0)
|
||||
{
|
||||
|
||||
global $langs;
|
||||
|
||||
$langs->load("mails");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
|
||||
@@ -51,12 +52,9 @@ class FormMailing extends Form
|
||||
|
||||
$options = array();
|
||||
|
||||
if ($show_empty) {
|
||||
$options[-2] = ''; // Note -1 is used for error
|
||||
}
|
||||
|
||||
$options = $options + $mailing->statut_dest;
|
||||
|
||||
return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1);
|
||||
// Note -1 is used for error, so we use -2 for tempty value
|
||||
return Form::selectarray($htmlname, $options, $selectedid, ($show_empty ? -2 : 0), 0, 0, '', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
||||
$script .= '
|
||||
// For customer price when PRODUIT_CUSTOMER_PRICES_BY_QTY is on
|
||||
console.log("PRODUIT_CUSTOMER_PRICES_BY_QTY is on, propagate also prices by quantity into data-pbqxxx properties");
|
||||
$("#'.$htmlnamejquery.'").attr("data-pbq", ui.item.pbq);
|
||||
$("#'.$htmlnamejquery.'").attr("data-pbqup", ui.item.price_ht);
|
||||
$("#'.$htmlnamejquery.'").attr("data-pbqbase", ui.item.pricebasetype);
|
||||
|
||||
@@ -73,9 +73,11 @@ function expedition_prepare_head(Expedition $object)
|
||||
*/
|
||||
function expedition_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $db;
|
||||
$langs->load("sendings");
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@@ -87,23 +89,29 @@ function expedition_admin_prepare_head()
|
||||
*/
|
||||
|
||||
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
|
||||
$extrafields->fetch_name_optionals_label('expedition');
|
||||
$extrafields->fetch_name_optionals_label('expeditiondet');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/expedition.php";
|
||||
$head[$h][1] = $langs->trans("Shipment");
|
||||
$head[$h][2] = 'shipment';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['expedition']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes_shipment';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$nbExtrafields = $extrafields->attributes['expeditiondet']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributeslines_shipment';
|
||||
$h++;
|
||||
}
|
||||
@@ -114,15 +122,24 @@ function expedition_admin_prepare_head()
|
||||
$h++;
|
||||
|
||||
if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
|
||||
$extrafields->fetch_name_optionals_label('delivery');
|
||||
$extrafields->fetch_name_optionals_label('deliverydet');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = $extrafields->attributes['delivery']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributes_receivings';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$nbExtrafields = $extrafields->attributes['deliverydet']['count'];
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
|
||||
}
|
||||
$head[$h][2] = 'attributeslines_receivings';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
||||
*
|
||||
* 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
|
||||
@@ -9385,6 +9386,17 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
|
||||
continue;
|
||||
}
|
||||
if ($values[3]) {
|
||||
if ($filterorigmodule) { // If a filter of module origin has been requested
|
||||
if (strpos($values[3], '@')) { // This is an external module
|
||||
if ($filterorigmodule != 'external') {
|
||||
continue;
|
||||
}
|
||||
} else { // This looks a core module
|
||||
if ($filterorigmodule != 'core') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
$langs->load($values[3]);
|
||||
}
|
||||
if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) {
|
||||
|
||||
@@ -1043,7 +1043,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
||||
$regType = array();
|
||||
if (preg_match('/\{(t+)\}/i', $mask, $regType)) {
|
||||
$masktype = $regType[1];
|
||||
$masktype_value = substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask)
|
||||
$masktype_value = dol_substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask)
|
||||
$masktype_value = str_pad($masktype_value, dol_strlen($regType[1]), "#", STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask
|
||||
} else {
|
||||
$masktype = '';
|
||||
|
||||
@@ -994,7 +994,9 @@ class ImportCsv extends ModeleImports
|
||||
if ($sql) {
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
|
||||
if (!$is_table_category_link) {
|
||||
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
|
||||
}
|
||||
$insertdone = true;
|
||||
} else {
|
||||
//print 'E';
|
||||
|
||||
@@ -1041,7 +1041,9 @@ class ImportXlsx extends ModeleImports
|
||||
if ($sql) {
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
|
||||
if (!$is_table_category_link) {
|
||||
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
|
||||
}
|
||||
$insertdone = true;
|
||||
} else {
|
||||
//print 'E';
|
||||
|
||||
@@ -153,7 +153,7 @@ class doc_generic_product_odt extends ModelePDFProduct
|
||||
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
|
||||
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
|
||||
$texte .= '<textarea class="flat" cols="60" name="value1">';
|
||||
$texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH;
|
||||
$texte .= getDolGlobalString('PRODUCT_ADDON_PDF_ODT_PATH');
|
||||
$texte .= '</textarea>';
|
||||
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
|
||||
|
||||
@@ -44,13 +44,13 @@ $permtoadd = 0;
|
||||
$permtoupload = 0;
|
||||
$showroot = 0;
|
||||
if ($module == 'ecm') {
|
||||
$permtoadd = $user->rights->ecm->setup;
|
||||
$permtoupload = $user->rights->ecm->upload;
|
||||
$permtoadd = $user->hasRight("ecm", "setup");
|
||||
$permtoupload = $user->hasRight("ecm", "upload");
|
||||
$showroot = 0;
|
||||
}
|
||||
if ($module == 'medias') {
|
||||
$permtoadd = ($user->rights->mailing->creer || $user->rights->website->write);
|
||||
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->write);
|
||||
$permtoadd = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write"));
|
||||
$permtoupload = ($user->hasRight("mailing", "creer") || $user->hasRight("website", "write"));
|
||||
$showroot = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -971,10 +971,11 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
||||
}
|
||||
?>
|
||||
|
||||
// Deal with supplier ref price
|
||||
|
||||
// Deal with supplier ref price (idprodfournprice = int)
|
||||
if (jQuery('#idprodfournprice').val() > 0)
|
||||
{
|
||||
console.log("objectline_create.tpl #idprodfournprice is > 0, so we set some properties into page");
|
||||
console.log("objectline_create.tpl #idprodfournprice is is an ID > 0, so we set some properties into page");
|
||||
|
||||
var up = parseFloat($('option:selected', this).attr('data-up')); // When select is done from HTML select
|
||||
if (isNaN(up)) { up = parseFloat(jQuery('#idprodfournprice').attr('data-up'));} // When select is done from HTML input with ajax autocomplete
|
||||
@@ -1023,14 +1024,15 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
||||
}
|
||||
|
||||
<?php
|
||||
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
|
||||
if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) {
|
||||
?>
|
||||
var description = $('option:selected', this).attr('data-description');
|
||||
if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); }
|
||||
|
||||
console.log("Load desciption into text area : "+description);
|
||||
<?php
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) {
|
||||
?>
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
|
||||
{
|
||||
var editor = CKEDITOR.instances['dp_desc'];
|
||||
@@ -1039,15 +1041,41 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
||||
}
|
||||
}
|
||||
<?php
|
||||
} else { ?>
|
||||
} else {
|
||||
?>
|
||||
jQuery('#dp_desc').text(description);
|
||||
<?php
|
||||
}
|
||||
}?>
|
||||
}
|
||||
?>
|
||||
} else if (jQuery('#idprodfournprice').length > 0) {
|
||||
console.log("objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page");
|
||||
|
||||
var tva_tx = parseFloat($('option:selected', this).attr('data-tvatx')); // When select is done from HTML select
|
||||
if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery('#idprodfournprice').attr('data-tvatx'));} // When select is done from HTML input with ajax autocomplete
|
||||
|
||||
var default_vat_code = $('option:selected', this).attr('data-default-vat-code'); // When select is done from HTML select
|
||||
if (typeof default_vat_code === 'undefined') { default_vat_code = jQuery('#idprodfournprice').attr('data-default-vat-code');} // When select is done from HTML input with ajax autocomplete
|
||||
|
||||
var stringforvatrateselection = tva_tx;
|
||||
if (typeof default_vat_code != 'undefined' && default_vat_code != null) {
|
||||
stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')';
|
||||
}
|
||||
|
||||
console.log("objectline_create.tpl We find data for price : tva_tx = "+tva_tx+", default_vat_code = "+default_vat_code+", stringforvatrateselection="+stringforvatrateselection+" for product id = "+jQuery('#idprodfournprice').val());
|
||||
|
||||
// Set vat rate if field is an input box
|
||||
$('#tva_tx').val(tva_tx);
|
||||
// Set vat rate by selecting the combo
|
||||
//$('#tva_tx option').val(tva_tx); // This is bugged, it replaces the vat key of all options
|
||||
$('#tva_tx option').removeAttr('selected');
|
||||
console.log("stringforvatrateselection="+stringforvatrateselection+" -> value of option label for this key="+$('#tva_tx option[value="'+stringforvatrateselection+'"]').val());
|
||||
$('#tva_tx option[value="'+stringforvatrateselection+'"]').prop('selected', true);
|
||||
|
||||
<?php
|
||||
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
|
||||
if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) {
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) {
|
||||
?>
|
||||
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
|
||||
{
|
||||
var editor = CKEDITOR.instances['dp_desc'];
|
||||
@@ -1056,11 +1084,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
|
||||
}
|
||||
}
|
||||
<?php
|
||||
} else { ?>
|
||||
} else {
|
||||
?>
|
||||
jQuery('#dp_desc').text('');
|
||||
<?php
|
||||
}
|
||||
}?>
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user