Fix: restore old method
This commit is contained in:
parent
7ca0aa8a78
commit
3e2be54ead
@ -80,7 +80,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$ret=$object->fetch($id, $ref);
|
||||
if ($ret == 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
|
||||
$error++;
|
||||
}
|
||||
@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
else
|
||||
{
|
||||
Header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php');
|
||||
Header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -147,75 +147,75 @@ $form = new Form($db);
|
||||
$formcompany= new FormCompany($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'contact', $langs->trans("Proposal"), 0, 'propal');
|
||||
|
||||
/*
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'contact', $langs->trans("Proposal"), 0, 'propal');
|
||||
|
||||
/*
|
||||
* Propal synthese pour rappel
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Delivery address
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Delivery address
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editdelivery_address' && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($action == 'editdelivery_address')
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','propal',$object->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'none','propal',$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
{
|
||||
$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
|
||||
if ($res) break;
|
||||
}
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($action == 'editdelivery_address')
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','propal',$object->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'none','propal',$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||
foreach($dirtpls as $reldir)
|
||||
{
|
||||
$res=@include dol_buildpath($reldir.'/contacts.tpl.php');
|
||||
if ($res) break;
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -49,18 +49,18 @@ if (! empty($output) && isset($amount) && isset($tva_tx))
|
||||
|
||||
if (is_numeric($amount) && $amount != '')
|
||||
{
|
||||
if ($output == 'price_ttc') {
|
||||
|
||||
$price = price2num($amount * (1 + ($tva_tx/100)), 'MU');
|
||||
$return['price_ht'] = $amount;
|
||||
$return['price_ttc'] = (isset($price) && $price != '' ? price($price) : '');
|
||||
|
||||
}
|
||||
else if ($output == 'price_ht') {
|
||||
|
||||
$price = price2num($amount / (1 + ($tva_tx/100)), 'MU');
|
||||
$return['price_ht'] = (isset($price) && $price != '' ? price($price) : '');
|
||||
$return['price_ttc'] = ($tva_tx == 0 ? $price : $amount);
|
||||
if ($output == 'price_ttc') {
|
||||
|
||||
$price = price2num($amount * (1 + ($tva_tx/100)), 'MU');
|
||||
$return['price_ht'] = $amount;
|
||||
$return['price_ttc'] = (isset($price) && $price != '' ? price($price) : '');
|
||||
|
||||
}
|
||||
else if ($output == 'price_ht') {
|
||||
|
||||
$price = price2num($amount / (1 + ($tva_tx/100)), 'MU');
|
||||
$return['price_ht'] = (isset($price) && $price != '' ? price($price) : '');
|
||||
$return['price_ttc'] = ($tva_tx == 0 ? $price : $amount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2444,46 +2444,46 @@ abstract class CommonObject
|
||||
|
||||
/* This is to show add lines */
|
||||
|
||||
/**
|
||||
* Show add predefined products/services form
|
||||
* TODO Edit templates to use global variables and include them directly in controller call
|
||||
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
|
||||
*
|
||||
* @param int $dateSelector 1=Show also date range input fields
|
||||
* @param Societe $seller Object thirdparty who sell
|
||||
* @param Societe $buyer Object thirdparty who buy
|
||||
* @param HookManager $hookmanager Hook manager instance
|
||||
/**
|
||||
* Show add predefined products/services form
|
||||
* TODO Edit templates to use global variables and include them directly in controller call
|
||||
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
|
||||
*
|
||||
* @param int $dateSelector 1=Show also date range input fields
|
||||
* @param Societe $seller Object thirdparty who sell
|
||||
* @param Societe $buyer Object thirdparty who buy
|
||||
* @param HookManager $hookmanager Hook manager instance
|
||||
* @return void
|
||||
* @deprecated
|
||||
*/
|
||||
function formAddPredefinedProduct($dateSelector,$seller,$buyer,$hookmanager=false)
|
||||
{
|
||||
global $conf,$langs,$object;
|
||||
global $form,$bcnd,$var;
|
||||
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_create.tpl.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show add free products/services form
|
||||
* TODO Edit templates to use global variables and include them directly in controller call
|
||||
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
|
||||
*
|
||||
* @param int $dateSelector 1=Show also date range input fields
|
||||
* @param Societe $seller Object thirdparty who sell
|
||||
* @param Societe $buyer Object thirdparty who buy
|
||||
* @param HookManager $hookmanager Hook manager instance
|
||||
* @deprecated
|
||||
*/
|
||||
function formAddPredefinedProduct($dateSelector,$seller,$buyer,$hookmanager=false)
|
||||
{
|
||||
global $conf,$langs,$object;
|
||||
global $form,$bcnd,$var;
|
||||
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_create.tpl.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show add free products/services form
|
||||
* TODO Edit templates to use global variables and include them directly in controller call
|
||||
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
|
||||
*
|
||||
* @param int $dateSelector 1=Show also date range input fields
|
||||
* @param Societe $seller Object thirdparty who sell
|
||||
* @param Societe $buyer Object thirdparty who buy
|
||||
* @param HookManager $hookmanager Hook manager instance
|
||||
* @return void
|
||||
* @deprecated
|
||||
*/
|
||||
function formAddFreeProduct($dateSelector,$seller,$buyer,$hookmanager=false)
|
||||
{
|
||||
global $conf,$langs,$object;
|
||||
global $form,$bcnd,$var;
|
||||
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
|
||||
* @deprecated
|
||||
*/
|
||||
function formAddFreeProduct($dateSelector,$seller,$buyer,$hookmanager=false)
|
||||
{
|
||||
global $conf,$langs,$object;
|
||||
global $form,$bcnd,$var;
|
||||
|
||||
// Use global variables + $dateSelector + $seller and $buyer
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/freeproductline_create.tpl.php');
|
||||
}
|
||||
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -82,7 +82,7 @@ class html_cerfafr extends ModeleDon
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
$outputlangs->load("donations");
|
||||
$outputlangs->load("donations");
|
||||
|
||||
if (! empty($conf->don->dir_output))
|
||||
{
|
||||
@ -143,17 +143,17 @@ class html_cerfafr extends ModeleDon
|
||||
$form = str_replace('__DonationPaymentDate__',$outputlangs->trans("DonationPaymentDate"),$form);
|
||||
$form = str_replace('__DonationPaymentMode__',$outputlangs->trans("DonationPaymentMode"),$form);
|
||||
$form = str_replace('__Name__',$outputlangs->trans("Name"),$form);
|
||||
$form = str_replace('__Address__',$outputlangs->trans("Address"),$form);
|
||||
$form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form);
|
||||
$form = str_replace('__Town__',$outputlangs->trans("Town"),$form);
|
||||
$form = str_replace('__Donor__',$outputlangs->trans("Donor"),$form);
|
||||
$form = str_replace('__Date__',$outputlangs->trans("Date"),$form);
|
||||
$form = str_replace('__Signature__',$outputlangs->trans("Signature"),$form);
|
||||
$form = str_replace('__Address__',$outputlangs->trans("Address"),$form);
|
||||
$form = str_replace('__Zip__',$outputlangs->trans("Zip"),$form);
|
||||
$form = str_replace('__Town__',$outputlangs->trans("Town"),$form);
|
||||
$form = str_replace('__Donor__',$outputlangs->trans("Donor"),$form);
|
||||
$form = str_replace('__Date__',$outputlangs->trans("Date"),$form);
|
||||
$form = str_replace('__Signature__',$outputlangs->trans("Signature"),$form);
|
||||
$form = str_replace('__ThankYou__',$outputlangs->trans("ThankYou"),$form);
|
||||
$form = str_replace('__IConfirmDonationReception__',$outputlangs->trans("IConfirmDonationReception"),$form);
|
||||
$frencharticle='';
|
||||
if (preg_match('/fr/i',$outputlangs->defaultlang)) $frencharticle='<font size="+1"><b>(Article 200-5 du Code Général des Impôts)</b></font><br>+ article 238 bis';
|
||||
$form = str_replace('__FrenchArticle__',$frencharticle,$form);
|
||||
$form = str_replace('__FrenchArticle__',$frencharticle,$form);
|
||||
|
||||
// Sauve fichier sur disque
|
||||
dol_syslog("html_cerfafr::write_file $file");
|
||||
|
||||
@ -156,10 +156,10 @@ function don_create($db, $id, $message, $modele, $outputlangs)
|
||||
|
||||
$eror=0;
|
||||
|
||||
// Increase limit for PDF build
|
||||
$err=error_reporting();
|
||||
error_reporting(0);
|
||||
@set_time_limit(120);
|
||||
// Increase limit for PDF build
|
||||
$err=error_reporting();
|
||||
error_reporting(0);
|
||||
@set_time_limit(120);
|
||||
error_reporting($err);
|
||||
|
||||
$srctemplatepath='';
|
||||
@ -178,34 +178,34 @@ function don_create($db, $id, $message, $modele, $outputlangs)
|
||||
}
|
||||
}
|
||||
|
||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
||||
$tmp=explode(':',$modele,2);
|
||||
if (! empty($tmp[1]))
|
||||
{
|
||||
$modele=$tmp[0];
|
||||
$srctemplatepath=$tmp[1];
|
||||
}
|
||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
||||
$tmp=explode(':',$modele,2);
|
||||
if (! empty($tmp[1]))
|
||||
{
|
||||
$modele=$tmp[0];
|
||||
$srctemplatepath=$tmp[1];
|
||||
}
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array('/');
|
||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
foreach(array('html','doc','pdf') as $prefix)
|
||||
{
|
||||
$file = $prefix."_".preg_replace('/^html_/','',$modele).".modules.php";
|
||||
|
||||
// On verifie l'emplacement du modele
|
||||
$file=dol_buildpath($reldir."core/modules/dons/".$file,0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_'.$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($filefound) break;
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array('/');
|
||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
foreach(array('html','doc','pdf') as $prefix)
|
||||
{
|
||||
$file = $prefix."_".preg_replace('/^html_/','',$modele).".modules.php";
|
||||
|
||||
// On verifie l'emplacement du modele
|
||||
$file=dol_buildpath($reldir."core/modules/dons/".$file,0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname=$prefix.'_'.$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($filefound) break;
|
||||
}
|
||||
|
||||
// Charge le modele
|
||||
|
||||
@ -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 -->
|
||||
@ -61,44 +61,44 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
$ret=$object->fetch($id);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$outref=$object->ref;
|
||||
$outlabel=$object->label;
|
||||
$outdesc=$object->description;
|
||||
$outref=$object->ref;
|
||||
$outlabel=$object->label;
|
||||
$outdesc=$object->description;
|
||||
$outtype=$object->type;
|
||||
|
||||
$found=false;
|
||||
|
||||
// Multiprice
|
||||
if ($price_level >= 1) // If we need a particular price level (from 1 to 6)
|
||||
{
|
||||
$sql= "SELECT price, price_ttc, price_base_type ";
|
||||
$sql.= "FROM ".MAIN_DB_PREFIX."product_price ";
|
||||
$sql.= "WHERE fk_product='".$id."'";
|
||||
$sql.= " AND price_level=".$price_level;
|
||||
$sql.= " ORDER BY date_price";
|
||||
$sql.= " DESC LIMIT 1";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
if ($objp)
|
||||
$found=false;
|
||||
|
||||
// Multiprice
|
||||
if ($price_level >= 1) // If we need a particular price level (from 1 to 6)
|
||||
{
|
||||
$sql= "SELECT price, price_ttc, price_base_type ";
|
||||
$sql.= "FROM ".MAIN_DB_PREFIX."product_price ";
|
||||
$sql.= "WHERE fk_product='".$id."'";
|
||||
$sql.= " AND price_level=".$price_level;
|
||||
$sql.= " ORDER BY date_price";
|
||||
$sql.= " DESC LIMIT 1";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
if ($objp)
|
||||
{
|
||||
$found=true;
|
||||
$outprice_ht=price($objp->price);
|
||||
$outprice_ttc=price($objp->price_ttc);
|
||||
$outpricebasetype=$objp->price_base_type;
|
||||
}
|
||||
}
|
||||
$found=true;
|
||||
$outprice_ht=price($objp->price);
|
||||
$outprice_ttc=price($objp->price_ttc);
|
||||
$outpricebasetype=$objp->price_base_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $found)
|
||||
{
|
||||
$outprice_ht=price($object->price);
|
||||
$outprice_ttc=price($object->price_ttc);
|
||||
{
|
||||
$outprice_ht=price($object->price);
|
||||
$outprice_ttc=price($object->price_ttc);
|
||||
$outpricebasetype=$object->price_base_type;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$outjson = array('ref'=>$outref, 'label'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype);
|
||||
}
|
||||
|
||||
@ -107,36 +107,36 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
|
||||
$langs->load("products");
|
||||
$langs->load("main");
|
||||
|
||||
top_httphead();
|
||||
|
||||
if (empty($htmlname)) return;
|
||||
|
||||
$match = preg_grep('/('.$htmlname.'[0-9]+)/',array_keys($_GET));
|
||||
sort($match);
|
||||
$idprod = (! empty($match[0]) ? $match[0] : '');
|
||||
|
||||
if (! GETPOST($htmlname) && ! GETPOST($idprod)) return;
|
||||
|
||||
// When used from jQuery, the search term is added as GET param "term".
|
||||
$searchkey=(GETPOST($idprod)?GETPOST($idprod):(GETPOST($htmlname)?GETPOST($htmlname):''));
|
||||
|
||||
$form = new Form($db);
|
||||
if (empty($mode) || $mode == 1)
|
||||
{
|
||||
$arrayresult=$form->select_produits_do("",$htmlname,$type,"",$pricelevel,$searchkey,$status,2,$outjson);
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
$arrayresult=$form->select_produits_fournisseurs_do($socid,"",$htmlname,$type,"",$searchkey,$status,$outjson);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
if (empty($htmlname)) return;
|
||||
|
||||
$match = preg_grep('/('.$htmlname.'[0-9]+)/',array_keys($_GET));
|
||||
sort($match);
|
||||
$idprod = (! empty($match[0]) ? $match[0] : '');
|
||||
|
||||
if (! GETPOST($htmlname) && ! GETPOST($idprod)) return;
|
||||
|
||||
// When used from jQuery, the search term is added as GET param "term".
|
||||
$searchkey=(GETPOST($idprod)?GETPOST($idprod):(GETPOST($htmlname)?GETPOST($htmlname):''));
|
||||
|
||||
$form = new Form($db);
|
||||
if (empty($mode) || $mode == 1)
|
||||
{
|
||||
$arrayresult=$form->select_produits_do("",$htmlname,$type,"",$pricelevel,$searchkey,$status,2,$outjson);
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
$arrayresult=$form->select_produits_fournisseurs_do($socid,"",$htmlname,$type,"",$searchkey,$status,$outjson);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
if ($outjson) print json_encode($arrayresult);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user