forked from Wavyzz/dolibarr
New: [ task #498 ]
This commit is contained in:
@@ -633,18 +633,25 @@ else if ($action == "setabsolutediscount" && $user->rights->propale->creer)
|
|||||||
//Ajout d'une ligne produit dans la propale
|
//Ajout d'une ligne produit dans la propale
|
||||||
else if ($action == "addline" && $user->rights->propale->creer)
|
else if ($action == "addline" && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
if (empty($_POST['idprod']) && GETPOST('type') < 0)
|
$idprod=GETPOST('idprod', 'int');
|
||||||
|
//var_dump($_POST);
|
||||||
|
if (empty($idprod) && GETPOST('type') < 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]=='')) // Unit price can be 0 but not ''
|
if (empty($idprod) && (!(GETPOST('price_ht') >= 0) || GETPOST('price_ht') == '')) // Unit price can be 0 but not ''
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
if (empty($idprod) && ! GETPOST('product_desc'))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error && isset($_POST['qty']) && ((GETPOST('np_price')!='' && (GETPOST('np_desc') || GETPOST('dp_desc'))) || GETPOST('idprod')))
|
if (! $error && (GETPOST('qty') >= 0) && (GETPOST('product_desc') || ! empty($idprod)))
|
||||||
{
|
{
|
||||||
$pu_ht=0;
|
$pu_ht=0;
|
||||||
$pu_ttc=0;
|
$pu_ttc=0;
|
||||||
@@ -654,10 +661,10 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
// Ecrase $pu par celui du produit
|
// Ecrase $pu par celui du produit
|
||||||
// Ecrase $desc par celui du produit
|
// Ecrase $desc par celui du produit
|
||||||
// Ecrase $txtva par celui du produit
|
// Ecrase $txtva par celui du produit
|
||||||
if (GETPOST('idprod'))
|
if (! empty($idprod))
|
||||||
{
|
{
|
||||||
$prod = new Product($db);
|
$prod = new Product($db);
|
||||||
$prod->fetch(GETPOST('idprod'));
|
$prod->fetch($idprod);
|
||||||
|
|
||||||
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id);
|
$tva_tx = get_default_tva($mysoc,$object->client,$prod->id);
|
||||||
$localtax1_tx= get_localtax($tva_tx, 1, $object->client); //get_default_localtax($mysoc,$object->client,1,$prod->id);
|
$localtax1_tx= get_localtax($tva_tx, 1, $object->client); //get_default_localtax($mysoc,$object->client,1,$prod->id);
|
||||||
@@ -681,10 +688,10 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update if prices fields are defined
|
// Update if prices fields are defined
|
||||||
if (GETPOST('dp_price_ht') || GETPOST('dp_price_ttc'))
|
if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc')))
|
||||||
{
|
{
|
||||||
$price_ht=price2num(GETPOST('dp_price_ht'), 'MU');
|
$price_ht=price2num(GETPOST('price_ht'), 'MU');
|
||||||
$price_ttc=price2num(GETPOST('dp_price_ttc'), 'MU');
|
$price_ttc=price2num(GETPOST('price_ttc'), 'MU');
|
||||||
|
|
||||||
if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc)
|
if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc)
|
||||||
{
|
{
|
||||||
@@ -712,6 +719,12 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GETPOST('update_desc')) {
|
||||||
|
|
||||||
|
$desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||||
{
|
{
|
||||||
@@ -732,23 +745,28 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
$desc = $prod->description;
|
$desc = $prod->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
$desc.= ($desc && GETPOST('dp_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('dp_desc')))?"<br />\n":"\n") : "";
|
$desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : "";
|
||||||
$desc.= GETPOST('dp_desc');
|
$desc.= GETPOST('product_desc');
|
||||||
|
}
|
||||||
|
|
||||||
|
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):'');
|
||||||
|
|
||||||
$type = $prod->type;
|
$type = $prod->type;
|
||||||
$fournprice=(GETPOST('dp_fournprice')?GETPOST('dp_fournprice'):'');
|
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
|
||||||
$buyingprice=(GETPOST('dp_buying_price')?GETPOST('dp_buying_price'):'');
|
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pu_ht=GETPOST('np_price');
|
$pu_ht=GETPOST('price_ht');
|
||||||
$tva_tx=str_replace('*','',GETPOST('np_tva_tx'));
|
$tva_tx=str_replace('*','',GETPOST('tva_tx'));
|
||||||
$tva_npr=preg_match('/\*/',GETPOST('np_tva_tx'))?1:0;
|
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
|
||||||
$desc=GETPOST('np_desc');
|
$label=(GETPOST('product_label')?GETPOST('product_label'):'');
|
||||||
|
$desc=GETPOST('product_desc');
|
||||||
$type=GETPOST('type');
|
$type=GETPOST('type');
|
||||||
$localtax1_tx=get_localtax($tva_tx,1,$object->client);
|
$localtax1_tx=get_localtax($tva_tx,1,$object->client);
|
||||||
$localtax2_tx=get_localtax($tva_tx,2,$object->client);
|
$localtax2_tx=get_localtax($tva_tx,2,$object->client);
|
||||||
$fournprice=(GETPOST('np_fournprice')?GETPOST('np_fournprice'):'');
|
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
|
||||||
$buyingprice=(GETPOST('np_buying_price')?GETPOST('np_buying_price'):'');
|
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
|
||||||
}
|
}
|
||||||
|
|
||||||
$info_bits=0;
|
$info_bits=0;
|
||||||
@@ -756,7 +774,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
|
|
||||||
if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
|
if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
|
||||||
{
|
{
|
||||||
$mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency));
|
$mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency));
|
||||||
setEventMessage($mesg, 'errors');
|
setEventMessage($mesg, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -770,7 +788,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx,
|
$localtax1_tx,
|
||||||
$localtax2_tx,
|
$localtax2_tx,
|
||||||
GETPOST('idprod'),
|
$idprod,
|
||||||
GETPOST('remise_percent'),
|
GETPOST('remise_percent'),
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
$pu_ttc,
|
$pu_ttc,
|
||||||
@@ -780,7 +798,8 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
0,
|
0,
|
||||||
GETPOST('fk_parent_line'),
|
GETPOST('fk_parent_line'),
|
||||||
$fournprice,
|
$fournprice,
|
||||||
$buyingprice
|
$buyingprice,
|
||||||
|
$label
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@@ -803,17 +822,14 @@ else if ($action == "addline" && $user->rights->propale->creer)
|
|||||||
|
|
||||||
unset($_POST['qty']);
|
unset($_POST['qty']);
|
||||||
unset($_POST['type']);
|
unset($_POST['type']);
|
||||||
|
unset($_POST['price_ht']);
|
||||||
unset($_POST['np_price']);
|
unset($_POST['price_ttc']);
|
||||||
unset($_POST['np_tva_tx']);
|
unset($_POST['tva_tx']);
|
||||||
unset($_POST['np_desc']);
|
unset($_POST['product_ref']);
|
||||||
unset($_POST['np_fournprice']);
|
unset($_POST['product_label']);
|
||||||
unset($_POST['np_buying_price']);
|
unset($_POST['product_desc']);
|
||||||
|
unset($_POST['fournprice']);
|
||||||
unset($_POST['dp_desc']);
|
unset($_POST['buying_price']);
|
||||||
unset($_POST['dp_price']);
|
|
||||||
unset($_POST['dp_fournprice']);
|
|
||||||
unset($_POST['dp_buying_price']);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1562,25 +1578,16 @@ print '<table id="tablelines" class="noborder" width="100%">';
|
|||||||
$result = $object->getLinesArray();
|
$result = $object->getLinesArray();
|
||||||
if (! empty($object->lines)) $object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager);
|
if (! empty($object->lines)) $object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager);
|
||||||
|
|
||||||
/*
|
// Form to add new line
|
||||||
* Form to add new line
|
|
||||||
*/
|
|
||||||
if ($object->statut == 0 && $user->rights->propale->creer)
|
if ($object->statut == 0 && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
if ($action != 'editline')
|
if ($action != 'editline')
|
||||||
{
|
{
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
// Add free products/services
|
// Add free or predefined products/services
|
||||||
$object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager);
|
$object->formAddFreeProduct(0,$mysoc,$soc,$hookmanager);
|
||||||
|
|
||||||
// Add predefined products/services
|
|
||||||
if ($conf->product->enabled || $conf->service->enabled)
|
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
$object->formAddPredefinedProduct(0,$mysoc,$soc,$hookmanager);
|
|
||||||
}
|
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formAddObject',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formAddObject',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ class Propal extends CommonObject
|
|||||||
*
|
*
|
||||||
* @see add_product
|
* @see add_product
|
||||||
*/
|
*/
|
||||||
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht = 0)
|
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht = 0, $label='')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@@ -380,6 +380,7 @@ class Propal extends CommonObject
|
|||||||
$this->line=new PropaleLigne($this->db);
|
$this->line=new PropaleLigne($this->db);
|
||||||
|
|
||||||
$this->line->fk_propal=$propalid;
|
$this->line->fk_propal=$propalid;
|
||||||
|
$this->line->label=$label;
|
||||||
$this->line->desc=$desc;
|
$this->line->desc=$desc;
|
||||||
$this->line->qty=$qty;
|
$this->line->qty=$qty;
|
||||||
$this->line->tva_tx=$txtva;
|
$this->line->tva_tx=$txtva;
|
||||||
@@ -462,7 +463,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $pa_ht Buying price without tax
|
* @param int $pa_ht Buying price without tax
|
||||||
* @return int 0 if OK, <0 if KO
|
* @return int 0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0)
|
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='')
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@@ -519,6 +520,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->line->rowid = $rowid;
|
$this->line->rowid = $rowid;
|
||||||
|
$this->line->label = $label;
|
||||||
$this->line->desc = $desc;
|
$this->line->desc = $desc;
|
||||||
$this->line->qty = $qty;
|
$this->line->qty = $qty;
|
||||||
$this->line->tva_tx = $txtva;
|
$this->line->tva_tx = $txtva;
|
||||||
@@ -739,6 +741,7 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
$result = $this->addline(
|
$result = $this->addline(
|
||||||
$this->id,
|
$this->id,
|
||||||
|
$this->lines[$i]->label,
|
||||||
$this->lines[$i]->desc,
|
$this->lines[$i]->desc,
|
||||||
$this->lines[$i]->subprice,
|
$this->lines[$i]->subprice,
|
||||||
$this->lines[$i]->qty,
|
$this->lines[$i]->qty,
|
||||||
@@ -1073,7 +1076,7 @@ class Propal extends CommonObject
|
|||||||
/*
|
/*
|
||||||
* Lignes propales liees a un produit ou non
|
* Lignes propales liees a un produit ou non
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,";
|
$sql = "SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,";
|
||||||
$sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,";
|
$sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,";
|
||||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label';
|
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label';
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d";
|
||||||
@@ -1097,6 +1100,7 @@ class Propal extends CommonObject
|
|||||||
$line->fk_propal = $objp->fk_propal;
|
$line->fk_propal = $objp->fk_propal;
|
||||||
$line->fk_parent_line = $objp->fk_parent_line;
|
$line->fk_parent_line = $objp->fk_parent_line;
|
||||||
$line->product_type = $objp->product_type;
|
$line->product_type = $objp->product_type;
|
||||||
|
$line->label = $objp->custom_label;
|
||||||
$line->desc = $objp->description; // Description ligne
|
$line->desc = $objp->description; // Description ligne
|
||||||
$line->qty = $objp->qty;
|
$line->qty = $objp->qty;
|
||||||
$line->tva_tx = $objp->tva_tx;
|
$line->tva_tx = $objp->tva_tx;
|
||||||
@@ -2378,7 +2382,7 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function getLinesArray()
|
function getLinesArray()
|
||||||
{
|
{
|
||||||
$sql = 'SELECT pt.rowid, pt.description, pt.fk_product, pt.fk_remise_except,';
|
$sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,';
|
||||||
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
|
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
|
||||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
|
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
|
||||||
$sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,';
|
$sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,';
|
||||||
@@ -2402,6 +2406,7 @@ class Propal extends CommonObject
|
|||||||
$this->lines[$i] = (object) array();
|
$this->lines[$i] = (object) array();
|
||||||
$this->lines[$i]->id = $obj->rowid; // for backward compatibility
|
$this->lines[$i]->id = $obj->rowid; // for backward compatibility
|
||||||
$this->lines[$i]->rowid = $obj->rowid;
|
$this->lines[$i]->rowid = $obj->rowid;
|
||||||
|
$this->lines[$i]->label = $obj->custom_label;
|
||||||
$this->lines[$i]->description = $obj->description;
|
$this->lines[$i]->description = $obj->description;
|
||||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||||
$this->lines[$i]->ref = $obj->ref;
|
$this->lines[$i]->ref = $obj->ref;
|
||||||
@@ -2525,11 +2530,11 @@ class PropaleLigne
|
|||||||
*/
|
*/
|
||||||
function fetch($rowid)
|
function fetch($rowid)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.description, pd.price, pd.qty, pd.tva_tx,';
|
$sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.tva_tx,';
|
||||||
$sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,';
|
$sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,';
|
||||||
$sql.= ' pd.info_bits, pd.total_ht, pd.total_tva, pd.total_ttc, pd.fk_product_fournisseur_price as fk_fournprice, pd.buy_price_ht as pa_ht, pd.special_code, pd.rang,';
|
$sql.= ' pd.info_bits, pd.total_ht, pd.total_tva, pd.total_ttc, pd.fk_product_fournisseur_price as fk_fournprice, pd.buy_price_ht as pa_ht, pd.special_code, pd.rang,';
|
||||||
$sql.= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,';
|
$sql.= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,';
|
||||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
|
$sql.= ' p.ref as product_ref, p.label as product_label, p.description as product_desc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid';
|
||||||
$sql.= ' WHERE pd.rowid = '.$rowid;
|
$sql.= ' WHERE pd.rowid = '.$rowid;
|
||||||
@@ -2542,6 +2547,7 @@ class PropaleLigne
|
|||||||
$this->rowid = $objp->rowid;
|
$this->rowid = $objp->rowid;
|
||||||
$this->fk_propal = $objp->fk_propal;
|
$this->fk_propal = $objp->fk_propal;
|
||||||
$this->fk_parent_line = $objp->fk_parent_line;
|
$this->fk_parent_line = $objp->fk_parent_line;
|
||||||
|
$this->label = $objp->custom_label;
|
||||||
$this->desc = $objp->description;
|
$this->desc = $objp->description;
|
||||||
$this->qty = $objp->qty;
|
$this->qty = $objp->qty;
|
||||||
$this->price = $objp->price; // deprecated
|
$this->price = $objp->price; // deprecated
|
||||||
@@ -2569,8 +2575,8 @@ class PropaleLigne
|
|||||||
|
|
||||||
$this->ref = $objp->product_ref; // deprecated
|
$this->ref = $objp->product_ref; // deprecated
|
||||||
$this->product_ref = $objp->product_ref;
|
$this->product_ref = $objp->product_ref;
|
||||||
$this->libelle = $objp->product_libelle; // deprecated
|
$this->libelle = $objp->product_label; // deprecated
|
||||||
$this->product_label = $objp->product_libelle;
|
$this->product_label = $objp->product_label;
|
||||||
$this->product_desc = $objp->product_desc;
|
$this->product_desc = $objp->product_desc;
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
@@ -2610,7 +2616,7 @@ class PropaleLigne
|
|||||||
|
|
||||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||||
|
|
||||||
// si prix d'achat non renseign<EFBFBD> et utilis<EFBFBD> pour calcul des marges alors prix achat = prix vente (idem pour remises)
|
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente (idem pour remises)
|
||||||
if ($this->pa_ht == 0) {
|
if ($this->pa_ht == 0) {
|
||||||
if ($this->subprice < 0 || (isset($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice) && $conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
|
if ($this->subprice < 0 || (isset($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice) && $conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
|
||||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||||
@@ -2623,12 +2629,13 @@ class PropaleLigne
|
|||||||
|
|
||||||
// Insert line into database
|
// Insert line into database
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
|
||||||
$sql.= ' (fk_propal, fk_parent_line, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
|
$sql.= ' (fk_propal, fk_parent_line, label, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
|
||||||
$sql.= ' subprice, remise_percent, ';
|
$sql.= ' subprice, remise_percent, ';
|
||||||
$sql.= ' info_bits, ';
|
$sql.= ' info_bits, ';
|
||||||
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang)';
|
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang)';
|
||||||
$sql.= " VALUES (".$this->fk_propal.",";
|
$sql.= " VALUES (".$this->fk_propal.",";
|
||||||
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
||||||
|
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||||
$sql.= " '".$this->db->escape($this->desc)."',";
|
$sql.= " '".$this->db->escape($this->desc)."',";
|
||||||
$sql.= " ".($this->fk_product?"'".$this->fk_product."'":"null").",";
|
$sql.= " ".($this->fk_product?"'".$this->fk_product."'":"null").",";
|
||||||
$sql.= " '".$this->product_type."',";
|
$sql.= " '".$this->product_type."',";
|
||||||
@@ -2746,7 +2753,7 @@ class PropaleLigne
|
|||||||
|
|
||||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||||
|
|
||||||
// si prix d'achat non renseign<EFBFBD> et utilis<EFBFBD> pour calcul des marges alors prix achat = prix vente (idem pour remises)
|
// si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente (idem pour remises)
|
||||||
if ($this->pa_ht == 0) {
|
if ($this->pa_ht == 0) {
|
||||||
if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
|
if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
|
||||||
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
|
||||||
@@ -2757,6 +2764,9 @@ class PropaleLigne
|
|||||||
// Mise a jour ligne en base
|
// Mise a jour ligne en base
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propaldet SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."propaldet SET";
|
||||||
$sql.= " description='".$this->db->escape($this->desc)."'";
|
$sql.= " description='".$this->db->escape($this->desc)."'";
|
||||||
|
if (! empty($this->label)) {
|
||||||
|
$sql.= " , label='".$this->db->escape($this->label)."'";
|
||||||
|
}
|
||||||
$sql.= " , tva_tx='".price2num($this->tva_tx)."'";
|
$sql.= " , tva_tx='".price2num($this->tva_tx)."'";
|
||||||
$sql.= " , localtax1_tx=".price2num($this->localtax1_tx);
|
$sql.= " , localtax1_tx=".price2num($this->localtax1_tx);
|
||||||
$sql.= " , localtax2_tx=".price2num($this->localtax2_tx);
|
$sql.= " , localtax2_tx=".price2num($this->localtax2_tx);
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
|||||||
{
|
{
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
$error = false;
|
$error = false;
|
||||||
|
var_dump($_POST); exit;
|
||||||
if ((GETPOST('np_price') < 0) && (GETPOST('qty') < 0))
|
if ((GETPOST('np_price') < 0) && (GETPOST('qty') < 0))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
@@ -2098,13 +2098,6 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
|||||||
|
|
||||||
$object->formAddFreeProduct(1,$mysoc,$soc,$hookmanager);
|
$object->formAddFreeProduct(1,$mysoc,$soc,$hookmanager);
|
||||||
|
|
||||||
// Add predefined products/services
|
|
||||||
if ($conf->product->enabled || $conf->service->enabled)
|
|
||||||
{
|
|
||||||
$var=!$var;
|
|
||||||
$object->formAddPredefinedProduct(1,$mysoc,$soc,$hookmanager);
|
|
||||||
}
|
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('formAddObject',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formAddObject',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
}
|
}
|
||||||
@@ -2347,6 +2340,6 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
?>
|
||||||
66
htdocs/core/ajax/price.php
Normal file
66
htdocs/core/ajax/price.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/ajax/price.php
|
||||||
|
* \brief File to get ht and ttc
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
|
||||||
|
require('../../main.inc.php');
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$pu_ht = price2num(GETPOST('pu_ht','alpha'));
|
||||||
|
$pu_ttc = price2num(GETPOST('pu_ttc','alpha'));
|
||||||
|
$tva_tx = str_replace('*','',GETPOST('tva_tx','alpha'));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
top_httphead();
|
||||||
|
|
||||||
|
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||||
|
|
||||||
|
// Load original field value
|
||||||
|
if (! empty($action) && (isset($pu_ht) || isset($pu_ttc)) && isset($tva_tx))
|
||||||
|
{
|
||||||
|
$return=array();
|
||||||
|
|
||||||
|
if ($action == 'get_ttc') {
|
||||||
|
|
||||||
|
$price = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ($action == 'get_ht') {
|
||||||
|
|
||||||
|
$price = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$return['price'] = price($price);
|
||||||
|
|
||||||
|
echo json_encode($return);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -2484,7 +2484,7 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
function formAddFreeProduct($dateSelector,$seller,$buyer,$hookmanager=false)
|
function formAddFreeProduct($dateSelector,$seller,$buyer,$hookmanager=false)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$object;
|
global $conf,$user,$langs,$object;
|
||||||
global $form,$bcnd,$var;
|
global $form,$bcnd,$var;
|
||||||
|
|
||||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||||
@@ -2492,7 +2492,12 @@ abstract class CommonObject
|
|||||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||||
foreach($dirtpls as $reldir)
|
foreach($dirtpls as $reldir)
|
||||||
{
|
{
|
||||||
|
// for view errors
|
||||||
|
if ($conf->file->strict_mode) {
|
||||||
|
$res=include(dol_buildpath($reldir.'/freeproductline_create.tpl.php'));
|
||||||
|
} else {
|
||||||
$res=@include(dol_buildpath($reldir.'/freeproductline_create.tpl.php'));
|
$res=@include(dol_buildpath($reldir.'/freeproductline_create.tpl.php'));
|
||||||
|
}
|
||||||
if ($res) break;
|
if ($res) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2528,6 +2533,7 @@ abstract class CommonObject
|
|||||||
print '<td>'.$langs->trans('Description').'</td>';
|
print '<td>'.$langs->trans('Description').'</td>';
|
||||||
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
||||||
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
|
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
|
||||||
|
print '<td align="right" width="80"> </td>';
|
||||||
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
|
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
|
||||||
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
|
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
@@ -2637,9 +2643,8 @@ abstract class CommonObject
|
|||||||
$product_static->type=$line->fk_product_type;
|
$product_static->type=$line->fk_product_type;
|
||||||
$product_static->id=$line->fk_product;
|
$product_static->id=$line->fk_product;
|
||||||
$product_static->ref=$line->ref;
|
$product_static->ref=$line->ref;
|
||||||
$product_static->libelle=$label;
|
|
||||||
$text=$product_static->getNomUrl(1);
|
$text=$product_static->getNomUrl(1);
|
||||||
$text.= ' - '.$label;
|
$text.= ' - '.(! empty($line->label)?$line->label:$label);
|
||||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
|
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
|
||||||
|
|
||||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ class Form
|
|||||||
* @param int $direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres
|
* @param int $direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres
|
||||||
* @param string $img Code img du picto (use img_xxx() function to get it)
|
* @param string $img Code img du picto (use img_xxx() function to get it)
|
||||||
* @param string $extracss Add a CSS style to td tags
|
* @param string $extracss Add a CSS style to td tags
|
||||||
* @param int $notabs Do not include table and tr tags
|
* @param int $notabs 1=Do not include table and tr tags, 2=use div, 3=use span
|
||||||
* @param string $incbefore Include code before the text
|
* @param string $incbefore Include code before the text
|
||||||
* @param int $noencodehtmltext Do not encode into html entity the htmltext
|
* @param int $noencodehtmltext Do not encode into html entity the htmltext
|
||||||
* @return string Code html du tooltip (texte+picto)
|
* @return string Code html du tooltip (texte+picto)
|
||||||
@@ -353,6 +353,10 @@ class Form
|
|||||||
if ($incbefore) $text = $incbefore.$text;
|
if ($incbefore) $text = $incbefore.$text;
|
||||||
if (! $htmltext) return $text;
|
if (! $htmltext) return $text;
|
||||||
|
|
||||||
|
$tag='td';
|
||||||
|
if ($notabs == 2) $tag='div';
|
||||||
|
if ($notabs == 3) $tag='span';
|
||||||
|
|
||||||
// Sanitize tooltip
|
// Sanitize tooltip
|
||||||
$htmltext=str_replace("\\","\\\\",$htmltext);
|
$htmltext=str_replace("\\","\\\\",$htmltext);
|
||||||
$htmltext=str_replace("\r","",$htmltext);
|
$htmltext=str_replace("\r","",$htmltext);
|
||||||
@@ -365,7 +369,7 @@ class Form
|
|||||||
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
|
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
|
||||||
|
|
||||||
$s="";
|
$s="";
|
||||||
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>';
|
if ($notabs < 2) $s.='<table class="nobordernopadding" summary=""><tr>';
|
||||||
if ($direction > 0)
|
if ($direction > 0)
|
||||||
{
|
{
|
||||||
if ($text != '')
|
if ($text != '')
|
||||||
@@ -381,12 +385,12 @@ class Form
|
|||||||
if ($direction) $s.='<td'.$paramfortooltipimg.' valign="top" width="14">'.$img.'</td>';
|
if ($direction) $s.='<td'.$paramfortooltipimg.' valign="top" width="14">'.$img.'</td>';
|
||||||
if ($text != '')
|
if ($text != '')
|
||||||
{
|
{
|
||||||
$s.='<td'.$paramfortooltiptd.'>';
|
$s.='<'.$tag.$paramfortooltiptd.'>';
|
||||||
if ($direction) $s.=' ';
|
if ($direction) $s.=' ';
|
||||||
$s.=$text.'</td>';
|
$s.=$text.'</'.$tag.'>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($notabs)) $s.='</tr></table>';
|
if ($notabs < 2) $s.='</tr></table>';
|
||||||
|
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
@@ -543,7 +547,7 @@ class Form
|
|||||||
|| (empty($conf->product->enabled) && empty($conf->service->enabled)))
|
|| (empty($conf->product->enabled) && empty($conf->service->enabled)))
|
||||||
{
|
{
|
||||||
if (empty($hidetext)) print $langs->trans("Type").': ';
|
if (empty($hidetext)) print $langs->trans("Type").': ';
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
if ($showempty)
|
if ($showempty)
|
||||||
{
|
{
|
||||||
print '<option value="-1"';
|
print '<option value="-1"';
|
||||||
@@ -1079,7 +1083,7 @@ class Form
|
|||||||
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
|
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
|
||||||
* @param int $finished 2=all, 1=finished, 0=raw material
|
* @param int $finished 2=all, 1=finished, 0=raw material
|
||||||
* @param string $selected_input_value Value of preselected input text (with ajax)
|
* @param string $selected_input_value Value of preselected input text (with ajax)
|
||||||
* @param int $hidelabel Hide label
|
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
|
||||||
* @param array $ajaxoptions Options for ajax_autocompleter
|
* @param array $ajaxoptions Options for ajax_autocompleter
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -1091,6 +1095,8 @@ class Form
|
|||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
|
||||||
{
|
{
|
||||||
|
$placeholder='';
|
||||||
|
|
||||||
if ($selected && empty($selected_input_value))
|
if ($selected && empty($selected_input_value))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||||
@@ -1101,15 +1107,23 @@ class Form
|
|||||||
// mode=1 means customers products
|
// mode=1 means customers products
|
||||||
$urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished;
|
$urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished;
|
||||||
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||||
if (! $hidelabel) print $langs->trans("RefOrLabel").' : ';
|
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
|
||||||
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'" />';
|
else if ($hidelabel > 1) {
|
||||||
|
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
|
||||||
|
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
|
||||||
|
if ($hidelabel == 2) {
|
||||||
|
print img_picto($langs->trans("Search"), 'search');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';
|
||||||
|
if ($hidelabel == 3) {
|
||||||
|
print img_picto($langs->trans("Search"), 'search');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->select_produits_do($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0);
|
$this->select_produits_do($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1131,7 +1145,7 @@ class Form
|
|||||||
global $langs,$conf,$user,$db;
|
global $langs,$conf,$user,$db;
|
||||||
|
|
||||||
$sql = "SELECT ";
|
$sql = "SELECT ";
|
||||||
$sql.= " p.rowid, p.label, p.ref, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.duration, p.stock";
|
$sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.duration, p.stock";
|
||||||
// Multilang : we add translation
|
// Multilang : we add translation
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||||
{
|
{
|
||||||
@@ -1196,6 +1210,9 @@ class Form
|
|||||||
$outkey='';
|
$outkey='';
|
||||||
$outval='';
|
$outval='';
|
||||||
$outref='';
|
$outref='';
|
||||||
|
$outlabel='';
|
||||||
|
$outdesc='';
|
||||||
|
$outtype='';
|
||||||
$outprice_ht='';
|
$outprice_ht='';
|
||||||
$outprice_ttc='';
|
$outprice_ttc='';
|
||||||
$outpricebasetype='';
|
$outpricebasetype='';
|
||||||
@@ -1208,6 +1225,9 @@ class Form
|
|||||||
|
|
||||||
$outkey=$objp->rowid;
|
$outkey=$objp->rowid;
|
||||||
$outref=$objp->ref;
|
$outref=$objp->ref;
|
||||||
|
$outlabel=$objp->label;
|
||||||
|
$outdesc=$objp->description;
|
||||||
|
$outtype=$objp->fk_product_type;
|
||||||
|
|
||||||
$opt = '<option value="'.$objp->rowid.'"';
|
$opt = '<option value="'.$objp->rowid.'"';
|
||||||
$opt.= ($objp->rowid == $selected)?' selected="selected"':'';
|
$opt.= ($objp->rowid == $selected)?' selected="selected"':'';
|
||||||
@@ -1320,7 +1340,7 @@ class Form
|
|||||||
// "key" value of json key array is used by jQuery automatically as selected value
|
// "key" value of json key array is used by jQuery automatically as selected value
|
||||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||||
$outselect.=$opt;
|
$outselect.=$opt;
|
||||||
array_push($outjson, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype));
|
array_push($outjson, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype));
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -731,3 +731,26 @@ function hideMessage(fieldId,message) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Timer for delayed keyup function
|
||||||
|
*/
|
||||||
|
(function($){
|
||||||
|
$.widget("ui.onDelayedKeyup", {
|
||||||
|
_init : function() {
|
||||||
|
var self = this;
|
||||||
|
$(this.element).keyup(function() {
|
||||||
|
if(typeof(window['inputTimeout']) != "undefined"){
|
||||||
|
window.clearTimeout(inputTimeout);
|
||||||
|
}
|
||||||
|
var handler = self.options.handler;
|
||||||
|
window['inputTimeout'] = window.setTimeout(function() { handler.call(self.element) }, self.options.delay);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
handler: $.noop(),
|
||||||
|
delay: 500
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
|||||||
@@ -46,21 +46,42 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
|||||||
$script.= '$(document).ready(function() {
|
$script.= '$(document).ready(function() {
|
||||||
var autoselect = '.$autoselect.';
|
var autoselect = '.$autoselect.';
|
||||||
var options = '.json_encode($ajaxoptions).';
|
var options = '.json_encode($ajaxoptions).';
|
||||||
$("input#search_'.$htmlname.'").blur(function() {
|
|
||||||
//console.log(this.value.length);
|
// Remove product id before select another product
|
||||||
if (this.value.length == 0)
|
$("input#search_'.$htmlname.'").change(function() {
|
||||||
|
$("#'.$htmlname.'").val("").trigger("change");
|
||||||
|
});
|
||||||
|
// Check when keyup
|
||||||
|
$("input#search_'.$htmlname.'").onDelayedKeyup({ handler: function() {
|
||||||
|
if ($(this).val().length == 0)
|
||||||
{
|
{
|
||||||
$("#search_'.$htmlname.'").val("");
|
$("#search_'.$htmlname.'").val("");
|
||||||
$("#'.$htmlname.'").val("").trigger("change");
|
$("#'.$htmlname.'").val("").trigger("change");
|
||||||
|
if (options.option_disabled) {
|
||||||
|
$("#" + options.option_disabled).removeAttr("disabled");
|
||||||
|
}
|
||||||
if (options.disabled) {
|
if (options.disabled) {
|
||||||
$("#" + options.disabled).removeAttr("disabled");
|
$.each(options.disabled, function(key, value) {
|
||||||
|
$("#" + value).removeAttr("disabled");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (options.update) {
|
||||||
|
$.each(options.update, function(key, value) {
|
||||||
|
$("#" + key).val("").trigger("change");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (options.show) {
|
||||||
|
$.each(options.show, function(key, value) {
|
||||||
|
$("#" + value).hide().trigger("hide");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("input#search_'.$htmlname.'").autocomplete({
|
$("input#search_'.$htmlname.'").autocomplete({
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
$.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){
|
$.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){
|
||||||
response( jQuery.map( data, function( item ) {
|
response($.map( data, function( item ) {
|
||||||
if (autoselect == 1 && data.length == 1) {
|
if (autoselect == 1 && data.length == 1) {
|
||||||
$("#search_'.$htmlname.'").val(item.value);
|
$("#search_'.$htmlname.'").val(item.value);
|
||||||
$("#'.$htmlname.'").val(item.key).trigger("change");
|
$("#'.$htmlname.'").val(item.key).trigger("change");
|
||||||
@@ -72,7 +93,13 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
|||||||
update[key] = item[value];
|
update[key] = item[value];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return { label: label, value: item.value, id: item.key, update: update, disabled: item.disabled }
|
var textarea = {};
|
||||||
|
if (options.update_textarea) {
|
||||||
|
$.each(options.update_textarea, function(key, value) {
|
||||||
|
textarea[key] = item[value];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
|
||||||
}));
|
}));
|
||||||
}, "json");
|
}, "json");
|
||||||
},
|
},
|
||||||
@@ -81,20 +108,41 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
|||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
$("#'.$htmlname.'").val(ui.item.id).trigger("change");
|
$("#'.$htmlname.'").val(ui.item.id).trigger("change");
|
||||||
// Disable an element
|
// Disable an element
|
||||||
if (options.disabled) {
|
if (options.option_disabled) {
|
||||||
if (ui.item.disabled) {
|
if (ui.item.disabled) {
|
||||||
$("#" + options.disabled).attr("disabled", "disabled");
|
$("#" + options.option_disabled).attr("disabled", "disabled");
|
||||||
if (options.error) {
|
if (options.error) {
|
||||||
$.jnotify(options.error, "error", true);
|
$.jnotify(options.error, "error", true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$("#" + options.disabled).removeAttr("disabled");
|
$("#" + options.option_disabled).removeAttr("disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update an element
|
if (options.disabled) {
|
||||||
|
$.each(options.disabled, function(key, value) {
|
||||||
|
$("#" + value).attr("disabled", "disabled");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (options.show) {
|
||||||
|
$.each(options.show, function(key, value) {
|
||||||
|
$("#" + value).show().trigger("show");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Update an input
|
||||||
if (ui.item.update) {
|
if (ui.item.update) {
|
||||||
$.each(ui.item.update, function(key, value) {
|
$.each(ui.item.update, function(key, value) {
|
||||||
$("#" + key).val(value);
|
$("#" + key).val(value).trigger("change");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (ui.item.textarea) {
|
||||||
|
$.each(ui.item.textarea, function(key, value) {
|
||||||
|
if (CKEDITOR) {
|
||||||
|
CKEDITOR.instances[key].setData(value);
|
||||||
|
CKEDITOR.instances[key].focus();
|
||||||
|
} else {
|
||||||
|
$("#" + key).html(value);
|
||||||
|
$("#" + key).focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
*
|
*
|
||||||
@@ -28,21 +28,30 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||||
<tr class="liste_titre nodrag nodrop">
|
<tr class="liste_titre nodrag nodrop">
|
||||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><div id="add"></div><?php echo $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone"); ?></td>
|
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><div id="add"></div><?php echo $langs->trans('AddNewLine'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
|
<td align="right"><?php echo $langs->trans('VAT'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('PriceUHT'); ?></td>
|
<td align="right"><?php echo $langs->trans('PriceUHT'); ?></td>
|
||||||
|
<td align="right"><?php echo $langs->trans('PriceUTTC'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
|
||||||
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
|
$colspan2 = 12;
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
?>
|
?>
|
||||||
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||||
$colspan++;
|
$colspan++;
|
||||||
if($conf->global->DISPLAY_MARK_RATES)
|
$colspan2++;
|
||||||
|
}
|
||||||
|
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||||
$colspan++;
|
$colspan++;
|
||||||
|
$colspan2++;
|
||||||
|
}
|
||||||
|
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||||
|
$colspan2++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td colspan="<?php echo $colspan; ?>"> </td>
|
<td colspan="<?php echo $colspan; ?>"> </td>
|
||||||
@@ -53,41 +62,108 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
<input type="hidden" name="action" value="addline" />
|
<input type="hidden" name="action" value="addline" />
|
||||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>" />
|
<input type="hidden" name="id" value="<?php echo $this->id; ?>" />
|
||||||
|
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
<?php if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { ?>
|
||||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
<tr class="liste_titre nodrag nodrop">
|
||||||
|
<td colspan="<?php echo $colspan2; ?>">
|
||||||
<?php
|
<?php
|
||||||
echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
|
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||||
if (($conf->product->enabled && $conf->service->enabled) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '<br>';
|
{
|
||||||
|
// show/hide, update elements after select
|
||||||
|
$ajaxoptions=array(
|
||||||
|
'update' => array(
|
||||||
|
'select_type' => 'type',
|
||||||
|
'product_ref' => 'value',
|
||||||
|
'product_label' => 'label2',
|
||||||
|
'origin_desc_cache' => 'desc',
|
||||||
|
'price_ht' => 'price_ht',
|
||||||
|
'price_ttc' => 'price_ttc'
|
||||||
|
),
|
||||||
|
'show' => array(
|
||||||
|
'update_label_area',
|
||||||
|
'update_desc_area',
|
||||||
|
'update_price_area'
|
||||||
|
),
|
||||||
|
'disabled' => array(
|
||||||
|
'select_type'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$form->select_produits('', 'idprod', '', $conf->product->limit_size, $buyer->price_level, 1, 2, '', 3, $ajaxoptions);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<span id="add_product_area" class="hideobject"> | <input type="checkbox" id="add_product_checkbox" name="add_product" value="1" />
|
||||||
|
<span id="add_product_text" class="hideobject">
|
||||||
|
<?php echo $form->textwithtooltip($langs->trans('AddThisProductCard'), $langs->trans('HelpAddThisProductCard'),1,0,'','',3); ?>
|
||||||
|
</span>
|
||||||
|
<span id="add_service_text" class="hideobject">
|
||||||
|
<?php echo $form->textwithtooltip($langs->trans('AddThisServiceCard'), $langs->trans('HelpAddThisServiceCard'),1,0,'','',3); ?>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span id="update_label_area" class="hideobject"> | <input type="checkbox" id="update_label_checkbox" name="update_label" value="1" />
|
||||||
|
<?php echo $form->textwithtooltip($langs->trans('UpdateOriginalProductLabel'), $langs->trans('HelpUpdateOriginalProductLabel'),1,0,'','',3); ?>
|
||||||
|
</span>
|
||||||
|
<span id="update_desc_area" class="hideobject"> | <input type="checkbox" id="update_desc_checkbox" name="update_desc" value="1" />
|
||||||
|
<?php echo $form->textwithtooltip($langs->trans('UpdateOriginalProductDescription'), $langs->trans('HelpUpdateOriginalProductDescription'),1,0,'','',3); ?>
|
||||||
|
</span>
|
||||||
|
<span id="update_price_area" class="hideobject"> | <input type="checkbox" id="update_price_checkbox" name="update_price" value="1" />
|
||||||
|
<?php echo $form->textwithtooltip($langs->trans('UpdateOriginalProductPrice'), $langs->trans('HelpUpdateOriginalProductPrice'),1,0,'','',3); ?>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
|
<td colspan="<?php echo $colspan2; ?>">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo $form->select_type_of_lines((GETPOST('type')?GETPOST('type'):-1), 'type', 1);
|
||||||
|
|
||||||
|
echo '<span id="product_ref_area" class="hideobject"> <label for="product_ref">'.$langs->trans("Ref").'</label>';
|
||||||
|
echo '<input id="product_ref" name="product_ref" size="20" value="'.GETPOST('product_ref').'"></span>';
|
||||||
|
|
||||||
|
echo ' <label for="product_label">'.$langs->trans("Label").'</label>';
|
||||||
|
echo '<input id="product_label" name="product_label" size="40" value="'.GETPOST('product_label').'">';
|
||||||
|
|
||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array();
|
$parameters=array('fk_parent_line'=>GETPOST('fk_parent_line'));
|
||||||
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<tr <?php echo $bcnd[$var]; ?>>
|
||||||
|
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
||||||
|
|
||||||
|
<?php
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$nbrows=ROWS_2;
|
$nbrows=ROWS_2;
|
||||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||||
$doleditor=new DolEditor('np_desc',$_POST["np_desc"],'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
$doleditor=new DolEditor('product_desc', GETPOST('product_desc'), '', 150, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
?>
|
?>
|
||||||
|
<input type="hidden" id="origin_desc_cache" name="origin_desc_cache" value="" />
|
||||||
|
<input type="hidden" id="free_desc_cache" name="free_desc_cache" value="" />
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<?php
|
<?php
|
||||||
if ($buyer->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
if ($buyer->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
|
||||||
else echo $form->load_tva('np_tva_tx', (isset($_POST["np_tva_tx"])?$_POST["np_tva_tx"]:-1), $seller, $buyer);
|
else echo $form->load_tva('tva_tx', (GETPOST('tva_tx')?GETPOST('tva_tx'):-1), $seller, $buyer);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td align="right"><input type="text" size="5" name="np_price" value="<?php echo (isset($_POST["np_price"])?$_POST["np_price"]:''); ?>"></td>
|
<td align="right"><input type="text" size="6" id="price_ht" name="price_ht" value="<?php echo (GETPOST('price_ht')?GETPOST('price_ht'):''); ?>"></td>
|
||||||
<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
|
<td align="right"><input type="text" size="6" id="price_ttc" name="price_ttc" value="<?php echo (GETPOST('price_ttc')?GETPOST('price_ttc'):''); ?>"></td>
|
||||||
<td align="right" nowrap><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
<td align="right"><input type="text" size="2" id="qty" name="qty" value="<?php echo (GETPOST('qty')?GETPOST('qty'):1); ?>"></td>
|
||||||
|
<td align="right" nowrap="nowrap"><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent">%</td>
|
||||||
<?php
|
<?php
|
||||||
$colspan = 4;
|
$colspan = 4;
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
?>
|
?>
|
||||||
<td align="right"><input type="text" size="5" name="np_buying_price" value="<?php echo (isset($_POST["np_buying_price"])?$_POST["np_buying_price"]:''); ?>"></td>
|
<td align="right">
|
||||||
|
<select id="fournprice" name="fournprice" style="display: none;"></select>
|
||||||
|
<input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (GETPOST('buying_price')?GETPOST('buying_price'):''); ?>">
|
||||||
|
</td>
|
||||||
<?php
|
<?php
|
||||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
if($conf->global->DISPLAY_MARGIN_RATES)
|
||||||
$colspan++;
|
$colspan++;
|
||||||
@@ -95,23 +171,23 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
$colspan++;
|
$colspan++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
|
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" id="addlinebutton" name="addline" value="<?php echo $langs->trans('Add'); ?>"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<?php if ($conf->service->enabled && $dateSelector) {
|
<?php if (! empty($conf->service->enabled) && ! empty($dateSelector)) {
|
||||||
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||||
$colspan = 10;
|
$colspan = 12;
|
||||||
else
|
else
|
||||||
$colspan = 9;
|
$colspan = 11;
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
if($conf->global->DISPLAY_MARGIN_RATES)
|
if ($conf->global->DISPLAY_MARGIN_RATES)
|
||||||
$colspan++;
|
$colspan++;
|
||||||
if($conf->global->DISPLAY_MARK_RATES)
|
if($conf->global->DISPLAY_MARK_RATES)
|
||||||
$colspan++;
|
$colspan++;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr <?php echo $bcnd[$var]; ?>>
|
<tr id="service_duration_area" <?php echo $bcnd[$var]; ?>>
|
||||||
<td colspan="<?php echo $colspan; ?>">
|
<td colspan="<?php echo $colspan; ?>">
|
||||||
<?php
|
<?php
|
||||||
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
|
||||||
@@ -124,4 +200,227 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#service_duration_area').hide();
|
||||||
|
|
||||||
|
$('#idprod').change(function() {
|
||||||
|
if ($(this).val().length > 0)
|
||||||
|
{
|
||||||
|
if (CKEDITOR) {
|
||||||
|
CKEDITOR.instances['product_desc'].focus();
|
||||||
|
} else {
|
||||||
|
$('#product_desc').focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#addlinebutton').attr('disabled','disabled');
|
||||||
|
$('#select_type').change(function() {
|
||||||
|
var type = $(this).val();
|
||||||
|
if (type >= 0) {
|
||||||
|
if (type == 0) {
|
||||||
|
$('#add_product_text').show();
|
||||||
|
$('#add_service_text').hide();
|
||||||
|
$('#service_duration_area').hide();
|
||||||
|
$('#date_start').val('').trigger('change');
|
||||||
|
$('#date_end').val('').trigger('change');
|
||||||
|
} else if (type == 1) {
|
||||||
|
$('#add_product_text').hide();
|
||||||
|
$('#add_service_text').show();
|
||||||
|
$('#service_duration_area').show();
|
||||||
|
}
|
||||||
|
//$('#add_product_area').show();
|
||||||
|
$('#addlinebutton').removeAttr('disabled');
|
||||||
|
} else {
|
||||||
|
//$('#add_product_area').hide();
|
||||||
|
$('#add_product_checkbox').removeAttr('checked');
|
||||||
|
$('#addlinebutton').attr('disabled','disabled');
|
||||||
|
$('#service_duration_area').hide();
|
||||||
|
$('#date_start').val('').trigger('change');
|
||||||
|
$('#date_end').val('').trigger('change');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#add_product_checkbox').change(function() {
|
||||||
|
if ($(this).attr('checked')) {
|
||||||
|
$('#product_ref_area').show();
|
||||||
|
$('#product_ref').focus();
|
||||||
|
$('#product_label').removeAttr('disabled');
|
||||||
|
$('#search_idprod').attr('disabled','disabled');
|
||||||
|
$('#update_label_area').hide();
|
||||||
|
$('#update_label_checkbox').removeAttr('checked');
|
||||||
|
$('#update_price_area').hide().trigger('hide');
|
||||||
|
$('#update_price_checkbox').removeAttr('checked')
|
||||||
|
} else {
|
||||||
|
if ($("#idprod").val() > 0) {
|
||||||
|
$('#update_label_area').show();
|
||||||
|
$('#product_label').attr('disabled', 'disabled');
|
||||||
|
$('#update_price_area').show().trigger('show');
|
||||||
|
}
|
||||||
|
$('#product_ref_area').hide();
|
||||||
|
$('#search_idprod').removeAttr('disabled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#update_price_area').bind('hide', function() {
|
||||||
|
$('#price_ht').removeAttr('disabled');
|
||||||
|
$('#price_ttc').removeAttr('disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#update_price_area').bind('show', function() {
|
||||||
|
$('#price_ht').attr('disabled', 'disabled');
|
||||||
|
$('#price_ttc').attr('disabled', 'disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#update_price_checkbox').change(function() {
|
||||||
|
if ($(this).attr('checked')) {
|
||||||
|
$('#price_ht').removeAttr('disabled').focus();
|
||||||
|
$('#price_ttc').removeAttr('disabled')
|
||||||
|
} else {
|
||||||
|
$('#price_ht').attr('disabled','disabled');
|
||||||
|
$('#price_ttc').attr('disabled','disabled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#update_label_area').bind('hide', function() {
|
||||||
|
$('#update_label_checkbox').removeAttr('checked');
|
||||||
|
$('#product_label').removeAttr('disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#update_label_area').bind('show', function() {
|
||||||
|
$('#product_label').attr('disabled', 'disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#update_label_checkbox').change(function() {
|
||||||
|
if ($(this).attr('checked')) {
|
||||||
|
$('#product_label').removeAttr('disabled').focus();
|
||||||
|
} else {
|
||||||
|
$('#product_label').attr('disabled','disabled');
|
||||||
|
$('#search_idprod').focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#update_desc_checkbox').change(function() {
|
||||||
|
|
||||||
|
if ($(this).attr('checked')) {
|
||||||
|
|
||||||
|
var origin_desc = $('#origin_desc_cache').val();
|
||||||
|
|
||||||
|
if (CKEDITOR) {
|
||||||
|
var freecontent = CKEDITOR.instances['product_desc'].getData();
|
||||||
|
if (origin_desc.length > 0)
|
||||||
|
var content = origin_desc + '<br />' + freecontent;
|
||||||
|
else
|
||||||
|
var content = freecontent;
|
||||||
|
} else {
|
||||||
|
var freecontent = $('#product_desc').html();
|
||||||
|
if (origin_desc.length > 0)
|
||||||
|
var content = origin_desc + '\r\n' + freecontent;
|
||||||
|
else
|
||||||
|
var content = freecontent;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#free_desc_cache').val(freecontent);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var content = $('#free_desc_cache').val();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CKEDITOR) {
|
||||||
|
CKEDITOR.instances['product_desc'].setData(content);
|
||||||
|
} else {
|
||||||
|
$('#product_desc').html(content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#price_ht').onDelayedKeyup({ handler: function() {
|
||||||
|
$.post('<?php echo DOL_URL_ROOT; ?>/core/ajax/price.php', {
|
||||||
|
'action': 'get_ttc',
|
||||||
|
'pu_ht': $(this).val(),
|
||||||
|
'tva_tx': $('#tva_tx').val()
|
||||||
|
},
|
||||||
|
function(data) {
|
||||||
|
if (data && data.price.length > 0) {
|
||||||
|
$('#price_ttc').val(data.price);
|
||||||
|
}
|
||||||
|
}, 'json');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#price_ttc').onDelayedKeyup({ handler: function() {
|
||||||
|
$.post('<?php echo DOL_URL_ROOT; ?>/core/ajax/price.php', {
|
||||||
|
'action': 'get_ht',
|
||||||
|
'pu_ttc': $(this).val(),
|
||||||
|
'tva_tx': $('#tva_tx').val()
|
||||||
|
},
|
||||||
|
function(data) {
|
||||||
|
if (data && data.price.length > 0) {
|
||||||
|
$('#price_ht').val(data.price);
|
||||||
|
}
|
||||||
|
}, 'json');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#tva_tx').change(function() {
|
||||||
|
$.post('<?php echo DOL_URL_ROOT; ?>/core/ajax/price.php', {
|
||||||
|
'action': 'get_ttc',
|
||||||
|
'pu_ht': $('#price_ht').val(),
|
||||||
|
'tva_tx': $(this).val()
|
||||||
|
},
|
||||||
|
function(data) {
|
||||||
|
if (data && data.price.length > 0) {
|
||||||
|
$('#price_ttc').val(data.price);
|
||||||
|
}
|
||||||
|
}, 'json');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php if (! empty($conf->margin->enabled)) { ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#idprod").change(function() {
|
||||||
|
$("#fournprice").empty();
|
||||||
|
$("#buying_price").show();
|
||||||
|
if ($(this).val().length > 0)
|
||||||
|
{
|
||||||
|
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': $(this).val()}, function(data) {
|
||||||
|
if (data && data.length > 0) {
|
||||||
|
var options = '';
|
||||||
|
var i = 0;
|
||||||
|
$(data).each(function() {
|
||||||
|
i++;
|
||||||
|
options += '<option value="'+this.id+'" title="'+this.title+'" price="'+this.price+'"';
|
||||||
|
if (i == 1) {
|
||||||
|
options += ' selected';
|
||||||
|
$("#buying_price").val(this.price);
|
||||||
|
}
|
||||||
|
options += '>'+this.label+'</option>';
|
||||||
|
});
|
||||||
|
options += '<option value=null><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||||
|
$("#fournprice").html(options);
|
||||||
|
$("#buying_price").hide();
|
||||||
|
$("#fournprice").show();
|
||||||
|
$("#fournprice").change(function() {
|
||||||
|
var selval = $(this).find('option:selected').attr("price");
|
||||||
|
if (selval)
|
||||||
|
$("#buying_price").val(selval).hide();
|
||||||
|
else
|
||||||
|
$('#buying_price').show();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$("#fournprice").hide();
|
||||||
|
$('#buying_price').val('');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'json');
|
||||||
|
} else {
|
||||||
|
$("#fournprice").hide();
|
||||||
|
$('#buying_price').val('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php } ?>
|
||||||
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
|
<!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
|
||||||
|
|||||||
@@ -63,7 +63,14 @@
|
|||||||
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
|
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
|
||||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||||
else $text = img_object($langs->trans('Product'),'product');
|
else $text = img_object($langs->trans('Product'),'product');
|
||||||
|
|
||||||
|
if (! empty($line->label)) {
|
||||||
|
$text.= ' <strong>'.$line->label.'</strong>';
|
||||||
|
echo $form->textwithtooltip($text,dol_htmlentitiesbr($line->description),3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
|
||||||
|
} else {
|
||||||
echo $text.' '.dol_htmlentitiesbr($line->description);
|
echo $text.' '.dol_htmlentitiesbr($line->description);
|
||||||
|
}
|
||||||
|
|
||||||
// Show range
|
// Show range
|
||||||
print_date_range($line->date_start,$line->date_end);
|
print_date_range($line->date_start,$line->date_end);
|
||||||
}
|
}
|
||||||
@@ -74,6 +81,8 @@
|
|||||||
|
|
||||||
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
||||||
|
|
||||||
|
<td align="right" nowrap="nowrap"> </td>
|
||||||
|
|
||||||
<td align="right" nowrap="nowrap">
|
<td align="right" nowrap="nowrap">
|
||||||
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
||||||
else echo ' '; ?>
|
else echo ' '; ?>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
// Add description in form
|
// Add description in form
|
||||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||||
{
|
{
|
||||||
print ($line->description && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
@@ -43,6 +43,8 @@
|
|||||||
|
|
||||||
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
||||||
|
|
||||||
|
<td align="right" nowrap="nowrap"> </td>
|
||||||
|
|
||||||
<td align="right" nowrap="nowrap">
|
<td align="right" nowrap="nowrap">
|
||||||
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
||||||
else echo ' '; ?>
|
else echo ' '; ?>
|
||||||
@@ -54,14 +56,13 @@
|
|||||||
<td> </td>
|
<td> </td>
|
||||||
<?php }
|
<?php }
|
||||||
|
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) { ?>
|
||||||
?>
|
|
||||||
<td align="right" nowrap="nowrap"><?php echo price($line->pa_ht); ?></td>
|
<td align="right" nowrap="nowrap"><?php echo price($line->pa_ht); ?></td>
|
||||||
<?php if($conf->global->DISPLAY_MARGIN_RATES) {?>
|
<?php if ($conf->global->DISPLAY_MARGIN_RATES) {?>
|
||||||
<td align="right" nowrap="nowrap"><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx).'%'); ?></td>
|
<td align="right" nowrap="nowrap"><?php echo (($line->pa_ht == 0)?'n/a':price($line->marge_tx).'%'); ?></td>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if($conf->global->DISPLAY_MARK_RATES) {?>
|
if ($conf->global->DISPLAY_MARK_RATES) { ?>
|
||||||
<td align="right" nowrap="nowrap"><?php echo price($line->marque_tx).'%'; ?></td>
|
<td align="right" nowrap="nowrap"><?php echo price($line->marque_tx).'%'; ?></td>
|
||||||
<?php } } ?>
|
<?php } } ?>
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
|
|||||||
if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0;
|
if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0;
|
||||||
if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
|
if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
|
||||||
if (empty($force_charset_do_notuse)) $force_charset_do_notuse='UTF-8';
|
if (empty($force_charset_do_notuse)) $force_charset_do_notuse='UTF-8';
|
||||||
|
if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode
|
||||||
if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0;
|
if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0;
|
||||||
|
|
||||||
// Security: CSRF protection
|
// Security: CSRF protection
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
||||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
@@ -72,39 +72,46 @@ if (! empty($idprod))
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
$label = $objp->nom.' - '.$objp->ref_fourn.' - ';
|
$title = $objp->nom.' - '.$objp->ref_fourn.' - ';
|
||||||
|
$label = '';
|
||||||
|
|
||||||
if ($objp->quantity == 1)
|
if ($objp->quantity == 1)
|
||||||
{
|
{
|
||||||
$label.= price($objp->fprice);
|
$label.= price($objp->fprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
|
||||||
$label.= $langs->trans("Currency".$conf->monnaie)."/";
|
|
||||||
|
$title.= price($objp->fprice);
|
||||||
|
$title.= getCurrencySymbol($conf->currency)."/";
|
||||||
|
|
||||||
$price = $objp->fprice;
|
$price = $objp->fprice;
|
||||||
}
|
}
|
||||||
|
|
||||||
$label.= $objp->quantity.' ';
|
$title.= $objp->quantity.' ';
|
||||||
|
|
||||||
if ($objp->quantity == 1)
|
if ($objp->quantity == 1)
|
||||||
{
|
{
|
||||||
$label.= strtolower($langs->trans("Unit"));
|
$title.= strtolower($langs->trans("Unit"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$label.= strtolower($langs->trans("Units"));
|
$title.= strtolower($langs->trans("Units"));
|
||||||
}
|
}
|
||||||
if ($objp->quantity > 1)
|
if ($objp->quantity > 1)
|
||||||
{
|
{
|
||||||
$label.=" - ";
|
$title.=" - ";
|
||||||
$label.= price($objp->unitprice).$langs->trans("Currency".$conf->monnaie)."/".strtolower($langs->trans("Unit"));
|
$title.= price($objp->unitprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
|
||||||
|
|
||||||
|
$label.= price($objp->unitprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
|
||||||
|
|
||||||
$price = $objp->unitprice;
|
$price = $objp->unitprice;
|
||||||
}
|
}
|
||||||
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2")) {
|
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2")) {
|
||||||
$label.=" + ";
|
$title.=" + ";
|
||||||
$label.= price($objp->unitcharges).$langs->trans("Currency".$conf->monnaie);
|
$title.= price($objp->unitcharges).getCurrencySymbol($conf->currency);
|
||||||
$price += $objp->unitcharges;
|
$price += $objp->unitcharges;
|
||||||
}
|
}
|
||||||
if ($objp->duration) $label .= " - ".$objp->duration;
|
if ($objp->duration) $label .= " - ".$objp->duration;
|
||||||
|
|
||||||
$prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label);
|
$prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,3 +69,6 @@ ALTER TABLE llx_propal CHANGE fk_demand_reason fk_input_reason INT(11) NULL DEFA
|
|||||||
ALTER TABLE llx_commande_fournisseur CHANGE fk_methode_commande fk_input_method INT(11) NULL DEFAULT 0;
|
ALTER TABLE llx_commande_fournisseur CHANGE fk_methode_commande fk_input_method INT(11) NULL DEFAULT 0;
|
||||||
|
|
||||||
INSERT INTO llx_const (name, value, type, note, visible) values ('PRODUCT_CODEPRODUCT_ADDON','mod_codeproduct_leopard','yesno','Module to control product codes',0);
|
INSERT INTO llx_const (name, value, type, note, visible) values ('PRODUCT_CODEPRODUCT_ADDON','mod_codeproduct_leopard','yesno','Module to control product codes',0);
|
||||||
|
|
||||||
|
ALTER TABLE llx_propaldet ADD COLUMN label varchar(255) DEFAULT NULL AFTER fk_product;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
-- Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
-- Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
-- Copyright (C) 2010 Juanjo Menent <jmenent@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
|
||||||
@@ -24,6 +24,7 @@ create table llx_propaldet
|
|||||||
fk_propal integer NOT NULL,
|
fk_propal integer NOT NULL,
|
||||||
fk_parent_line integer NULL,
|
fk_parent_line integer NULL,
|
||||||
fk_product integer NULL,
|
fk_product integer NULL,
|
||||||
|
label varchar(255) DEFAULT NULL,
|
||||||
description text,
|
description text,
|
||||||
fk_remise_except integer NULL, -- Lien vers table des remises fixes
|
fk_remise_except integer NULL, -- Lien vers table des remises fixes
|
||||||
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
||||||
@@ -45,10 +46,11 @@ create table llx_propaldet
|
|||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||||
|
|
||||||
buy_price_ht double(24,8) DEFAULT 0, -- prix d'achat HT
|
buy_price_ht double(24,8) DEFAULT 0, -- prix d'achat HT
|
||||||
fk_product_fournisseur_price int(11) DEFAULT NULL, -- r<EFBFBD>f<EFBFBD>rence prix fournisseur
|
fk_product_fournisseur_price int(11) DEFAULT NULL, -- reference prix fournisseur
|
||||||
|
|
||||||
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||||
rang integer DEFAULT 0 -- ordre affichage sur la propal
|
rang integer DEFAULT 0 -- ordre affichage sur la propal
|
||||||
|
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -172,3 +172,13 @@ HiddenIntoCombo=Caché dans les listes
|
|||||||
Nature=Nature
|
Nature=Nature
|
||||||
ProductCodeModel=Modèle de code produit
|
ProductCodeModel=Modèle de code produit
|
||||||
ServiceCodeModel=Modèle de code service
|
ServiceCodeModel=Modèle de code service
|
||||||
|
AddThisProductCard=Créer fiche produit
|
||||||
|
HelpAddThisProductCard=
|
||||||
|
AddThisServiceCard=Créer fiche service
|
||||||
|
HelpAddThisServiceCard=
|
||||||
|
UpdateOriginalProductLabel=Modifier le libellé
|
||||||
|
HelpUpdateOriginalProductLabel=
|
||||||
|
UpdateOriginalProductDescription=Modifier la description
|
||||||
|
HelpUpdateOriginalProductDescription=
|
||||||
|
UpdateOriginalProductPrice=Modifier le prix
|
||||||
|
HelpUpdateOriginalProductPrice=
|
||||||
@@ -74,6 +74,8 @@ if (! empty($dolibarr_main_document_root_alt))
|
|||||||
}
|
}
|
||||||
// Force db type (for test purpose)
|
// Force db type (for test purpose)
|
||||||
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE');
|
if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE');
|
||||||
|
// Force php strict mode (for debug)
|
||||||
|
$conf->file->strict_mode = empty($dolibarr_strict_mode)?'':$dolibarr_strict_mode;
|
||||||
// Force Multi-Company transverse mode
|
// Force Multi-Company transverse mode
|
||||||
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode;
|
$conf->multicompany->transverse_mode = empty($multicompany_transverse_mode)?'':$multicompany_transverse_mode;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user