Use new banner for other tabs of product
This commit is contained in:
parent
439e4a483d
commit
c0872d690e
@ -82,28 +82,13 @@ if ($id > 0 || ! empty($ref))
|
||||
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'margin', $titre, 0, $picto);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr>';
|
||||
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Libelle
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
|
||||
print $object->getLibStatut(2,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to buy)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
|
||||
print $object->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Total Margin
|
||||
print '<tr><td>'.$langs->trans("TotalMargin").'</td><td colspan="3">';
|
||||
@ -125,7 +110,11 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($user->rights->facture->lire) {
|
||||
|
||||
@ -73,21 +73,21 @@ if ($socid > 0)
|
||||
|
||||
dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
|
||||
}
|
||||
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Alias names (commercial, trademark or alias names)
|
||||
print '<tr><td class="titlefield">'.$langs->trans('AliasNames').'</td><td>';
|
||||
print $object->name_alias;
|
||||
print "</td></tr>";
|
||||
|
||||
if ($object->client)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('CustomerCode').'</td><td colspan="3">';
|
||||
print $object->code_client;
|
||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
@ -96,7 +96,7 @@ if ($socid > 0)
|
||||
|
||||
if ($object->fournisseur)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $object->code_fournisseur;
|
||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
@ -104,7 +104,7 @@ if ($socid > 0)
|
||||
}
|
||||
|
||||
// Total Margin
|
||||
print '<tr><td>'.$langs->trans("TotalMargin").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="3">';
|
||||
print '<span id="totalMargin"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
|
||||
@ -123,7 +123,11 @@ if ($socid > 0)
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";
|
||||
|
||||
@ -195,33 +195,21 @@ if ($object->id)
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr>';
|
||||
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||
print $object->getLibStatut(2,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to buy)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||
print $object->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'produit';
|
||||
$permission = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
|
||||
|
||||
@ -264,21 +264,15 @@ if ($id > 0 || $ref)
|
||||
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'suppliers', $titre, 0, $picto);
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr>';
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||
print $form->showrefnav($object,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->label.'</td></tr>';
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Minimum Price
|
||||
print '<tr><td>'.$langs->trans("BuyingPriceMin").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("BuyingPriceMin").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$product_fourn = new ProductFournisseur($db);
|
||||
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0)
|
||||
@ -288,14 +282,13 @@ if ($id > 0 || $ref)
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to buy)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||
print $object->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print "</div>\n";
|
||||
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))
|
||||
|
||||
@ -402,34 +402,13 @@ $titre = $langs->trans("CardProduct" . $object->type);
|
||||
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||
dol_fiche_head($head, 'price', $titre, 0, $picto);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
// Ref
|
||||
print '<tr>';
|
||||
print '<td width="20%">' . $langs->trans("Ref") . '</td><td colspan="2">';
|
||||
print $form->showrefnav($object, 'ref', '', 1, 'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>' . $langs->trans("Label") . '</td><td colspan="2">' . $object->label . '</td>';
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
$isphoto = $object->is_photo_available($conf->product->multidir_output [$object->entity]);
|
||||
|
||||
$nblignes = 5;
|
||||
if ($isphoto) {
|
||||
// Photo
|
||||
print '<td valign="middle" align="center" width="30%" rowspan="' . $nblignes . '">';
|
||||
print $object->show_photos($conf->product->multidir_output [$object->entity], 1, 1, 0, 0, 0, 80);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')</td><td colspan="2">';
|
||||
print $object->getLibStatut(2, 0);
|
||||
print '</td></tr>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// MultiPrix
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
@ -442,7 +421,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
$soc->fetch($socid);
|
||||
|
||||
// Selling price
|
||||
print '<tr>' . $langs->trans("SellingPrice") . '</td>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("SellingPrice") . '</td>';
|
||||
print '<td colspan="2">';
|
||||
if ($object->multiprices_base_type["$soc->price_level"] == 'TTC') {
|
||||
print price($object->multiprices_ttc["$soc->price_level"]);
|
||||
@ -483,12 +462,12 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||
{
|
||||
// We show only vat for level 1
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx [1], true) . '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre"><td style="text-align: center">'.$langs->trans("PriceLevel").'</td><td style="text-align: center">'.$langs->trans("SellingPrice").'</td><td style="text-align: center">'.$langs->trans("MinPrice").'</td></tr>';
|
||||
@ -605,7 +584,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
else
|
||||
{
|
||||
// TVA
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("VATRate") . '</td><td>' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '</td></tr>';
|
||||
|
||||
// Price
|
||||
print '<tr><td>' . $langs->trans("SellingPrice") . '</td><td>';
|
||||
@ -703,6 +682,10 @@ else
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
@ -72,24 +72,24 @@ if ($cancel) $action='';
|
||||
// Set stock limit
|
||||
if ($action == 'setstocklimit')
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
$product->seuil_stock_alerte=$stocklimit;
|
||||
$result=$product->update($product->id,$user,0,'update');
|
||||
$object = new Product($db);
|
||||
$result=$object->fetch($id);
|
||||
$object->seuil_stock_alerte=$stocklimit;
|
||||
$result=$object->update($object->id,$user,0,'update');
|
||||
if ($result < 0)
|
||||
setEventMessage($product->error, 'errors');
|
||||
setEventMessage($object->error, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Set desired stock
|
||||
if ($action == 'setdesiredstock')
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
$product->desiredstock=$desiredstock;
|
||||
$result=$product->update($product->id,$user,0,'update');
|
||||
$object = new Product($db);
|
||||
$result=$object->fetch($id);
|
||||
$object->desiredstock=$desiredstock;
|
||||
$result=$object->update($object->id,$user,0,'update');
|
||||
if ($result < 0)
|
||||
setEventMessage($product->error, 'errors');
|
||||
setEventMessage($object->error, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
@ -112,10 +112,10 @@ if ($action == "correct_stock" && ! $cancel)
|
||||
|
||||
if (! empty($conf->productbatch->enabled))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
$object = new Product($db);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
if ($product->hasbatch() && (! GETPOST("sellby")) && (! GETPOST("eatby")) && (! GETPOST("batch_number"))) {
|
||||
if ($object->hasbatch() && (! GETPOST("sellby")) && (! GETPOST("eatby")) && (! GETPOST("batch_number"))) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("atleast1batchfield")), null, 'errors');
|
||||
$error++;
|
||||
$action='correction';
|
||||
@ -127,13 +127,13 @@ if ($action == "correct_stock" && ! $cancel)
|
||||
$priceunit=price2num(GETPOST("unitprice"));
|
||||
if (is_numeric(GETPOST("nbpiece")) && $id)
|
||||
{
|
||||
if (empty($product)) {
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
if (empty($object)) {
|
||||
$object = new Product($db);
|
||||
$result=$object->fetch($id);
|
||||
}
|
||||
if ($product->hasbatch())
|
||||
if ($object->hasbatch())
|
||||
{
|
||||
$result=$product->correct_stock_batch(
|
||||
$result=$object->correct_stock_batch(
|
||||
$user,
|
||||
GETPOST("id_entrepot"),
|
||||
GETPOST("nbpiece"),
|
||||
@ -148,7 +148,7 @@ if ($action == "correct_stock" && ! $cancel)
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$product->correct_stock(
|
||||
$result=$object->correct_stock(
|
||||
$user,
|
||||
GETPOST("id_entrepot"),
|
||||
GETPOST("nbpiece"),
|
||||
@ -168,13 +168,13 @@ if ($action == "correct_stock" && ! $cancel)
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($product->error,'errors');
|
||||
setEventMessage($object->error,'errors');
|
||||
$action='correction';
|
||||
}
|
||||
}
|
||||
@ -207,20 +207,20 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
{
|
||||
if ($id)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result=$product->fetch($id);
|
||||
$object = new Product($db);
|
||||
$result=$object->fetch($id);
|
||||
|
||||
$db->begin();
|
||||
|
||||
$product->load_stock(); // Load array product->stock_warehouse
|
||||
$object->load_stock(); // Load array product->stock_warehouse
|
||||
|
||||
// Define value of products moved
|
||||
$pricesrc=0;
|
||||
//if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp;
|
||||
if (isset($product->pmp)) $pricesrc=$product->pmp;
|
||||
//if (isset($object->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$object->stock_warehouse[GETPOST("id_entrepot_source")]->pmp;
|
||||
if (isset($object->pmp)) $pricesrc=$object->pmp;
|
||||
$pricedest=$pricesrc;
|
||||
|
||||
if ($product->hasbatch())
|
||||
if ($object->hasbatch())
|
||||
{
|
||||
$pdluo = new Productbatch($db);
|
||||
|
||||
@ -251,7 +251,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
if (! $error)
|
||||
{
|
||||
// Remove stock
|
||||
$result1=$product->correct_stock_batch(
|
||||
$result1=$object->correct_stock_batch(
|
||||
$user,
|
||||
$srcwarehouseid,
|
||||
GETPOST("nbpiece",'int'),
|
||||
@ -262,7 +262,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
GETPOST('inventorycode')
|
||||
);
|
||||
// Add stock
|
||||
$result2=$product->correct_stock_batch(
|
||||
$result2=$object->correct_stock_batch(
|
||||
$user,
|
||||
GETPOST("id_entrepot_destination",'int'),
|
||||
GETPOST("nbpiece",'int'),
|
||||
@ -277,7 +277,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
else
|
||||
{
|
||||
// Remove stock
|
||||
$result1=$product->correct_stock(
|
||||
$result1=$object->correct_stock(
|
||||
$user,
|
||||
GETPOST("id_entrepot_source"),
|
||||
GETPOST("nbpiece"),
|
||||
@ -288,7 +288,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
);
|
||||
|
||||
// Add stock
|
||||
$result2=$product->correct_stock(
|
||||
$result2=$object->correct_stock(
|
||||
$user,
|
||||
GETPOST("id_entrepot_destination"),
|
||||
GETPOST("nbpiece"),
|
||||
@ -309,13 +309,13 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: product.php?id=".$product->id);
|
||||
header("Location: product.php?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($product->error, $product->errors, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$db->rollback();
|
||||
$action='transfert';
|
||||
}
|
||||
@ -370,70 +370,45 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save'))
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formproduct=new FormProduct($db);
|
||||
|
||||
|
||||
if ($id > 0 || $ref)
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($id,$ref);
|
||||
$product->load_stock();
|
||||
$object = new Product($db);
|
||||
$result = $object->fetch($id,$ref);
|
||||
$object->load_stock();
|
||||
|
||||
$help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
llxHeader("",$langs->trans("CardProduct".$product->type),$help_url);
|
||||
llxHeader("",$langs->trans("CardProduct".$object->type),$help_url);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$head=product_prepare_head($product);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
$picto=($product->type==Product::TYPE_SERVICE?'service':'product');
|
||||
$head=product_prepare_head($object);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type==Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'stock', $titre, 0, $picto);
|
||||
|
||||
dol_htmloutput_events();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr>';
|
||||
print '<td width="30%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($product,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->label.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
print ajax_object_onoff($product, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
|
||||
} else {
|
||||
print $product->getLibStatut(2,0);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to buy)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="2">';
|
||||
if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
print ajax_object_onoff($product, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
|
||||
} else {
|
||||
print $product->getLibStatut(2,1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
if ($conf->productbatch->enabled) {
|
||||
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
|
||||
print $product->getLibStatut(0,2);
|
||||
print $object->getLibStatut(0,2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// PMP
|
||||
print '<tr><td>'.$langs->trans("AverageUnitPricePMP").'</td>';
|
||||
print '<td>';
|
||||
if ($product->pmp > 0) print price($product->pmp).' '.$langs->trans("HT");
|
||||
if ($object->pmp > 0) print price($object->pmp).' '.$langs->trans("HT");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -441,14 +416,13 @@ if ($id > 0 || $ref)
|
||||
print '<tr><td>'.$langs->trans("BuyingPriceMin").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$product_fourn = new ProductFournisseur($db);
|
||||
if ($product_fourn->find_min_price_product_fournisseur($product->id) > 0)
|
||||
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0)
|
||||
{
|
||||
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur();
|
||||
else print $langs->trans("NotDefined");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
$object = $product;
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
// Price
|
||||
@ -483,17 +457,17 @@ if ($id > 0 || $ref)
|
||||
}
|
||||
|
||||
// Stock alert threshold
|
||||
print '<tr><td>'.$form->editfieldkey("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer);
|
||||
print '<tr><td>'.$form->editfieldkey("StockLimit",'stocklimit',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("StockLimit",'stocklimit',$object->seuil_stock_alerte,$object,$user->rights->produit->creer);
|
||||
print '</td></tr>';
|
||||
|
||||
// Desired stock
|
||||
print '<tr><td>'.$form->editfieldkey("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer);
|
||||
print '<tr><td>'.$form->editfieldkey("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $form->editfieldval("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer);
|
||||
print '</td></tr>';
|
||||
|
||||
// Real stock
|
||||
$product->load_stock();
|
||||
$object->load_stock();
|
||||
$text_stock_options = '';
|
||||
$text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'<br>':'');
|
||||
$text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'<br>':'');
|
||||
@ -504,15 +478,15 @@ if ($id > 0 || $ref)
|
||||
print '<tr><td>';
|
||||
print $form->textwithtooltip($langs->trans("PhysicalStock"), $text_stock_options, 2, 1, img_picto('', 'info'), '', 2);
|
||||
print '</td>';
|
||||
print '<td>'.$product->stock_reel;
|
||||
if ($product->seuil_stock_alerte && ($product->stock_reel < $product->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit"));
|
||||
print '<td>'.$object->stock_reel;
|
||||
if ($object->seuil_stock_alerte && ($object->stock_reel < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Calculating a theorical value
|
||||
print '<tr><td>'.$langs->trans("VirtualStock").'</td>';
|
||||
print "<td>".(empty($product->stock_theorique)?0:$product->stock_theorique);
|
||||
if ($product->stock_theorique < $product->seuil_stock_alerte) {
|
||||
print "<td>".(empty($object->stock_theorique)?0:$object->stock_theorique);
|
||||
if ($object->stock_theorique < $object->seuil_stock_alerte) {
|
||||
print ' '.img_warning($langs->trans("StockLowerThanLimit"));
|
||||
}
|
||||
print '</td>';
|
||||
@ -528,36 +502,36 @@ if ($id > 0 || $ref)
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
if ($found) print '<br>'; else $found=1;
|
||||
print $langs->trans("ProductQtyInCustomersOrdersRunning").': '.$product->stats_commande['qty'];
|
||||
$result=$product->load_stats_commande(0,'0');
|
||||
if ($result < 0) dol_print_error($db,$product->error);
|
||||
print ' ('.$langs->trans("ProductQtyInDraft").': '.$product->stats_commande['qty'].')';
|
||||
print $langs->trans("ProductQtyInCustomersOrdersRunning").': '.$object->stats_commande['qty'];
|
||||
$result=$object->load_stats_commande(0,'0');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
print ' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')';
|
||||
}
|
||||
|
||||
// Number of product from customer order already sent (partial shipping)
|
||||
if (! empty($conf->expedition->enabled))
|
||||
{
|
||||
if ($found) print '<br>'; else $found=1;
|
||||
$result=$product->load_stats_sending(0,'2');
|
||||
print $langs->trans("ProductQtyInShipmentAlreadySent").': '.$product->stats_expedition['qty'];
|
||||
$result=$object->load_stats_sending(0,'2');
|
||||
print $langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty'];
|
||||
}
|
||||
|
||||
// Number of supplier order running
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
if ($found) print '<br>'; else $found=1;
|
||||
$result=$product->load_stats_commande_fournisseur(0,'3,4');
|
||||
print $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$product->stats_commande_fournisseur['qty'];
|
||||
$result=$product->load_stats_commande_fournisseur(0,'0,1,2');
|
||||
if ($result < 0) dol_print_error($db,$product->error);
|
||||
print ' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')';
|
||||
$result=$object->load_stats_commande_fournisseur(0,'3,4');
|
||||
print $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty'];
|
||||
$result=$object->load_stats_commande_fournisseur(0,'0,1,2');
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
print ' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')';
|
||||
}
|
||||
|
||||
// Number of product from supplier order already received (partial receipt)
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
if ($found) print '<br>'; else $found=1;
|
||||
print $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$product->stats_reception['qty'];
|
||||
print $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty'];
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
@ -565,7 +539,7 @@ if ($id > 0 || $ref)
|
||||
// Last movement
|
||||
$sql = "SELECT max(m.datem) as datem";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
|
||||
$sql.= " WHERE m.fk_product = '".$product->id."'";
|
||||
$sql.= " WHERE m.fk_product = '".$object->id."'";
|
||||
$resqlbis = $db->query($sql);
|
||||
if ($resqlbis)
|
||||
{
|
||||
@ -580,18 +554,21 @@ if ($id > 0 || $ref)
|
||||
if ($lastmovementdate)
|
||||
{
|
||||
print dol_print_date($lastmovementdate,'dayhour').' ';
|
||||
print '(<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product->id.'">'.$langs->trans("FullList").'</a>)';
|
||||
print '(<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$object->id.'">'.$langs->trans("FullList").'</a>)';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$product->id.'">'.$langs->trans("None").'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php?idproduct='.$object->id.'">'.$langs->trans("None").'</a>';
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Correct stock
|
||||
@ -618,7 +595,7 @@ if ($id > 0 || $ref)
|
||||
if ($_GET["action"] == "definir")
|
||||
{
|
||||
print load_fiche_titre($langs->trans("SetStock"));
|
||||
print "<form action=\"product.php?id=$product->id\" method=\"post\">\n";
|
||||
print "<form action=\"product.php?id=$object->id\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="create_stock">';
|
||||
print '<table class="border" width="100%"><tr>';
|
||||
@ -645,19 +622,19 @@ else
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
if (empty($action) && $product->id)
|
||||
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='.$product->id.'&action=correction">'.$langs->trans("StockCorrection").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=correction">'.$langs->trans("StockCorrection").'</a>';
|
||||
}
|
||||
|
||||
//if (($user->rights->stock->mouvement->creer) && ! $product->hasbatch())
|
||||
//if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch())
|
||||
if ($user->rights->stock->mouvement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'&action=transfert">'.$langs->trans("StockMovement").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=transfert">'.$langs->trans("StockMovement").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -678,7 +655,7 @@ print '<td align="right">'.$langs->trans("EstimatedStockValueShort").'</td>';
|
||||
print '<td align="right">'.$langs->trans("SellPriceMin").'</td>';
|
||||
print '<td align="right">'.$langs->trans("EstimatedStockValueSellShort").'</td>';
|
||||
print '</tr>';
|
||||
if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
|
||||
if ((! empty($conf->productbatch->enabled)) && $object->hasbatch())
|
||||
{
|
||||
print '<tr class="liste_titre"><td width="10%"></td>';
|
||||
print '<td align="right" width="10%">'.$langs->trans("batch_number").'</td>';
|
||||
@ -695,7 +672,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product";
|
||||
$sql.= " WHERE ps.reel != 0";
|
||||
$sql.= " AND ps.fk_entrepot = e.rowid";
|
||||
$sql.= " AND e.entity IN (".getEntity('stock', 1).")";
|
||||
$sql.= " AND ps.fk_product = ".$product->id;
|
||||
$sql.= " AND ps.fk_product = ".$object->id;
|
||||
$sql.= " ORDER BY e.label";
|
||||
|
||||
$entrepotstatic=new Entrepot($db);
|
||||
@ -718,25 +695,25 @@ if ($resql)
|
||||
print '<td colspan="4">'.$entrepotstatic->getNomUrl(1).'</td>';
|
||||
print '<td align="right">'.$obj->reel.($obj->reel<0?' '.img_warning():'').'</td>';
|
||||
// PMP
|
||||
print '<td align="right">'.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').'</td>';
|
||||
print '<td align="right">'.(price2num($object->pmp)?price2num($object->pmp,'MU'):'').'</td>';
|
||||
// Value purchase
|
||||
print '<td align="right">'.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').'</td>';
|
||||
print '<td align="right">'.(price2num($object->pmp)?price(price2num($object->pmp*$obj->reel,'MT')):'').'</td>';
|
||||
// Sell price
|
||||
print '<td align="right">';
|
||||
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1);
|
||||
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($object->price,'MU'),1);
|
||||
else print $langs->trans("Variable");
|
||||
print '</td>';
|
||||
// Value sell
|
||||
print '<td align="right">';
|
||||
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).'</td>';
|
||||
if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($object->price*$obj->reel,'MT'),1).'</td>';
|
||||
else print $langs->trans("Variable");
|
||||
print '</tr>'; ;
|
||||
$total += $obj->reel;
|
||||
if (price2num($product->pmp)) $totalwithpmp += $obj->reel;
|
||||
$totalvalue = $totalvalue + ($product->pmp*$obj->reel);
|
||||
$totalvaluesell = $totalvaluesell + ($product->price*$obj->reel);
|
||||
if (price2num($object->pmp)) $totalwithpmp += $obj->reel;
|
||||
$totalvalue = $totalvalue + ($object->pmp*$obj->reel);
|
||||
$totalvaluesell = $totalvaluesell + ($object->price*$obj->reel);
|
||||
//Batch Detail
|
||||
if ((! empty($conf->productbatch->enabled)) && $product->hasbatch())
|
||||
if ((! empty($conf->productbatch->enabled)) && $object->hasbatch())
|
||||
{
|
||||
$details=Productbatch::findAll($db,$obj->product_stock_id);
|
||||
if ($details<0) dol_print_error($db);
|
||||
@ -762,7 +739,7 @@ if ($resql)
|
||||
{
|
||||
print "\n".'<tr><td align="right">';
|
||||
print img_picto($langs->trans("Tranfer"),'uparrow','class="hideonsmartphone"').' ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'&action=transfert&pdluoid='.$pdluo->id.'">'.$langs->trans("StockMovement").'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=transfert&pdluoid='.$pdluo->id.'">'.$langs->trans("StockMovement").'</a>';
|
||||
// Disabled, because edition of stock content must use the "Correct stock menu".
|
||||
// Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ...
|
||||
//print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=editline&lineid='.$pdluo->id.'#'.$pdluo->id.'">';
|
||||
|
||||
@ -21,7 +21,9 @@
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
|
||||
<?php
|
||||
$langs->load("productbatch");
|
||||
if (! is_object($product)) $product=$object;
|
||||
|
||||
$langs->load("productbatch");
|
||||
|
||||
if (empty($id)) $id = $object->id;
|
||||
|
||||
|
||||
@ -21,7 +21,11 @@
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
|
||||
<?php
|
||||
$pdluoid=GETPOST('pdluoid','int');
|
||||
if (! is_object($product)) $product=$object;
|
||||
|
||||
$langs->load("productbatch");
|
||||
|
||||
$pdluoid=GETPOST('pdluoid','int');
|
||||
|
||||
$pdluo = new Productbatch($db);
|
||||
|
||||
|
||||
@ -58,9 +58,9 @@ if ($cancel == $langs->trans("Cancel"))
|
||||
|
||||
if ($action == 'delete' && GETPOST('langtodelete','alpha'))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($id);
|
||||
$product->delMultiLangs(GETPOST('langtodelete','alpha'));
|
||||
$object = new Product($db);
|
||||
$object->fetch($id);
|
||||
$object->delMultiLangs(GETPOST('langtodelete','alpha'));
|
||||
}
|
||||
|
||||
// Add translation
|
||||
@ -68,33 +68,33 @@ if ($action == 'vadd' &&
|
||||
$cancel != $langs->trans("Cancel") &&
|
||||
($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($id);
|
||||
$object = new Product($db);
|
||||
$object->fetch($id);
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
// update de l'objet
|
||||
if ( $_POST["forcelangprod"] == $current_lang )
|
||||
{
|
||||
$product->label = $_POST["libelle"];
|
||||
$product->description = dol_htmlcleanlastbr($_POST["desc"]);
|
||||
$product->note = dol_htmlcleanlastbr($_POST["note"]);
|
||||
$object->label = $_POST["libelle"];
|
||||
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
|
||||
$object->note = dol_htmlcleanlastbr($_POST["note"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$product->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
|
||||
$product->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
|
||||
$product->multilangs[$_POST["forcelangprod"]]["note"] = dol_htmlcleanlastbr($_POST["note"]);
|
||||
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
|
||||
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
|
||||
$object->multilangs[$_POST["forcelangprod"]]["note"] = dol_htmlcleanlastbr($_POST["note"]);
|
||||
}
|
||||
|
||||
// sauvegarde en base
|
||||
if ( $product->setMultiLangs() > 0 )
|
||||
if ( $object->setMultiLangs() > 0 )
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = 'add';
|
||||
setEventMessage($product->error,'errors');
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,34 +103,34 @@ if ($action == 'vedit' &&
|
||||
$cancel != $langs->trans("Cancel") &&
|
||||
($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($id);
|
||||
$object = new Product($db);
|
||||
$object->fetch($id);
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
foreach ( $product->multilangs as $key => $value ) // enregistrement des nouvelles valeurs dans l'objet
|
||||
foreach ( $object->multilangs as $key => $value ) // enregistrement des nouvelles valeurs dans l'objet
|
||||
{
|
||||
if ( $key == $current_lang )
|
||||
{
|
||||
$product->label = $_POST["libelle-".$key];
|
||||
$product->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
|
||||
$product->note = dol_htmlcleanlastbr($_POST["note-".$key]);
|
||||
$object->label = $_POST["libelle-".$key];
|
||||
$object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
|
||||
$object->note = dol_htmlcleanlastbr($_POST["note-".$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$product->multilangs[$key]["label"] = $_POST["libelle-".$key];
|
||||
$product->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
|
||||
$product->multilangs[$key]["note"] = dol_htmlcleanlastbr($_POST["note-".$key]);
|
||||
$object->multilangs[$key]["label"] = $_POST["libelle-".$key];
|
||||
$object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
|
||||
$object->multilangs[$key]["note"] = dol_htmlcleanlastbr($_POST["note-".$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if ( $product->setMultiLangs() > 0 )
|
||||
if ( $object->setMultiLangs() > 0 )
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = 'edit';
|
||||
setEventMessage($product->error,'errors');
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,24 +139,24 @@ if ($action == 'vdelete' &&
|
||||
$cancel != $langs->trans("Cancel") &&
|
||||
($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$product->fetch($id);
|
||||
$object = new Product($db);
|
||||
$object->fetch($id);
|
||||
$langtodelete=GETPOST('langdel','alpha');
|
||||
|
||||
|
||||
if ( $product->delMultiLangs($langtodelete) > 0 )
|
||||
if ( $object->delMultiLangs($langtodelete) > 0 )
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = 'edit';
|
||||
setEventMessage($product->error,'errors');
|
||||
setEventMessage($object->error,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($id,$ref);
|
||||
$object = new Product($db);
|
||||
$result = $object->fetch($id,$ref);
|
||||
|
||||
|
||||
/*
|
||||
@ -168,20 +168,10 @@ llxHeader("","",$langs->trans("Translation"));
|
||||
$form = new Form($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
|
||||
$head=product_prepare_head($product);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
$picto=($product->type==Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'translation', $titre, 0, $picto);
|
||||
$head=product_prepare_head($object);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type==Product::TYPE_SERVICE?'service':'product');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr>';
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||
print $form->showrefnav($product,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
@ -191,33 +181,40 @@ if ($action == 'edit')
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="vedit">';
|
||||
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
if (! empty($product->multilangs))
|
||||
dol_fiche_head($head, 'translation', $titre, 0, $picto);
|
||||
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
if (! empty($object->multilangs))
|
||||
{
|
||||
foreach ($product->multilangs as $key => $value)
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
|
||||
$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 valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$product->multilangs[$key]["label"].'"></td></tr>';
|
||||
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
|
||||
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
|
||||
|
||||
$doleditor = new DolEditor("desc-$key", $product->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
|
||||
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td valign="top" width="15%">'.$langs->trans('Note').'</td><td>';
|
||||
|
||||
$doleditor = new DolEditor("note-$key", $product->multilangs[$key]["note"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
|
||||
$doleditor = new DolEditor("note-$key", $object->multilangs[$key]["note"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr height="30px"><td colspan="2" align="right"><a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=vdelete&id='.$product->id.'&langdel='.$key.'">'.$langs->trans("Delete").'</a></td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<br><div class="center">';
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
@ -228,25 +225,30 @@ if ($action == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
$cnt_trans = 0;
|
||||
if (! empty($product->multilangs))
|
||||
dol_fiche_head($head, 'translation', $titre, 0, $picto);
|
||||
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
$cnt_trans = 0;
|
||||
if (! empty($object->multilangs))
|
||||
{
|
||||
foreach ($product->multilangs as $key => $value)
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
$cnt_trans++;
|
||||
$s=picto_from_langcode($key);
|
||||
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', '')."</a><br>";
|
||||
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 width="15%">'.$langs->trans('Label').'</td><td>'.$product->multilangs[$key]["label"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Description').'</td><td>'.$product->multilangs[$key]["description"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$product->multilangs[$key]["note"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$object->multilangs[$key]["note"].'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
if (! $cnt_trans) print '<br>'. $langs->trans('NoTranslation');
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
@ -260,8 +262,8 @@ print "\n<div class=\"tabsAction\">\n";
|
||||
if ($action == '')
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=add&id='.$product->id.'">'.$langs->trans("Add").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=edit&id='.$product->id.'">'.$langs->trans("Update").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=add&id='.$object->id.'">'.$langs->trans("Add").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=edit&id='.$object->id.'">'.$langs->trans("Update").'</a>';
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
@ -284,7 +286,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Language').'</td><td>';
|
||||
print $formadmin->select_language('','forcelangprod',0,$product->multilangs,1);
|
||||
print $formadmin->select_language('','forcelangprod',0,$object->multilangs,1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
|
||||
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user