Fix test for navigation disabling for external users
This commit is contained in:
parent
5d9a84dedb
commit
64a6ff9687
@ -165,7 +165,7 @@ if (empty($reshook))
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Barcode type
|
||||
if ($action == 'setfk_barcode_type' && $createbarcode)
|
||||
{
|
||||
@ -221,7 +221,7 @@ if (empty($reshook))
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$units = GETPOST('units', 'int');
|
||||
@ -289,7 +289,7 @@ if (empty($reshook))
|
||||
$object->volume_units = GETPOST('volume_units');
|
||||
$object->finished = GETPOST('finished');
|
||||
$object->fk_unit = GETPOST('units');
|
||||
|
||||
|
||||
$accountancy_code_sell = GETPOST('accountancy_code_sell');
|
||||
$accountancy_code_buy = GETPOST('accountancy_code_buy');
|
||||
|
||||
@ -413,7 +413,7 @@ if (empty($reshook))
|
||||
|
||||
$accountancy_code_sell = GETPOST('accountancy_code_sell');
|
||||
$accountancy_code_buy = GETPOST('accountancy_code_buy');
|
||||
|
||||
|
||||
if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; }
|
||||
if ($accountancy_code_buy <= 0) { $object->accountancy_code_buy = ''; } else { $object->accountancy_code_buy = $accountancy_code_buy; }
|
||||
|
||||
@ -643,7 +643,7 @@ if (empty($reshook))
|
||||
|
||||
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
|
||||
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
|
||||
|
||||
|
||||
// On reevalue prix selon taux tva car taux tva transaction peut etre different
|
||||
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
|
||||
if ($tmpvat != $tmpprodvat) {
|
||||
@ -653,7 +653,7 @@ if (empty($reshook))
|
||||
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GETPOST('propalid') > 0) {
|
||||
// Define cost price for margin calculation
|
||||
$buyprice=0;
|
||||
@ -666,7 +666,7 @@ if (empty($reshook))
|
||||
{
|
||||
$buyprice = $result;
|
||||
}
|
||||
|
||||
|
||||
$result = $propal->addline(
|
||||
$desc,
|
||||
$pu_ht,
|
||||
@ -709,7 +709,7 @@ if (empty($reshook))
|
||||
{
|
||||
$buyprice = $result;
|
||||
}
|
||||
|
||||
|
||||
$result = $commande->addline(
|
||||
$desc,
|
||||
$pu_ht,
|
||||
@ -895,7 +895,7 @@ else
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
|
||||
print '<tr>';
|
||||
$tmpcode='';
|
||||
if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type);
|
||||
@ -1067,14 +1067,14 @@ else
|
||||
//if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) available in create mode
|
||||
//{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="3">';
|
||||
|
||||
|
||||
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
|
||||
print "</td></tr>";
|
||||
//}
|
||||
|
||||
|
||||
if($conf->categorie->enabled) {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
@ -1119,7 +1119,7 @@ else
|
||||
|
||||
// Accountancy codes
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
// Accountancy_code_sell
|
||||
@ -1133,8 +1133,8 @@ else
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account(GETPOST('accountancy_code_buy'), 'accountancy_code_buy', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
}
|
||||
else // For external software
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
@ -1378,7 +1378,7 @@ else
|
||||
}
|
||||
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
|
||||
@ -1395,13 +1395,13 @@ else
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="3">';
|
||||
|
||||
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
@ -1421,8 +1421,8 @@ else
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else // For external software
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
@ -1460,15 +1460,18 @@ else
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
|
||||
$object->next_prev_filter=" fk_product_type = ".$object->type;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
|
||||
// Type
|
||||
if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled))
|
||||
{
|
||||
@ -1574,7 +1577,7 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
// Batch number management (to batch)
|
||||
if (! empty($conf->productbatch->enabled)) {
|
||||
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td colspan="2">';
|
||||
@ -1597,10 +1600,10 @@ else
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
|
||||
// Nature
|
||||
if($object->type!= Product::TYPE_SERVICE)
|
||||
{
|
||||
@ -1722,13 +1725,13 @@ else
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NotePrivate").'</td><td colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'">'.(dol_textishtml($object->note_private)?$object->note_private:dol_nl2br($object->note_private,1,true)).'</td></tr>'."\n";
|
||||
print '<!-- End show Note --> '."\n";
|
||||
}
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
@ -1795,7 +1798,7 @@ if (empty($reshook))
|
||||
{
|
||||
if ($action == '' || $action == 'view')
|
||||
{
|
||||
if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) ||
|
||||
if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) ||
|
||||
($object->type == Product::TYPE_SERVICE && $user->rights->service->creer))
|
||||
{
|
||||
if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
|
||||
@ -1940,7 +1943,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action =
|
||||
print '<input type="hidden" name="action" value="addin">';
|
||||
|
||||
print load_fiche_titre($langs->trans("AddToDraft"),'','');
|
||||
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
$html .= '<tr><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
@ -1952,7 +1955,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action =
|
||||
print '<table width="100%" class="border">';
|
||||
print $html;
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</div>';
|
||||
@ -1979,10 +1982,10 @@ if ($action == '' || $action == 'view')
|
||||
$delallowed=$user->rights->produit->supprimer;
|
||||
|
||||
$var=true;
|
||||
|
||||
|
||||
print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
|
||||
$somethingshown=$formfile->numoffiles;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
@ -86,8 +86,8 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
|
||||
$action = 're-edit';
|
||||
if ($object->error == "isFatherOfThis") {
|
||||
setEventMessages($langs->trans("ErrorAssociationIsFatherOfThis"), null, 'errors');
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
@ -204,15 +204,18 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($user->rights->produit->lire || $user->rights->service->lire)
|
||||
{
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 1);
|
||||
|
||||
if ($object->type!=Product::TYPE_SERVICE || empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
}
|
||||
|
||||
|
||||
// Nature
|
||||
if ($object->type!=Product::TYPE_SERVICE)
|
||||
{
|
||||
@ -256,11 +259,11 @@ if ($id > 0 || ! empty($ref))
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
$prodsfather = $object->getFather(); // Parent Products
|
||||
$object->get_sousproduits_arbo(); // Load $object->sousprods
|
||||
$prods_arbo=$object->get_arbo_each_prod();
|
||||
|
||||
$prods_arbo=$object->get_arbo_each_prod();
|
||||
|
||||
$nbofsubsubproducts=count($prods_arbo); // This include sub sub product into nb
|
||||
$prodschild = $object->getChildsArbo($id,1);
|
||||
$nbofsubproducts=count($prodschild); // This include only first level of childs
|
||||
@ -369,7 +372,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$totalline=price2num($value['nb'] * ($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) + $product_fourn->fourn_unitcharges - $product_fourn->fourn_remise), 'MT');
|
||||
$total+=$totalline;
|
||||
|
||||
|
||||
print '<td align="right">';
|
||||
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency));
|
||||
print '</td>';
|
||||
@ -385,7 +388,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right" colspan="2">';
|
||||
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($pricesell,'','',0,0,-1,$conf->currency));
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Stock
|
||||
if (! empty($conf->stock->enabled)) print '<td align="right">'.$value['stock'].'</td>'; // Real stock
|
||||
|
||||
@ -424,7 +427,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Best selling price
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
|
||||
|
||||
if (! empty($conf->stock->enabled)) print '<td></td>'; // Real stock
|
||||
print '<td align="center">'.$value['nb'].'</td>';
|
||||
print '<td> </td>';
|
||||
@ -456,7 +459,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
|
||||
print ($atleastonenotdefined?'':price($totalsell,'','',0,0,-1,$conf->currency));
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Stock
|
||||
if (! empty($conf->stock->enabled)) print '<td class="liste_total" align="right"> </td>';
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
{
|
||||
if (! empty($conf->product->enabled)) $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos";
|
||||
@ -210,11 +210,14 @@ if ($object->id)
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
@ -224,14 +227,14 @@ if ($object->id)
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$permission = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
|
||||
|
||||
// Merge propal PDF document PDF files
|
||||
if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL))
|
||||
{
|
||||
@ -307,17 +310,17 @@ if ($object->id)
|
||||
$checked = '';
|
||||
$filename = $filetoadd['name'];
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS)
|
||||
if ($conf->global->MAIN_MULTILANGS)
|
||||
{
|
||||
if (array_key_exists($filetoadd['name'] . '_' . $delauft_lang, $filetomerge->lines))
|
||||
if (array_key_exists($filetoadd['name'] . '_' . $delauft_lang, $filetomerge->lines))
|
||||
{
|
||||
$filename = $filetoadd['name'] . ' - ' . $langs->trans('Language_' . $delauft_lang);
|
||||
$checked = ' checked ';
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (array_key_exists($filetoadd['name'], $filetomerge->lines))
|
||||
if (array_key_exists($filetoadd['name'], $filetomerge->lines))
|
||||
{
|
||||
$checked = ' checked ';
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ if (empty($reshook))
|
||||
if ($id)
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
$object->cost_price = price2num($cost_price);
|
||||
$object->cost_price = price2num($cost_price);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -112,7 +112,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'confirm_remove_pf')
|
||||
{
|
||||
if ($rowid) // id of product supplier price to remove
|
||||
@ -299,20 +299,23 @@ if ($id > 0 || $ref)
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id . '&rowid=' . $rowid, $langs->trans('DeleteProductBuyPrice'), $langs->trans('ConfirmDeleteProductBuyPrice'), 'confirm_remove_pf', '', 0, 1);
|
||||
echo $formconfirm;
|
||||
}
|
||||
|
||||
|
||||
if ($action <> 'edit' && $action <> 're-edit')
|
||||
{
|
||||
$head=product_prepare_head($object);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'suppliers', $titre, 0, $picto);
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
@ -337,14 +340,14 @@ if ($id > 0 || $ref)
|
||||
print '</td><td colspan="2">';
|
||||
print $form->editfieldval($text,'cost_price',$object->cost_price,$object,$user->rights->produit->creer||$user->rights->service->creer,'amount:6');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
// Form to add or update a price
|
||||
if (($action == 'add_price' || $action == 'updateprice' ) && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
@ -364,7 +367,7 @@ if ($id > 0 || $ref)
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateprice">';
|
||||
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
@ -449,11 +452,11 @@ if ($id > 0 || $ref)
|
||||
$default_vat=get_default_tva($mysoc2, $mysoc, $object->id, 0);
|
||||
$default_npr=get_default_npr($mysoc2, $mysoc, $object->id, 0);
|
||||
if (empty($default_vat)) $default_npr=$default_vat;
|
||||
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("VATRateForSupplierProduct").'</td>';
|
||||
print '<td>';
|
||||
//print $form->load_tva('tva_tx',$object->tva_tx,$supplier,$mysoc); // Do not use list here as it may be any vat rates for any country
|
||||
if (! empty($rowid)) // If we have a supplier, it is an update, we must show the vat of current supplier price
|
||||
if (! empty($rowid)) // If we have a supplier, it is an update, we must show the vat of current supplier price
|
||||
{
|
||||
$tmpproductsupplier=new ProductFournisseur($db);
|
||||
$tmpproductsupplier->fetch_product_fournisseur_price($rowid, 1);
|
||||
@ -462,7 +465,7 @@ if ($id > 0 || $ref)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (empty($default_vat))
|
||||
if (empty($default_vat))
|
||||
{
|
||||
$default_vat=$object->tva_tx;
|
||||
}
|
||||
@ -588,7 +591,7 @@ if ($id > 0 || $ref)
|
||||
$product_fourn_list = $product_fourn->list_product_fournisseur_price($object->id, $sortfield, $sortorder);
|
||||
$nbtotalofrecords = count($product_fourn_list);
|
||||
print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($product_fourn_list), $nbtotalofrecords, 'title_accountancy.png');
|
||||
|
||||
|
||||
// Suppliers list title
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -607,7 +610,7 @@ if ($id > 0 || $ref)
|
||||
print_liste_field_titre($langs->trans("DiscountQtyMin"),$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NbDaysToDelivery"),$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ReputationForThisProduct"),$_SERVER["PHP_SELF"],"pfp.supplier_reputation","",$param,'align="center"',$sortfield,$sortorder);
|
||||
|
||||
|
||||
// Charges ????
|
||||
if ($conf->global->PRODUCT_CHARGES)
|
||||
{
|
||||
@ -628,7 +631,7 @@ if ($id > 0 || $ref)
|
||||
|
||||
// Supplier
|
||||
print '<td>'.$productfourn->getSocNomUrl(1,'supplier').'</td>';
|
||||
|
||||
|
||||
// Supplier
|
||||
print '<td align="left">'.$productfourn->fourn_ref.'</td>';
|
||||
|
||||
@ -674,8 +677,8 @@ if ($id > 0 || $ref)
|
||||
// Reputation
|
||||
print '<td align="center">';
|
||||
if (!empty($productfourn->supplier_reputation) && !empty($object->reputations[$productfourn->supplier_reputation])) {
|
||||
print $object->reputations[$productfourn->supplier_reputation];
|
||||
}
|
||||
print $object->reputations[$productfourn->supplier_reputation];
|
||||
}
|
||||
print'</td>';
|
||||
|
||||
// Charges ????
|
||||
|
||||
@ -87,7 +87,7 @@ if ($id > 0 || $ref)
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$head=product_prepare_head($object);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
|
||||
@ -95,8 +95,11 @@ if ($id > 0 || $ref)
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
$object->info($object->id);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
@ -104,11 +107,11 @@ if ($id > 0 || $ref)
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
dol_print_object_info($object);
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
@ -90,21 +90,24 @@ if ($id > 0 || ! empty($ref))
|
||||
$head = product_prepare_head($object);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type==Product::TYPE_SERVICE?'service':'product');
|
||||
|
||||
|
||||
dol_fiche_head($head, 'note', $titre, 0, $picto);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
$cssclass='titlefield';
|
||||
//if ($action == 'editnote_public') $cssclass='titlefieldcreate';
|
||||
//if ($action == 'editnote_private') $cssclass='titlefieldcreate';
|
||||
|
||||
|
||||
//print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -90,9 +90,9 @@ if (empty($reshook))
|
||||
{
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_soc = '';
|
||||
$search_soc = '';
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'setlabelsellingprice' && $user->admin)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
@ -100,7 +100,7 @@ if (empty($reshook))
|
||||
dolibarr_set_const($db, $keyforlabel, GETPOST('labelsellingprice','alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
if (($action == 'update_vat') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
|
||||
@ -149,14 +149,14 @@ if (empty($reshook))
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
|
||||
if ($error)
|
||||
{
|
||||
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
|
||||
$localtaxarray=array(); // We do not store localtaxes into product, we will use instead the "vat code" to retreive them.
|
||||
$object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
@ -165,10 +165,10 @@ if (empty($reshook))
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
if (($action == 'update_price') && !$cancel && $object->getRights()->creer)
|
||||
{
|
||||
$error = 0;
|
||||
@ -208,14 +208,14 @@ if (empty($reshook))
|
||||
//Shall we generate prices using price rules?
|
||||
$object->price_autogen = GETPOST('usePriceRules') == 'on';
|
||||
|
||||
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||
{
|
||||
if (!isset($newprice[$i])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tva_tx_txt = $newvattx[$i];
|
||||
|
||||
|
||||
$vatratecode = '';
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
$npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0;
|
||||
@ -242,7 +242,7 @@ if (empty($reshook))
|
||||
$localtax2 = $obj->localtax2;
|
||||
$localtax1_type = $obj->localtax1_type;
|
||||
$localtax2_type = $obj->localtax2_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pricestoupdate[$i] = array(
|
||||
@ -469,7 +469,7 @@ if (empty($reshook))
|
||||
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
|
||||
|
||||
$tva_tx_txt = GETPOST("tva_tx");
|
||||
|
||||
|
||||
$vatratecode = '';
|
||||
// We must define tva_tx, npr and local taxes
|
||||
$tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot
|
||||
@ -496,8 +496,8 @@ if (empty($reshook))
|
||||
$localtax1_type = $obj->localtax1_type;
|
||||
$localtax2_type = $obj->localtax2_type;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$prodcustprice->default_vat_code = $vatratecode;
|
||||
$prodcustprice->tva_tx = $tva_tx;
|
||||
$prodcustprice->recuperableonly = $npr;
|
||||
@ -505,7 +505,7 @@ if (empty($reshook))
|
||||
$prodcustprice->localtax2_tx = $localtax2;
|
||||
$prodcustprice->localtax1_type = $localtax1_type;
|
||||
$prodcustprice->localtax2_type = $localtax2_type;
|
||||
|
||||
|
||||
if (! ($prodcustprice->fk_soc > 0))
|
||||
{
|
||||
$langs->load("errors");
|
||||
@ -591,7 +591,7 @@ if (empty($reshook))
|
||||
$localtax2_type = $obj->localtax2_type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$prodcustprice->default_vat_code = $vatratecode;
|
||||
$prodcustprice->tva_tx = $tva_tx;
|
||||
$prodcustprice->recuperableonly = $npr;
|
||||
@ -599,7 +599,7 @@ if (empty($reshook))
|
||||
$prodcustprice->localtax2_tx = $localtax2;
|
||||
$prodcustprice->localtax1_type = $localtax1_type;
|
||||
$prodcustprice->localtax2_type = $localtax2_type;
|
||||
|
||||
|
||||
if ($prodcustprice->price_min < $maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
|
||||
{
|
||||
setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
|
||||
@ -658,7 +658,10 @@ dol_fiche_head($head, 'price', $titre, 0, $picto);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
@ -702,7 +705,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
print price($object->multiprices_min[$soc->price_level]) . ' ' . $langs->trans(empty($object->multiprices_base_type[$soc->price_level])?'HT':$object->multiprices_base_type[$soc->price_level]);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
// TVA
|
||||
@ -719,7 +722,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -742,9 +745,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<table class="noborder tableforfield" width="100%">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("PriceLevel");
|
||||
@ -755,11 +758,11 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
|
||||
|
||||
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
|
||||
{
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Label of price
|
||||
@ -824,7 +827,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
print '<td align="right">' . $langs->trans("Discount") . '</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
foreach ($object->prices_by_qty_list[$i] as $ii => $prices)
|
||||
foreach ($object->prices_by_qty_list[$i] as $ii => $prices)
|
||||
{
|
||||
if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) {
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||
@ -882,15 +885,15 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>';
|
||||
if ($object->default_vat_code)
|
||||
{
|
||||
print vatrate($object->tva_tx, true) . ' ('.$object->default_vat_code.')';
|
||||
}
|
||||
}
|
||||
else print vatrate($object->tva_tx, true, $object->tva_npr, true);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1021,18 +1024,18 @@ if (! $action || $action == 'delete' || $action == 'showlog_customer_price' || $
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&id=' . $object->id . '">' . $langs->trans("UpdateLevelPrices") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "\n</div>\n";
|
||||
}
|
||||
|
||||
@ -1041,7 +1044,7 @@ if (! $action || $action == 'delete' || $action == 'showlog_customer_price' || $
|
||||
/*
|
||||
* Edit price area
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("UpdateVAT"), '');
|
||||
@ -1052,9 +1055,9 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// VAT
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
||||
print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
|
||||
@ -1072,7 +1075,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se
|
||||
|
||||
print '<br></form><br>';
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
{
|
||||
print load_fiche_titre($langs->trans("NewPrice"), '');
|
||||
@ -1085,7 +1088,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// VAT
|
||||
@ -1168,7 +1171,7 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
@ -1213,21 +1216,21 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) {
|
||||
print $langs->trans('UseMultipriceRules'). ' <input type="checkbox" id="usePriceRules" name="usePriceRules" '.($object->price_autogen ? 'checked' : '').'><br><br>';
|
||||
}
|
||||
|
||||
print '<table class="noborder">';
|
||||
print '<thead><tr class="liste_titre">';
|
||||
|
||||
|
||||
print '<td>'.$langs->trans("PriceLevel").'</td>';
|
||||
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) print '<td style="text-align: center">'.$langs->trans("VATRate").'</td>';
|
||||
else print '<td></td>';
|
||||
|
||||
|
||||
print '<td class="center">'.$langs->trans("SellingPrice").'</td>';
|
||||
|
||||
|
||||
print '<td class="center">'.$langs->trans("MinPrice").'</td>';
|
||||
|
||||
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) {
|
||||
@ -1236,9 +1239,9 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
print '</tr></thead>';
|
||||
|
||||
print '<tbody>';
|
||||
|
||||
|
||||
$var = false;
|
||||
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
@ -1291,11 +1294,11 @@ if ($action == 'edit_price' && $object->getRights()->creer)
|
||||
}
|
||||
|
||||
print '</tbody>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div style="text-align: center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
@ -1321,48 +1324,48 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql .= " AND p.price_level = " . $soc->price_level;
|
||||
$sql .= " ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC";
|
||||
// $sql .= $db->plimit();
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
|
||||
if (! $num)
|
||||
{
|
||||
$db->free($result);
|
||||
|
||||
|
||||
// Il doit au moins y avoir la ligne de prix initial.
|
||||
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
|
||||
$object->updatePrice($object->price, $object->price_base_type, $user, $newprice_min);
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
}
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
// Default prices or
|
||||
// Log of previous customer prices
|
||||
$backbutton='<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("Back") . '</a>';
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"), 0, $_SERVER["PHP_SELF"], '', '', '', $backbutton, $num, $num, 'title_accountancy.png');
|
||||
else print_barre_liste($langs->trans("PriceByCustomerLog"), 0, $_SERVER["PHP_SELF"], '', '', '', '', $num, $num, 'title_accountancy.png');
|
||||
//if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print_barre_liste($langs->trans("DefaultPrice"),'','','','','',$backbutton, 0, 0, 'title_accountancy.png');
|
||||
//else print_barre_liste($langs->trans("PriceByCustomerLog"),'','','','','','', 0, 0, 'title_accountancy.png');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans("AppliedPricesFrom") . '</td>';
|
||||
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
print '<td align="center">' . $langs->trans("PriceLevel") . '</td>';
|
||||
}
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) {
|
||||
print '<td align="center">' . $langs->trans("Type") . '</td>';
|
||||
}
|
||||
|
||||
|
||||
print '<td align="center">' . $langs->trans("PriceBase") . '</td>';
|
||||
print $conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL;
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td align="right">' . $langs->trans("VATRate") . '</td>';
|
||||
@ -1377,9 +1380,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
if ($user->rights->produit->supprimer)
|
||||
print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$notfirstlineforlevel=array();
|
||||
|
||||
|
||||
$var = True;
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
@ -1389,7 +1392,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
print '<tr '. $bc[$var].'>';
|
||||
// Date
|
||||
print "<td>" . dol_print_date($db->jdate($objp->dp), "dayhour") . "</td>";
|
||||
|
||||
|
||||
// Price level
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
print '<td align="center">' . $objp->price_level . "</td>";
|
||||
@ -1400,9 +1403,9 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
$type = ($objp->price_by_qty == 1) ? 'PriceByQuantity' : 'Standard';
|
||||
print '<td align="center">' . $langs->trans($type) . "</td>";
|
||||
}
|
||||
|
||||
|
||||
print '<td align="center">' . $langs->trans($objp->price_base_type) . "</td>";
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
print '<td align="right">';
|
||||
if ($objp->default_vat_code)
|
||||
@ -1412,7 +1415,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
else print vatrate($objp->tva_tx, true, $objp->recuperableonly);
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
|
||||
// Price
|
||||
if (! empty($objp->fk_price_expression) && ! empty($conf->dynamicprices->enabled))
|
||||
{
|
||||
@ -1433,23 +1436,23 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
}
|
||||
print '<td align="right">' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . '</td>';
|
||||
print '<td align="right">' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . '</td>';
|
||||
|
||||
|
||||
// User
|
||||
print '<td align="right"><a href="' . DOL_URL_ROOT . '/user/card.php?id=' . $objp->user_id . '">' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . '</a></td>';
|
||||
|
||||
|
||||
// Action
|
||||
if ($user->rights->produit->supprimer)
|
||||
{
|
||||
$candelete=0;
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if (empty($notfirstlineforlevel[$objp->price_level])) $notfirstlineforlevel[$objp->price_level]=1;
|
||||
else $candelete=1;
|
||||
}
|
||||
elseif ($i > 0) $candelete=1;
|
||||
|
||||
|
||||
print '<td align="right">';
|
||||
if ($candelete)
|
||||
if ($candelete)
|
||||
{
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $object->id . '&lineid=' . $objp->rowid . '">';
|
||||
print img_delete();
|
||||
@ -1458,11 +1461,11 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_
|
||||
print ' '; // Can not delete last price (it's current price)
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$db->free($result);
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
@ -1511,9 +1514,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="add_customer_price_confirm">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">' . $langs->trans('ThirdParty') . '</td>';
|
||||
@ -1575,7 +1578,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
@ -1612,7 +1615,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">';
|
||||
print $form->load_tva("tva_tx", $prodcustprice->default_vat_code ? $prodcustprice->tva_tx.' ('.$prodcustprice->default_vat_code.')' : $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Price base
|
||||
print '<tr><td width="15%">';
|
||||
print $langs->trans('PriceBase');
|
||||
@ -1689,12 +1692,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
|
||||
$staticsoc = new Societe($db);
|
||||
$staticsoc->fetch(GETPOST('socid', 'int'));
|
||||
|
||||
|
||||
$title=$langs->trans('PriceByCustomerLog');
|
||||
$title.=' - '.$staticsoc->getNomUrl(1);
|
||||
|
||||
$backbutton='<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("Back") . '</a>';
|
||||
|
||||
|
||||
print_barre_liste($title, $page, $_SERVEUR['PHP_SELF'], $option, $sortfield, $sortorder, $backbutton, count($prodcustprice->lines), $nbtotalofrecords, 'title_accountancy.png');
|
||||
|
||||
if (count($prodcustprice->lines) > 0)
|
||||
@ -1732,7 +1735,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
|
||||
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
|
||||
|
||||
|
||||
print '<td align="center">' . $langs->trans($line->price_base_type) . "</td>";
|
||||
print '<td align="right">' . vatrate($tva_tx, true, $line->recuperableonly) . "</td>";
|
||||
print '<td align="right">' . price($line->price) . "</td>";
|
||||
@ -1756,7 +1759,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// List of all prices by customers
|
||||
print '<!-- list of prices per customer -->'."\n";
|
||||
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
@ -1802,15 +1805,15 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
$var = False;
|
||||
|
||||
|
||||
|
||||
|
||||
// Line for default price
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<td>" . $langs->trans("Default") . "</td>";
|
||||
print "<td>" . "</td>";
|
||||
|
||||
|
||||
print '<td align="center">' . $langs->trans($object->price_base_type) . "</td>";
|
||||
print '<td align="right">' . vatrate($object->tva_tx, true, $object->recuperableonly) . "</td>";
|
||||
print '<td align="right">' . price($object->price) . "</td>";
|
||||
@ -1834,21 +1837,21 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
if (count($prodcustprice->lines) > 0)
|
||||
{
|
||||
$var = false;
|
||||
foreach ($prodcustprice->lines as $line)
|
||||
{
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
// Date
|
||||
$staticsoc = new Societe($db);
|
||||
$staticsoc->fetch($line->fk_soc);
|
||||
|
||||
$tva_tx = $line->default_vat_code ? $line->tva_tx.' ('.$line->default_vat_code.')' : $line->tva_tx;
|
||||
|
||||
|
||||
print "<td>" . $staticsoc->getNomUrl(1) . "</td>";
|
||||
print "<td>" . dol_print_date($line->datec, "dayhour") . "</td>";
|
||||
|
||||
|
||||
@ -124,8 +124,11 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
dol_fiche_head($head, 'stats', $titre, 0, $picto);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 1);
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
@ -323,15 +326,15 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
foreach($graphfiles as $key => $val)
|
||||
{
|
||||
if (! $graphfiles[$key]['file']) continue;
|
||||
|
||||
|
||||
if ($graphfiles == 'propal' && ! $user->rights->propale->lire) continue;
|
||||
if ($graphfiles == 'order' && ! $user->rights->commande->lire) continue;
|
||||
if ($graphfiles == 'invoices' && ! $user->rights->facture->lire) continue;
|
||||
if ($graphfiles == 'proposals_suppliers' && ! $user->rights->supplier_proposal->lire) continue;
|
||||
if ($graphfiles == 'invoices_suppliers' && ! $user->rights->fournisseur->facture->lire) continue;
|
||||
if ($graphfiles == 'orders_suppliers' && ! $user->rights->fournisseur->commande->lire) continue;
|
||||
|
||||
|
||||
|
||||
|
||||
if ($i % 2 == 0)
|
||||
{
|
||||
print "\n".'<div class="fichecenter"><div class="fichehalfleft">'."\n";
|
||||
@ -340,7 +343,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
{
|
||||
print "\n".'<div class="fichehalfright"><div class="ficheaddleft">'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Date generation
|
||||
if ($graphfiles[$key]['output'] && ! $px->isGraphKo())
|
||||
{
|
||||
@ -352,7 +355,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
print $dategenerated=($mesg?'<font class="error">'.$mesg.'</font>':$langs->trans("ChartNotGenerated"));
|
||||
}
|
||||
$linktoregenerate='<a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).((string) $type != ''?'&type='.$type:'').'&action=recalcul&mode='.$mode.'">'.img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')','refresh').'</a>';
|
||||
|
||||
|
||||
// Show graph
|
||||
print '<table class="noborder" width="100%">';
|
||||
// Label
|
||||
@ -366,7 +369,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
print $graphfiles[$key]['output'];
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
if ($i % 2 == 0)
|
||||
{
|
||||
print "\n".'</div>'."\n";
|
||||
@ -376,7 +379,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
print "\n".'</div></div></div>';
|
||||
print '<div class="clear"><div class="fichecenter"><br></div></div>'."\n";
|
||||
}
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
$object = $product;
|
||||
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -100,11 +100,14 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
@ -114,9 +117,9 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
if ($user->rights->commande->lire)
|
||||
{
|
||||
|
||||
@ -88,7 +88,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
$object = $product;
|
||||
|
||||
|
||||
$parameters = array ('id' => $id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0)
|
||||
@ -96,7 +96,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
|
||||
llxHeader("", "", $langs->trans("CardProduct" . $product->type));
|
||||
|
||||
if ($result > 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
$head = product_prepare_head($product);
|
||||
$titre = $langs->trans("CardProduct" . $product->type);
|
||||
@ -108,11 +108,14 @@ if ($id > 0 || ! empty($ref)) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
@ -122,9 +125,9 @@ if ($id > 0 || ! empty($ref)) {
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
if ($user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
|
||||
@ -72,7 +72,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
$object = $product;
|
||||
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -90,11 +90,14 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
@ -104,9 +107,9 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
@ -141,7 +144,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&search_month=' . $search_month;
|
||||
if (! empty($search_year))
|
||||
$option .= '&search_year=' . $search_year;
|
||||
|
||||
|
||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
|
||||
@ -151,7 +154,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<input type="hidden" name="page" value="' . $page . '"/>';
|
||||
$option .= '&page=' . $page;
|
||||
}
|
||||
|
||||
|
||||
print_barre_liste($langs->trans("Contrats"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,'');
|
||||
|
||||
$i = 0;
|
||||
@ -197,7 +200,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
@ -83,9 +83,9 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
|
||||
$object = $product;
|
||||
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -117,11 +117,14 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
@ -131,14 +134,14 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
if ($showmessage && $nboflines > 1)
|
||||
{
|
||||
print $langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers"));
|
||||
}
|
||||
elseif ($user->rights->facture->lire)
|
||||
elseif ($user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
|
||||
$sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,";
|
||||
@ -164,13 +167,13 @@ if ($id > 0 || ! empty($ref))
|
||||
$total_ht=0;
|
||||
$total_qty=0;
|
||||
$totalrecords=0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
if ($result)
|
||||
{
|
||||
$totalrecords = $db->num_rows($result);
|
||||
while ($objp = $db->fetch_object($result))
|
||||
while ($objp = $db->fetch_object($result))
|
||||
{
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
|
||||
@ -84,7 +84,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
$object = $product;
|
||||
|
||||
|
||||
$parameters = array('id' => $id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -102,11 +102,14 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
@ -116,9 +119,9 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
|
||||
@ -82,7 +82,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
$object = $product;
|
||||
|
||||
|
||||
$parameters = array ('id' => $id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -100,11 +100,14 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
@ -114,11 +117,11 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($user->rights->propale->lire)
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($user->rights->propale->lire)
|
||||
{
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,";
|
||||
$sql .= " p.ref_client,";
|
||||
@ -239,7 +242,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
print '<td colspan="2"></td>';
|
||||
|
||||
@ -100,7 +100,7 @@ if ($action == 'add' && $user->rights->stock->creer)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorWarehouseRefRequired"), null, 'errors');
|
||||
$action="create"; // Force retour sur page creation
|
||||
@ -194,7 +194,7 @@ if ($action == 'create')
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input name="libelle" size="20" value=""></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("LocationSummary").'</td><td><input name="lieu" size="40" value="'.(!empty($object->lieu)?$object->lieu:'').'"></td></tr>';
|
||||
|
||||
|
||||
// Parent entrepot
|
||||
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
|
||||
print $formproduct->selectWarehouses('', 'fk_parent', '', 1);
|
||||
@ -276,7 +276,7 @@ else
|
||||
dol_fiche_head($head, 'card', $langs->trans("Warehouse"), 0, 'stock');
|
||||
|
||||
$formconfirm = '';
|
||||
|
||||
|
||||
// Confirm delete third party
|
||||
if ($action == 'delete')
|
||||
{
|
||||
@ -300,7 +300,10 @@ else
|
||||
$morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu;
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref);
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
@ -315,7 +318,7 @@ else
|
||||
print '<tr><td>'.$langs->trans("ParentWarehouse").'</td><td>';
|
||||
print $e->getNomUrl(3);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Description
|
||||
|
||||
@ -54,9 +54,12 @@ $morehtmlref='<div class="refidno">';
|
||||
$morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu;
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref);
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref);
|
||||
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ $arrayfields=array(
|
||||
//'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
|
||||
);
|
||||
|
||||
$object = new MouvementStock($db); // To be passed as parameter of executeHooks that need
|
||||
$object = new MouvementStock($db); // To be passed as parameter of executeHooks that need
|
||||
|
||||
|
||||
/*
|
||||
@ -164,7 +164,7 @@ if ($action == "correct_stock")
|
||||
//$sellby=GETPOST('sellby');
|
||||
$eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
|
||||
$sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
|
||||
|
||||
|
||||
$result=$product->correct_stock_batch(
|
||||
$user,
|
||||
$id,
|
||||
@ -210,7 +210,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
{
|
||||
$product = new Product($db);
|
||||
if (! empty($product_id)) $result=$product->fetch($product_id);
|
||||
|
||||
|
||||
if (! (GETPOST("id_entrepot_destination",'int') > 0))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
|
||||
@ -264,7 +264,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
$pricesrc=0;
|
||||
if (isset($product->pmp)) $pricesrc=$product->pmp;
|
||||
$pricedest=$pricesrc;
|
||||
|
||||
|
||||
if ($product->hasbatch())
|
||||
{
|
||||
$pdluo = new Productbatch($db);
|
||||
@ -488,8 +488,8 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
|
||||
|
||||
|
||||
$i = 0;
|
||||
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
$texte = $langs->trans("ListOfStockMovements");
|
||||
@ -505,20 +505,23 @@ if ($resql)
|
||||
|
||||
dol_fiche_head($head, 'movements', $langs->trans("Warehouse"), 0, 'stock');
|
||||
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
$morehtmlref.=$langs->trans("LocationSummary").' : '.$object->lieu;
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'libelle', $morehtmlref);
|
||||
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'libelle', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Description
|
||||
@ -539,14 +542,14 @@ if ($resql)
|
||||
print "</td></tr>";
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
|
||||
// Value
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';
|
||||
print price((empty($calcproducts['qty'])?'0':price2num($calcproducts['qty'],'MT')), 0, $langs, 0, -1, -1, $conf->currency);
|
||||
@ -583,9 +586,9 @@ if ($resql)
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
@ -628,10 +631,10 @@ if ($resql)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=transfert">'.$langs->trans("StockTransfer").'</a>';
|
||||
}
|
||||
|
||||
|
||||
print '</div><br>';
|
||||
}
|
||||
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
@ -662,7 +665,7 @@ if ($resql)
|
||||
//if ($user->rights->stock->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -673,23 +676,23 @@ if ($resql)
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
|
||||
if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
|
||||
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@ -699,10 +702,10 @@ if ($resql)
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder);
|
||||
@ -720,9 +723,9 @@ if ($resql)
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
@ -740,14 +743,14 @@ if ($resql)
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['m.rowid']['checked']))
|
||||
if (! empty($arrayfields['m.rowid']['checked']))
|
||||
{
|
||||
// Ref
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat maxwidth25" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['m.datem']['checked']))
|
||||
if (! empty($arrayfields['m.datem']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" valign="right">';
|
||||
print '<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans("Month")).'" name="month" value="'.$month.'">';
|
||||
@ -758,14 +761,14 @@ if ($resql)
|
||||
//print $formother->selectyear($syear,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
// Product Ref
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="search_product_ref" value="'.dol_escape_htmltag($idproduct?$product->ref:$search_product_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.label']['checked']))
|
||||
if (! empty($arrayfields['p.label']['checked']))
|
||||
{
|
||||
// Product label
|
||||
print '<td class="liste_titre" align="left">';
|
||||
@ -773,14 +776,14 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Batch
|
||||
if (! empty($arrayfields['m.batch']['checked']))
|
||||
if (! empty($arrayfields['m.batch']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center"><input class="flat" type="text" size="5" name="search_batch" value="'.dol_escape_htmltag($search_batch).'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['pl.eatby']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '</td>';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['pl.sellby']['checked']))
|
||||
{
|
||||
@ -788,42 +791,42 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Warehouse
|
||||
if (! empty($arrayfields['e.label']['checked']))
|
||||
if (! empty($arrayfields['e.label']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="left">';
|
||||
//print '<input class="flat" type="text" size="8" name="search_warehouse" value="'.($search_warehouse).'">';
|
||||
print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['m.fk_user_author']['checked']))
|
||||
if (! empty($arrayfields['m.fk_user_author']['checked']))
|
||||
{
|
||||
// Author
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="6" name="search_user" value="'.dol_escape_htmltag($search_user).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['m.inventorycode']['checked']))
|
||||
if (! empty($arrayfields['m.inventorycode']['checked']))
|
||||
{
|
||||
// Inventory code
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_inventorycode" value="'.dol_escape_htmltag($search_inventorycode).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['m.label']['checked']))
|
||||
if (! empty($arrayfields['m.label']['checked']))
|
||||
{
|
||||
// Label of movement
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="8" name="search_movement" value="'.dol_escape_htmltag($search_movement).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['origin']['checked']))
|
||||
if (! empty($arrayfields['origin']['checked']))
|
||||
{
|
||||
// Origin of movement
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['m.value']['checked']))
|
||||
if (! empty($arrayfields['m.value']['checked']))
|
||||
{
|
||||
// Qty
|
||||
print '<td class="liste_titre" align="right">';
|
||||
@ -869,7 +872,7 @@ if ($resql)
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Actions
|
||||
// Actions
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
@ -892,11 +895,11 @@ if ($resql)
|
||||
$productlot->batch= $objp->batch;
|
||||
$productlot->eatby= $objp->eatby;
|
||||
$productlot->sellby= $objp->sellby;
|
||||
|
||||
|
||||
$warehousestatic->id=$objp->entrepot_id;
|
||||
$warehousestatic->libelle=$objp->stock;
|
||||
$warehousestatic->lieu=$objp->lieu;
|
||||
|
||||
|
||||
$arrayofuniqueproduct[$objp->rowid]=$objp->produit;
|
||||
if(!empty($objp->fk_origin)) {
|
||||
$origin = $movement->get_origin($objp->fk_origin, $objp->origintype);
|
||||
@ -998,7 +1001,7 @@ if ($resql)
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
@ -1012,7 +1015,7 @@ if ($resql)
|
||||
if (count($arrayofuniqueproduct) == 1 && is_numeric($year))
|
||||
{
|
||||
print "<br>";
|
||||
|
||||
|
||||
$productidselected=0;
|
||||
foreach ($arrayofuniqueproduct as $key => $val)
|
||||
{
|
||||
|
||||
@ -106,10 +106,10 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if($action == 'addlimitstockwarehouse') {
|
||||
|
||||
|
||||
$seuil_stock_alerte = GETPOST('seuil_stock_alerte');
|
||||
$desiredstock = GETPOST('desiredstock');
|
||||
|
||||
|
||||
$maj_ok = true;
|
||||
if($seuil_stock_alerte == '') {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("StockLimit")), null, 'errors');
|
||||
@ -119,44 +119,44 @@ if($action == 'addlimitstockwarehouse') {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DesiredStock")), null, 'errors');
|
||||
$maj_ok = false;
|
||||
}
|
||||
|
||||
|
||||
if($maj_ok) {
|
||||
|
||||
|
||||
$pse = new ProductStockEntrepot($db);
|
||||
if($pse->fetch('', GETPOST('id'), GETPOST('fk_entrepot')) > 0) {
|
||||
|
||||
|
||||
// Update
|
||||
$pse->seuil_stock_alerte = $seuil_stock_alerte;
|
||||
$pse->desiredstock = $desiredstock;
|
||||
if($pse->update($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseUpdated'));
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
// Create
|
||||
$pse->fk_entrepot = GETPOST('fk_entrepot');
|
||||
$pse->fk_product = GETPOST('id');
|
||||
$pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
|
||||
$pse->desiredstock = GETPOST('desiredstock');
|
||||
if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id'));
|
||||
exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($action == 'delete_productstockwarehouse')
|
||||
{
|
||||
|
||||
|
||||
$pse = new ProductStockEntrepot($db);
|
||||
$pse->fetch(GETPOST('fk_productstockwarehouse'));
|
||||
if($pse->delete($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseDeleted'));
|
||||
|
||||
|
||||
$action = '';
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Set stock limit
|
||||
@ -299,7 +299,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
{
|
||||
$object = new Product($db);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
|
||||
if ($object->hasbatch() && ! $batchnumber)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors');
|
||||
@ -307,7 +307,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
$action='transfert';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($id)
|
||||
@ -323,7 +323,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
$pricesrc=0;
|
||||
if (isset($object->pmp)) $pricesrc=$object->pmp;
|
||||
$pricedest=$pricesrc;
|
||||
|
||||
|
||||
if ($object->hasbatch())
|
||||
{
|
||||
$pdluo = new Productbatch($db);
|
||||
@ -496,7 +496,7 @@ if ($id > 0 || $ref)
|
||||
{
|
||||
$object = new Product($db);
|
||||
$result = $object->fetch($id,$ref);
|
||||
|
||||
|
||||
$object->load_stock();
|
||||
|
||||
$title = $langs->trans('ProductServiceCard');
|
||||
@ -525,15 +525,18 @@ if ($id > 0 || $ref)
|
||||
dol_htmloutput_events();
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('stock', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
if ($conf->productbatch->enabled)
|
||||
|
||||
if ($conf->productbatch->enabled)
|
||||
{
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ManageLotSerial").'</td><td>';
|
||||
print $object->getLibStatut(0,2);
|
||||
@ -595,11 +598,11 @@ if ($id > 0 || $ref)
|
||||
print '<tr><td>'.$form->editfieldkey("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Hook formObject
|
||||
$parameters=array('colspan' => 3);
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
|
||||
// Desired stock
|
||||
print '<tr><td>'.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1),'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer);
|
||||
print '</td><td colspan="2">';
|
||||
@ -623,7 +626,7 @@ if ($id > 0 || $ref)
|
||||
print '</tr>';
|
||||
|
||||
$stocktheo = price2num($object->stock_theorique, 'MS');
|
||||
|
||||
|
||||
// Calculating a theorical value
|
||||
print '<tr><td>'.$langs->trans("VirtualStock").'</td>';
|
||||
print "<td>".(empty($stocktheo)?0:$stocktheo);
|
||||
@ -705,7 +708,7 @@ if ($id > 0 || $ref)
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
@ -744,18 +747,18 @@ if (empty($reshook))
|
||||
if (empty($action) && $object->id)
|
||||
{
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
|
||||
|
||||
if ($user->rights->stock->mouvement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=correction">'.$langs->trans("StockCorrection").'</a>';
|
||||
}
|
||||
|
||||
|
||||
//if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch())
|
||||
if ($user->rights->stock->mouvement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=transfert">'.$langs->trans("StockTransfer").'</a>';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -907,30 +910,30 @@ print "</table>";
|
||||
print '</div>';
|
||||
|
||||
if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
|
||||
|
||||
|
||||
print '<br><br>';
|
||||
print_titre($langs->trans('AddNewProductStockWarehouse'));
|
||||
//print '<br />';
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="action" value="addlimitstockwarehouse">';
|
||||
print '<input type="hidden" name="id" value="'.GETPOST('id').'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
print '<tr class="liste_titre"><td width="40%" colspan="4">'.$formproduct->selectWarehouses('', 'fk_entrepot').'</td>';
|
||||
print '<td align="right"><input name="seuil_stock_alerte" type="text" placeholder="'.$langs->trans("StockLimit").'" /></td>';
|
||||
print '<td align="right"><input name="desiredstock" type="text" placeholder="'.$langs->trans("DesiredStock").'" /></td>';
|
||||
print '<td align="right"><input type="submit" value="'.$langs->trans('Save').'" class="button" /></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$pse = new ProductStockEntrepot($db);
|
||||
$lines = $pse->fetchAll(GETPOST('id'));
|
||||
|
||||
|
||||
if(!empty($lines)) {
|
||||
|
||||
|
||||
$var=false;
|
||||
foreach($lines as $line) {
|
||||
|
||||
|
||||
$ent = new Entrepot($db);
|
||||
$ent->fetch($line['fk_entrepot']);
|
||||
print '<tr '.$bc[$var].'><td width="40%" colspan="4">'.$ent->getNomUrl(3).'</td>';
|
||||
@ -939,15 +942,15 @@ if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
|
||||
print '<td align="right"><a href="?id='.GETPOST('id').'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse">'.img_delete().'</a></td>';
|
||||
print '</tr>';
|
||||
$var=!$var;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -112,21 +112,21 @@ if (empty($reshook))
|
||||
$result = $object->setValueFrom('eatby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'setsellby' && $user->rights->stock->creer)
|
||||
{
|
||||
$newvalue=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
|
||||
$result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'update_extras')
|
||||
{
|
||||
// Fill array 'array_options' with data from update form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
@ -142,11 +142,11 @@ if (empty($reshook))
|
||||
} else if ($reshook < 0)
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if ($error)
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
|
||||
|
||||
// Action to add record
|
||||
if ($action == 'add')
|
||||
{
|
||||
@ -160,7 +160,7 @@ if (empty($reshook))
|
||||
$error=0;
|
||||
|
||||
/* object_prop_getpost_prop */
|
||||
|
||||
|
||||
$object->entity=GETPOST('entity','int');
|
||||
$object->fk_product=GETPOST('fk_product','int');
|
||||
$object->batch=GETPOST('batch','alpha');
|
||||
@ -204,7 +204,7 @@ if (empty($reshook))
|
||||
if ($action == 'update' && ! GETPOST('cancel'))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
$object->entity=GETPOST('entity','int');
|
||||
$object->fk_product=GETPOST('fk_product','int');
|
||||
$object->batch=GETPOST('batch','alpha');
|
||||
@ -283,7 +283,7 @@ if ($action == 'create')
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
// print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>';
|
||||
//
|
||||
//
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldentity").'</td><td><input class="flat" type="text" name="entity" value="'.GETPOST('entity').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldfk_product").'</td><td><input class="flat" type="text" name="fk_product" value="'.GETPOST('fk_product').'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Fieldbatch").'</td><td><input class="flat" type="text" name="batch" value="'.GETPOST('batch').'"></td></tr>';
|
||||
@ -305,28 +305,31 @@ if ($action == 'create')
|
||||
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
|
||||
{
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
|
||||
|
||||
//print load_fiche_titre($langs->trans("Batch"));
|
||||
|
||||
|
||||
$head = productlot_prepare_head($object);
|
||||
dol_fiche_head($head, 'card', $langs->trans("Batch"), 0, 'barcode');
|
||||
|
||||
|
||||
|
||||
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/product/stock/productlot_list.php' . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'batch');
|
||||
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('batch', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
|
||||
// Product
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Product").'</td><td>';
|
||||
$producttmp = new Product($db);
|
||||
@ -341,7 +344,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Sell by
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
@ -349,15 +352,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -381,8 +384,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
*/
|
||||
}
|
||||
print '</div>'."\n";
|
||||
|
||||
|
||||
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/reassortlot.php?sref='.urlencode($producttmp->ref).'&search_batch='.urlencode($object->batch).'">'.$langs->trans("ShowCurrentStockOfLot").'</a><br>';
|
||||
print '<br>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?search_product_ref='.urlencode($producttmp->ref).'&search_batch='.urlencode($object->batch).'">'.$langs->trans("ShowLogOfMovementIfLot").'</a><br>';
|
||||
|
||||
@ -202,7 +202,10 @@ dol_fiche_head($head, 'translation', $titre, 0, $picto);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', '', '', 0, '', '', 1);
|
||||
$shownav = 1;
|
||||
if ($user->societe_id && ! in_array('product', explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, shownav, 'ref');
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -245,7 +248,7 @@ if ($action == 'edit')
|
||||
{
|
||||
$s=picto_from_langcode($key);
|
||||
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', '')."</a><br>";
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||
@ -275,7 +278,7 @@ if ($action == 'edit')
|
||||
else if ($action != 'add')
|
||||
{
|
||||
if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
if (! empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user