Fix: restore old method
This commit is contained in:
parent
7ca0aa8a78
commit
3e2be54ead
@ -633,24 +633,32 @@ else if ($action == "setabsolutediscount" && $user->rights->propal->creer)
|
||||
else if ($action == "addline" && $user->rights->propal->creer)
|
||||
{
|
||||
$idprod=GETPOST('idprod', 'int');
|
||||
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$np_price = GETPOST('np_price');
|
||||
|
||||
if (empty($idprod) && GETPOST('type') < 0)
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($idprod) && (!(GETPOST('price_ht') >= 0) || GETPOST('price_ht') == '')) // Unit price can be 0 but not ''
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && empty($idprod) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($idprod) && ! GETPOST('product_desc'))
|
||||
else if (empty($idprod) && (!($np_price >= 0) || $np_price == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($idprod) && empty($product_desc))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && (GETPOST('qty') >= 0) && (GETPOST('product_desc') || ! empty($idprod)))
|
||||
if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod)))
|
||||
{
|
||||
$pu_ht=0;
|
||||
$pu_ttc=0;
|
||||
@ -718,7 +726,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
||||
|
||||
if (GETPOST('update_desc')) {
|
||||
|
||||
$desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
|
||||
$desc = $product_desc;
|
||||
|
||||
} else {
|
||||
|
||||
@ -742,8 +750,8 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
||||
$desc = $prod->description;
|
||||
}
|
||||
|
||||
$desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : "";
|
||||
$desc.= GETPOST('product_desc');
|
||||
$desc.= ($desc && ! empty($product_desc)) ? ((dol_textishtml($desc) || dol_textishtml($product_desc))?"<br />\n":"\n") : "";
|
||||
$desc.= $product_desc;
|
||||
}
|
||||
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):'');
|
||||
@ -752,17 +760,18 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ht=GETPOST('price_ht');
|
||||
$tva_tx=str_replace('*','',GETPOST('tva_tx'));
|
||||
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
|
||||
$pu_ht=(isset($price_ht)?$price_ht:$np_price);
|
||||
$rate=GETPOST('tva_tx')?GETPOST('tva_tx'):GETPOST('np_tva_tx');
|
||||
$tva_tx=str_replace('*','',$rate);
|
||||
$tva_npr=preg_match('/\*/',$rate)?1:0;
|
||||
$label=(GETPOST('product_label')?GETPOST('product_label'):'');
|
||||
$desc=GETPOST('product_desc');
|
||||
$desc=$product_desc;
|
||||
$type=GETPOST('type');
|
||||
}
|
||||
|
||||
// Margin
|
||||
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
|
||||
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
|
||||
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):(GETPOST('np_fournprice')?GETPOST('np_fournprice'):''));
|
||||
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):(GETPOST('np_buying_price')?GETPOST('np_buying_price'):''));
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx= get_localtax($tva_tx, 1, $object->client);
|
||||
@ -831,6 +840,13 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
|
||||
// old method
|
||||
unset($_POST['np_price']);
|
||||
unset($_POST['np_desc']);
|
||||
unset($_POST['dp_desc']);
|
||||
unset($_POST['np_fournprice']);
|
||||
unset($_POST['np_buying_price']);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1634,8 +1650,23 @@ if ($object->statut == 0 && $user->rights->propal->creer)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
// Add free or predefined products/services
|
||||
$object->formAddObjectLine(0,$mysoc,$soc,$hookmanager);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
// Add free or predefined products/services
|
||||
$object->formAddObjectLine(0,$mysoc,$soc,$hookmanager);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add free products/services
|
||||
$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();
|
||||
$reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -525,8 +525,16 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
$error = false;
|
||||
|
||||
$idprod=GETPOST('idprod', 'int');
|
||||
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$np_price = GETPOST('np_price');
|
||||
|
||||
if ((empty($idprod) || GETPOST('update_price')) && (GETPOST('price_ht') < 0) && (GETPOST('qty') < 0))
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && (empty($idprod) || GETPOST('update_price')) && ($price_ht < 0) && (GETPOST('qty') < 0))
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
else if (empty($idprod) && ($np_price < 0) && (GETPOST('qty') < 0))
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error = true;
|
||||
@ -536,27 +544,33 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
if (empty($idprod) && (!(GETPOST('price_ht') >= 0) || GETPOST('price_ht') == '')) // Unit price can be 0 but not ''
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && empty($idprod) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPriceHT'))), 'errors');
|
||||
$error = true;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
else if (empty($idprod) && (!($np_price >= 0) || $np_price == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! GETPOST('qty') && GETPOST('qty') == '')
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
if (empty($idprod) && ! GETPOST('product_desc'))
|
||||
if (empty($idprod) && empty($product_desc))
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (! $error && (GETPOST('qty') >= 0) && (GETPOST('product_desc') || ! empty($idprod)))
|
||||
if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod)))
|
||||
{
|
||||
// Clean parameters
|
||||
$date_start=dol_mktime(0, 0, 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end=dol_mktime(0, 0, 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
$predef=((! empty($idprod) && $conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
|
||||
$date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
$price_base_type = 'HT';
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
@ -621,7 +635,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
|
||||
if (GETPOST('update_desc')) {
|
||||
|
||||
$desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
|
||||
$desc = $product_desc;
|
||||
|
||||
} else {
|
||||
|
||||
@ -645,8 +659,8 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
$desc = $prod->description;
|
||||
}
|
||||
|
||||
$desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : "";
|
||||
$desc.= GETPOST('product_desc');
|
||||
$desc.= ($desc && ! empty($product_desc)) ? ((dol_textishtml($desc) || dol_textishtml($product_desc))?"<br />\n":"\n") : "";
|
||||
$desc.= $product_desc;
|
||||
}
|
||||
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):'');
|
||||
@ -655,17 +669,18 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ht=GETPOST('price_ht');
|
||||
$tva_tx=str_replace('*','',GETPOST('tva_tx'));
|
||||
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
|
||||
$pu_ht=($price_ht?$price_ht:$np_price);
|
||||
$rate=GETPOST('tva_tx')?GETPOST('tva_tx'):GETPOST('np_tva_tx');
|
||||
$tva_tx=str_replace('*','',$rate);
|
||||
$tva_npr=preg_match('/\*/',$rate)?1:0;
|
||||
$label=(GETPOST('product_label')?GETPOST('product_label'):'');
|
||||
$desc=GETPOST('product_desc');
|
||||
$desc=$product_desc;
|
||||
$type=GETPOST('type');
|
||||
}
|
||||
|
||||
// Margin
|
||||
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
|
||||
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
|
||||
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):(GETPOST('np_fournprice')?GETPOST('np_fournprice'):''));
|
||||
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):(GETPOST('np_buying_price')?GETPOST('np_buying_price'):''));
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx= get_localtax($tva_tx, 1, $object->client);
|
||||
@ -739,6 +754,13 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
|
||||
// old method
|
||||
unset($_POST['np_price']);
|
||||
unset($_POST['np_desc']);
|
||||
unset($_POST['dp_desc']);
|
||||
unset($_POST['np_fournprice']);
|
||||
unset($_POST['np_buying_price']);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2145,7 +2167,23 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
{
|
||||
$var=true;
|
||||
|
||||
$object->formAddObjectLine(1,$mysoc,$soc,$hookmanager);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
// Add free or predefined products/services
|
||||
$object->formAddObjectLine(1,$mysoc,$soc,$hookmanager);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add free products/services
|
||||
$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();
|
||||
$reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -948,10 +948,18 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
$error = false;
|
||||
|
||||
$idprod=GETPOST('idprod', 'int');
|
||||
$product_desc = (GETPOST('product_desc')?GETPOST('product_desc'):(GETPOST('np_desc')?GETPOST('np_desc'):(GETPOST('dp_desc')?GETPOST('dp_desc'):'')));
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$np_price = GETPOST('np_price');
|
||||
|
||||
if ((empty($idprod) || GETPOST('update_price')) && (GETPOST('price_ht') < 0) && (GETPOST('qty') < 0))
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && (empty($idprod) || GETPOST('update_price')) && ($price_ht < 0) && (GETPOST('qty') < 0))
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
else if (empty($idprod) && ($np_price < 0) && (GETPOST('qty') < 0))
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
if (empty($idprod) && GETPOST('type') < 0)
|
||||
@ -959,23 +967,28 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
if (empty($idprod) && (!(GETPOST('price_ht') >= 0) || GETPOST('price_ht') == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPriceHT'))), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1 && empty($idprod) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
else if (empty($idprod) && (!($np_price >= 0) || $np_price == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! GETPOST('qty') && GETPOST('qty') == '')
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
if (empty($idprod) && ! GETPOST('product_desc'))
|
||||
if (empty($idprod) && empty($product_desc))
|
||||
{
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||
$error = true;
|
||||
}
|
||||
|
||||
if (! $error && (GETPOST('qty') >= 0) && (GETPOST('product_desc') || ! empty($idprod)))
|
||||
if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod)))
|
||||
{
|
||||
$ret=$object->fetch($id);
|
||||
if ($ret < 0)
|
||||
@ -986,8 +999,9 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
$ret=$object->fetch_thirdparty();
|
||||
|
||||
// Clean parameters
|
||||
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
$predef=((! empty($idprod) && $conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : '');
|
||||
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
|
||||
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
|
||||
$price_base_type = 'HT';
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
@ -1052,7 +1066,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
|
||||
if (GETPOST('update_desc')) {
|
||||
|
||||
$desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
|
||||
$desc = $product_desc;
|
||||
|
||||
} else {
|
||||
|
||||
@ -1076,8 +1090,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
$desc = $prod->description;
|
||||
}
|
||||
|
||||
$desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : "";
|
||||
$desc.= GETPOST('product_desc');
|
||||
$desc.= ($desc && ! empty($product_desc)) ? ((dol_textishtml($desc) || dol_textishtml($product_desc))?"<br />\n":"\n") : "";
|
||||
$desc.= $product_desc;
|
||||
}
|
||||
|
||||
if (! empty($prod->customcode) || ! empty($prod->country_code))
|
||||
@ -1096,17 +1110,18 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
}
|
||||
else
|
||||
{
|
||||
$pu_ht=GETPOST('price_ht');
|
||||
$tva_tx=str_replace('*','',GETPOST('tva_tx'));
|
||||
$tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0;
|
||||
$pu_ht=($price_ht?$price_ht:$np_price);
|
||||
$rate=GETPOST('tva_tx')?GETPOST('tva_tx'):GETPOST('np_tva_tx');
|
||||
$tva_tx=str_replace('*','',$rate);
|
||||
$tva_npr=preg_match('/\*/',$rate)?1:0;
|
||||
$label=(GETPOST('product_label')?GETPOST('product_label'):'');
|
||||
$desc=GETPOST('product_desc');
|
||||
$desc=$product_desc;
|
||||
$type=GETPOST('type');
|
||||
}
|
||||
|
||||
// Margin
|
||||
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
|
||||
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
|
||||
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):(GETPOST('np_fournprice')?GETPOST('np_fournprice'):''));
|
||||
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):(GETPOST('np_buying_price')?GETPOST('np_buying_price'):''));
|
||||
|
||||
// Local Taxes
|
||||
$localtax1_tx= get_localtax($tva_tx, 1, $object->client);
|
||||
@ -1181,6 +1196,13 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
unset($_POST['product_desc']);
|
||||
unset($_POST['fournprice']);
|
||||
unset($_POST['buying_price']);
|
||||
|
||||
// old method
|
||||
unset($_POST['np_price']);
|
||||
unset($_POST['np_desc']);
|
||||
unset($_POST['dp_desc']);
|
||||
unset($_POST['np_fournprice']);
|
||||
unset($_POST['np_buying_price']);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3009,7 +3031,23 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
$object->formAddObjectLine(1,$mysoc,$soc,$hookmanager);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
// Add free or predefined products/services
|
||||
$object->formAddObjectLine(1,$mysoc,$soc,$hookmanager);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add free products/services
|
||||
$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();
|
||||
$reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -2549,7 +2549,8 @@ abstract class CommonObject
|
||||
print '<td>'.$langs->trans('Description').'</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"> </td>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
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('ReductionShort').'</td>';
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
|
||||
@ -1,101 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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/>.
|
||||
*
|
||||
*
|
||||
* Need to have following variables defined:
|
||||
* $conf
|
||||
* $langs
|
||||
* $dateSelector
|
||||
* $this (invoice, order, ...)
|
||||
* $line defined
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE freeproductline_edit.tpl.php -->
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'#'.$line->id; ?>" method="POST">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="updateligne">
|
||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>">
|
||||
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
|
||||
<input type="hidden" name="type" value="<?php echo $line->product_type; ?>">
|
||||
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
||||
<div id="<?php echo $line->id; ?>"></div>
|
||||
|
||||
<?php
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('line'=>$line,'fk_parent_line'=>$line->fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
|
||||
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
|
||||
}
|
||||
|
||||
// editeur wysiwyg
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('desc',$line->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
||||
$doleditor->Create();
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td align="right"><?php echo $form->load_tva('tva_tx',$line->tva_tx,$seller,$buyer,0,$line->info_bits,$line->product_type); ?></td>
|
||||
|
||||
<td align="right"><input size="6" type="text" class="flat" name="subprice" value="<?php echo price($line->subprice,0,'',0); ?>"></td>
|
||||
|
||||
<td align="right">
|
||||
<?php if (($line->info_bits & 2) != 2) { ?>
|
||||
<input size="2" type="text" class="flat" name="qty" value="<?php echo $line->qty; ?>">
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<td align="right" nowrap>
|
||||
<?php if (($line->info_bits & 2) != 2) { ?>
|
||||
<input size="1" type="text" class="flat" name="remise_percent" value="<?php echo $line->remise_percent; ?>">%
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<?php
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
?>
|
||||
<td align="right"><input type="text" size="5" name="buying_price" value="<?php echo price($line->pa_ht,0,'',0); ?>"></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td align="center" colspan="5" valign="middle"><input type="submit" class="button" name="save" value="<?php echo $langs->trans("Save"); ?>">
|
||||
<br><input type="submit" class="button" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>"></td>
|
||||
</tr>
|
||||
|
||||
<?php if ($conf->service->enabled && $dateSelector && $line->product_type == 1) { ?>
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td colspan="9"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
||||
<?php
|
||||
echo $form->select_date($line->date_start,'date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$line->date_start?0:1,"updateligne");
|
||||
echo ' '.$langs->trans('to').' ';
|
||||
echo $form->select_date($line->date_end,'date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$line->date_end?0:1,"updateligne");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
<!-- END PHP TEMPLATE freeproductline_edit.tpl.php -->
|
||||
@ -1,142 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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/>.
|
||||
*
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE freeproductline_view.tpl.php -->
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td align="center"><?php echo ($i+1); ?></td>
|
||||
<?php } ?>
|
||||
<td><div id="<?php echo $line->rowid; ?>"></div>
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid; ?>">
|
||||
<?php
|
||||
$txt='';
|
||||
print img_object($langs->trans("ShowReduc"),'reduc').' ';
|
||||
if ($line->description == '(DEPOSIT)') $txt=$langs->trans("Deposit");
|
||||
//else $txt=$langs->trans("Discount");
|
||||
print $txt;
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
if ($line->description)
|
||||
{
|
||||
if ($line->description == '(CREDIT_NOTE)')
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($line->description == '(DEPOSIT)')
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
|
||||
// Add date of deposit
|
||||
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ($txt?' - ':'').dol_htmlentitiesbr($line->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
echo $text.' '.dol_htmlentitiesbr($line->description);
|
||||
// Show range
|
||||
print_date_range($line->date_start,$line->date_end);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
||||
|
||||
<td align="right" nowrap="nowrap">
|
||||
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
||||
else echo ' '; ?>
|
||||
</td>
|
||||
|
||||
<?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?>
|
||||
<td align="right"><?php echo dol_print_reduction($line->remise_percent,$langs); ?></td>
|
||||
<?php } else { ?>
|
||||
<td> </td>
|
||||
<?php }
|
||||
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
?>
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->pa_ht); ?></td>
|
||||
<?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>
|
||||
<?php
|
||||
}
|
||||
if($conf->global->DISPLAY_MARK_RATES) {?>
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->marque_tx).'%'; ?></td>
|
||||
<?php } } ?>
|
||||
|
||||
<?php if ($line->special_code == 3) { ?>
|
||||
<td align="right" nowrap="nowrap"><?php echo $langs->trans('Option'); ?></td>
|
||||
<?php } else { ?>
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->total_ht); ?></td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->statut == 0 && $user->rights->$element->creer) { ?>
|
||||
<td align="center">
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#'.$line->id; ?>">
|
||||
<?php echo img_edit(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=ask_deleteline&lineid='.$line->id; ?>">
|
||||
<?php echo img_delete(); ?>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<?php if ($num > 1) { ?>
|
||||
<td align="center" class="tdlineupdown">
|
||||
<?php if ($i > 0) { ?>
|
||||
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id; ?>">
|
||||
<?php echo img_up(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($i < $num-1) { ?>
|
||||
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id; ?>">
|
||||
<?php echo img_down(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td align="center" class="tdlineupdown"> </td>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<td colspan="3"> </td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
<!-- END PHP TEMPLATE freeproductline_view.tpl.php -->
|
||||
@ -39,6 +39,8 @@
|
||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
||||
<div id="<?php echo $line->id; ?>"></div>
|
||||
|
||||
<?php if ($conf->global->MAIN_FEATURES_LEVEL > 1) { ?>
|
||||
|
||||
<?php if ($line->fk_product > 0) { ?>
|
||||
<?php echo $text . ' - '; ?>
|
||||
<?php } else { ?>
|
||||
@ -52,6 +54,19 @@
|
||||
</span>
|
||||
<span id="price_base_type" class="hideobject"></span>
|
||||
|
||||
<?php } else if ($line->fk_product > 0) { ?>
|
||||
|
||||
<a href="<?php echo DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product; ?>">
|
||||
<?php
|
||||
if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service');
|
||||
else print img_object($langs->trans('ShowProduct'),'product');
|
||||
echo ' '.$line->ref;
|
||||
?>
|
||||
</a>
|
||||
<?php echo ' - '.nl2br($line->product_label); ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<br>
|
||||
|
||||
<?php
|
||||
@ -74,7 +89,9 @@
|
||||
<td align="right"><?php echo $form->load_tva('tva_tx',$line->tva_tx,$seller,$buyer,0,$line->info_bits,$line->product_type); ?></td>
|
||||
|
||||
<td align="right"><input type="text" class="flat" size="8" id="price_ht" name="price_ht" value="<?php echo price($line->subprice,0,'',0); ?>"></td>
|
||||
<?php if ($conf->global->MAIN_FEATURES_LEVEL > 1) { ?>
|
||||
<td align="right"><input type="text" class="flat" size="8" id="price_ttc" name="price_ttc" value="<?php echo price($pu_ttc,0,'',0); ?>"></td>
|
||||
<?php } ?>
|
||||
|
||||
<td align="right">
|
||||
<?php if (($line->info_bits & 2) != 2) { ?>
|
||||
@ -122,6 +139,8 @@
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
<?php if ($conf->global->MAIN_FEATURES_LEVEL > 1) { ?>
|
||||
|
||||
if ($('#product_type').val() == 0) {
|
||||
$('#service_duration_area').hide();
|
||||
} else if ($('#product_type').val() == 1) {
|
||||
@ -245,6 +264,7 @@ $(document).ready(function() {
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
<?php if (! empty($conf->margin->enabled)) { ?>
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product; ?>}, function(data) {
|
||||
|
||||
@ -97,7 +97,9 @@
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
||||
|
||||
<?php if ($conf->global->MAIN_FEATURES_LEVEL > 1) { ?>
|
||||
<td align="right" nowrap="nowrap"> </td>
|
||||
<?php } ?>
|
||||
|
||||
<td align="right" nowrap="nowrap">
|
||||
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
||||
|
||||
@ -1,164 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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/>.
|
||||
*
|
||||
*
|
||||
* Need to have following variables defined:
|
||||
* $conf
|
||||
* $langs
|
||||
* $dateSelector
|
||||
* $this (invoice, order, ...)
|
||||
* $line defined
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'#'.$line->id; ?>" method="POST">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||
<input type="hidden" name="action" value="updateligne" />
|
||||
<input type="hidden" name="id" value="<?php echo $this->id; ?>" />
|
||||
<input type="hidden" name="lineid" value="<?php echo $line->id; ?>" />
|
||||
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
||||
<div id="<?php echo $line->id; ?>"></div>
|
||||
<input type="hidden" name="productid" value="<?php echo $line->fk_product; ?>" />
|
||||
<a href="<?php echo DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product; ?>">
|
||||
<?php
|
||||
if ($line->product_type==1) echo img_object($langs->trans('ShowService'),'service');
|
||||
else print img_object($langs->trans('ShowProduct'),'product');
|
||||
echo ' '.$line->ref;
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
echo ' - '.nl2br($line->product_label);
|
||||
echo '<br>';
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$fk_parent_line = ($_POST["fk_parent_line"] ? $_POST["fk_parent_line"] : $line->fk_parent_line);
|
||||
$parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
|
||||
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
|
||||
}
|
||||
|
||||
// editeur wysiwyg
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('desc',$line->description,'',164,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
||||
$doleditor->Create();
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td align="right"><?php echo $form->load_tva('tva_tx',$line->tva_tx,$seller,$buyer,'',$line->info_bits); ?></td>
|
||||
|
||||
<td align="right">
|
||||
<input size="6" type="text" class="flat" name="subprice" value="<?php echo price($line->subprice,0,'',0); ?>" />
|
||||
</td>
|
||||
|
||||
<td align="right">
|
||||
<?php if (($line->info_bits & 2) != 2) { ?>
|
||||
<input size="2" type="text" class="flat" name="qty" value="<?php echo $line->qty; ?>" />
|
||||
<?php } else { ?> <?php } ?>
|
||||
</td>
|
||||
|
||||
<td align="right" nowrap>
|
||||
<?php if (($line->info_bits & 2) != 2) { ?>
|
||||
<input size="1" type="text" class="flat" name="remise_percent" value="<?php echo $line->remise_percent; ?>" />%
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
?>
|
||||
<td align="right">
|
||||
<select id="fournprice" name="fournprice"></select>
|
||||
<input type="text" size="5" id="buying_price" name="buying_price" style="display: none;" value="<?php echo price($line->pa_ht,0,'',0); ?>">
|
||||
</td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<td align="center" colspan="5" valign="middle">
|
||||
<input type="submit" class="button" name="save" value="<?php echo $langs->trans("Save"); ?>"><br>
|
||||
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ($conf->service->enabled && $dateSelector && $line->product_type == 1) { ?>
|
||||
<tr <?php echo $bc[$var]; ?>>
|
||||
<td colspan="9"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
||||
<?php
|
||||
echo $form->select_date($line->date_start,'date_start',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$line->date_start?0:1,"updateligne");
|
||||
echo ' '.$langs->trans('to').' ';
|
||||
echo $form->select_date($line->date_end,'date_end',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$line->date_end?0:1,"updateligne");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?></form>
|
||||
<?php
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': <?php echo $line->fk_product; ?>}, function(data) {
|
||||
if (data.length > 0) {
|
||||
var options = '';
|
||||
var trouve=false;
|
||||
$(data).each(function() {
|
||||
options += '<option value="'+this.id+'" price="'+this.price+'"';
|
||||
<?php
|
||||
if ($line->fk_fournprice > 0) {
|
||||
?>
|
||||
if (this.id == <?php echo $line->fk_fournprice; ?>) {
|
||||
options += ' selected';
|
||||
$("#buying_price").val(this.price);
|
||||
trouve = true;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
options += '>'+this.label+'</option>';
|
||||
});
|
||||
options += '<option value=null'+(trouve?'':' selected')+'><?php echo $langs->trans("InputPrice"); ?></option>';
|
||||
$("#fournprice").html(options);
|
||||
if (trouve) {
|
||||
$("#buying_price").hide();
|
||||
$("#fournprice").show();
|
||||
}
|
||||
else {
|
||||
$("#buying_price").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').show();
|
||||
}
|
||||
},
|
||||
'json');
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
<!-- END PHP TEMPLATE predefinedproductline_edit.tpl.php -->
|
||||
@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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/>.
|
||||
*
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
||||
<tr <?php echo 'id="row-'.$line->id.'" '.$bcdd[$var]; ?>>
|
||||
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
|
||||
<td align="center"><?php echo ($i+1); ?></td>
|
||||
<?php } ?>
|
||||
<td><div id="<?php echo $line->id; ?>"></div>
|
||||
<?php
|
||||
echo $form->textwithtooltip($text,$description,3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
|
||||
|
||||
// Show range
|
||||
print_date_range($line->date_start, $line->date_end);
|
||||
|
||||
// Add description in form
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($line->description && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
|
||||
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->subprice); ?></td>
|
||||
|
||||
<td align="right" nowrap="nowrap">
|
||||
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
||||
else echo ' '; ?>
|
||||
</td>
|
||||
|
||||
<?php if (!empty($line->remise_percent) && $line->special_code != 3) { ?>
|
||||
<td align="right"><?php echo dol_print_reduction($line->remise_percent,$langs); ?></td>
|
||||
<?php } else { ?>
|
||||
<td> </td>
|
||||
<?php }
|
||||
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
?>
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->pa_ht); ?></td>
|
||||
<?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>
|
||||
<?php
|
||||
}
|
||||
if($conf->global->DISPLAY_MARK_RATES) {?>
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->marque_tx).'%'; ?></td>
|
||||
<?php } } ?>
|
||||
|
||||
<?php if ($line->special_code == 3) { ?>
|
||||
<td align="right" nowrap="nowrap"><?php echo $langs->trans('Option'); ?></td>
|
||||
<?php } else { ?>
|
||||
<td align="right" nowrap="nowrap"><?php echo price($line->total_ht); ?></td>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->statut == 0 && $user->rights->$element->creer) { ?>
|
||||
<td align="center">
|
||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#'.$line->id; ?>">
|
||||
<?php echo img_edit(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=ask_deleteline&lineid='.$line->id; ?>">
|
||||
<?php echo img_delete(); ?>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<?php if ($num > 1) { ?>
|
||||
<td align="center" class="tdlineupdown">
|
||||
<?php if ($i > 0) { ?>
|
||||
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id; ?>">
|
||||
<?php echo img_up(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($i < $num-1) { ?>
|
||||
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id; ?>">
|
||||
<?php echo img_down(); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td align="center" class="tdlineupdown"> </td>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<td colspan="3"> </td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
<!-- END PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
||||
Loading…
Reference in New Issue
Block a user