New: Can set accountancy code for product (buy and sell)
This commit is contained in:
parent
2da9b9df22
commit
bab2b22b3a
@ -3,8 +3,10 @@ English Dolibarr ChangeLog
|
|||||||
***** ChangeLog for 2.9 compared to 2.8 *****
|
***** ChangeLog for 2.9 compared to 2.8 *****
|
||||||
|
|
||||||
For users:
|
For users:
|
||||||
|
- New: Can set accountancy code for product (buy and sell).
|
||||||
- New: Can filter third parties lists on categories.
|
- New: Can filter third parties lists on categories.
|
||||||
- New: Can filter products and services lists on categories.
|
- New: Can filter products and services lists on categories.
|
||||||
|
- New: Can use categories for members.
|
||||||
- New: Can build documents for third parties (Use ODT templates, need PHP 5.2+).
|
- New: Can build documents for third parties (Use ODT templates, need PHP 5.2+).
|
||||||
- New: Support products property length and area.
|
- New: Support products property length and area.
|
||||||
- New: Add "payment due before" field in invoice exports
|
- New: Add "payment due before" field in invoice exports
|
||||||
|
|||||||
@ -151,31 +151,12 @@ if ($socid > 0)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
// TODO Use a html->editfield function
|
print '<td>';
|
||||||
print '<td><table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
print $form->editfieldkey("CustomerAccountancyCode",'customeraccountancycode',$societe->code_compta,'socid',$societe->id,$user->rights->societe->creer);
|
||||||
print $langs->trans("CustomerAccountancyCode");
|
|
||||||
print '</td>';
|
|
||||||
if ($_GET['action'] != 'editcustomeraccountancycode' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editcustomeraccountancycode&socid='.$societe->id.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($_GET['action'] == 'editcustomeraccountancycode')
|
print $form->editfieldval("CustomerAccountancyCode",'customeraccountancycode',$societe->code_compta,'socid',$societe->id,$user->rights->societe->creer);
|
||||||
{
|
|
||||||
print "\n".'<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
print '<input type="hidden" name="action" value="setcustomeraccountancycode">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
|
||||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<input type="text" name="customeraccountancycode" value="'.$societe->code_compta.'">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
|
||||||
print '</tr></table></form>'."\n";
|
|
||||||
}
|
|
||||||
else print $societe->code_compta;
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// End editfield
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($societe->fournisseur)
|
if ($societe->fournisseur)
|
||||||
@ -188,29 +169,11 @@ if ($socid > 0)
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
// TODO Use a html->editfield function
|
print '<td>';
|
||||||
print '<td><table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
print $form->editfieldkey("SupplierAccountancyCode",'supplieraccountancycode',$societe->code_compta_fournisseur,'socid',$societe->id,$user->rights->societe->creer);
|
||||||
print $langs->trans("SupplierAccountancyCode");
|
|
||||||
print '</td>';
|
|
||||||
if ($_GET['action'] != 'editsupplieraccountancycode' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editsupplieraccountancycode&socid='.$societe->id.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
|
|
||||||
print '</tr></table>';
|
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($_GET['action'] == 'editsupplieraccountancycode')
|
print $form->editfieldval("SupplierAccountancyCode",'supplieraccountancycode',$societe->code_compta_fournisseur,'socid',$societe->id,$user->rights->societe->creer);
|
||||||
{
|
|
||||||
print "\n".'<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
print '<input type="hidden" name="action" value="setsupplieraccountancycode">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
|
||||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
|
||||||
print '<tr><td>';
|
|
||||||
print '<input type="text" name="supplieraccountancycode" value="'.$societe->code_compta_fournisseur.'">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
|
||||||
print '</tr></table></form>'."\n";
|
|
||||||
}
|
|
||||||
else print $societe->code_compta_fournisseur;
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// End editfield
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,46 @@ class Form
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Output key field for an editable field
|
||||||
|
*/
|
||||||
|
function editfieldkey($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$ret='';
|
||||||
|
$ret.='<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
|
||||||
|
$ret.=$langs->trans($text);
|
||||||
|
$ret.='</td>';
|
||||||
|
if ($_GET['action'] != 'edit'.$htmlname && $perm) $ret.='<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&'.$paramkey.'='.$paramvalue.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
|
||||||
|
$ret.='</tr></table>';
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Output val field for an editable field
|
||||||
|
*/
|
||||||
|
function editfieldval($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$ret='';
|
||||||
|
if ($_GET['action'] == 'edit'.$htmlname)
|
||||||
|
{
|
||||||
|
$ret.="\n";
|
||||||
|
$ret.='<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
$ret.='<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||||
|
$ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$ret.='<input type="hidden" name="'.$paramkey.'" value="'.$paramvalue.'">';
|
||||||
|
$ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||||
|
$ret.='<tr><td>';
|
||||||
|
$ret.='<input type="text" name="'.$htmlname.'" value="'.$preselected.'">';
|
||||||
|
$ret.='</td>';
|
||||||
|
$ret.='<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||||
|
$ret.='</tr></table>'."\n";
|
||||||
|
$ret.='</form>'."\n";
|
||||||
|
}
|
||||||
|
else $ret.=$preselected;
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Old version of textwithtooltip. Kept for backward compatibility with modules for 2.6.
|
* \brief Old version of textwithtooltip. Kept for backward compatibility with modules for 2.6.
|
||||||
@ -68,7 +108,6 @@ class Form
|
|||||||
*/
|
*/
|
||||||
function textwithhelp($text,$htmltext,$tooltipon=1)
|
function textwithhelp($text,$htmltext,$tooltipon=1)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
return $this->textwithtooltip($text,$htmltext,$tooltipon);
|
return $this->textwithtooltip($text,$htmltext,$tooltipon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1165,7 +1165,7 @@ function migrate_price_facture($db,$langs,$conf)
|
|||||||
$facligne->total_ttc = $total_ttc;
|
$facligne->total_ttc = $total_ttc;
|
||||||
|
|
||||||
dolibarr_install_syslog("upgrade2: Line $rowid: facid=$obj->facid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
dolibarr_install_syslog("upgrade2: Line $rowid: facid=$obj->facid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
|
||||||
print ".";
|
print ". ";
|
||||||
$facligne->update_total();
|
$facligne->update_total();
|
||||||
|
|
||||||
|
|
||||||
@ -2992,7 +2992,7 @@ function migrate_shipping_delivery($db,$langs,$conf)
|
|||||||
$error++;
|
$error++;
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print ".";
|
print ". ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -18,6 +18,8 @@ BookList=List of books
|
|||||||
NewService=New service
|
NewService=New service
|
||||||
ProductCode=Product code
|
ProductCode=Product code
|
||||||
ServiceCode=Service code
|
ServiceCode=Service code
|
||||||
|
ProductAccountancyBuyCode=Accountancy code (buy)
|
||||||
|
ProductAccountancySellCode=Accountancy code (sell)
|
||||||
ProductOrService=Product or Service
|
ProductOrService=Product or Service
|
||||||
ProductsAndServices=Products and Services
|
ProductsAndServices=Products and Services
|
||||||
ProductsOrServices=Products or Services
|
ProductsOrServices=Products or Services
|
||||||
|
|||||||
@ -18,6 +18,8 @@ BookList=Liste livres
|
|||||||
NewService=Nouveau service
|
NewService=Nouveau service
|
||||||
ProductCode=Code produit
|
ProductCode=Code produit
|
||||||
ServiceCode=Code service
|
ServiceCode=Code service
|
||||||
|
ProductAccountancyBuyCode=Code compta achat
|
||||||
|
ProductAccountancySellCode=Code compta vente
|
||||||
ProductOrService=Produit ou Service
|
ProductOrService=Produit ou Service
|
||||||
ProductsOrServices=Produits ou Services
|
ProductsOrServices=Produits ou Services
|
||||||
ProductsAndServices=Produits et Services
|
ProductsAndServices=Produits et Services
|
||||||
|
|||||||
@ -95,6 +95,9 @@ class Product extends CommonObject
|
|||||||
var $volume;
|
var $volume;
|
||||||
var $volume_units;
|
var $volume_units;
|
||||||
|
|
||||||
|
var $accountancy_code_buy;
|
||||||
|
var $accountancy_code_sell;
|
||||||
|
|
||||||
//! Codes barres
|
//! Codes barres
|
||||||
var $barcode;
|
var $barcode;
|
||||||
var $barcode_type;
|
var $barcode_type;
|
||||||
@ -409,27 +412,31 @@ class Product extends CommonObject
|
|||||||
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
||||||
if (empty($this->finished)) $this->finished = 0;
|
if (empty($this->finished)) $this->finished = 0;
|
||||||
if (empty($this->hidden)) $this->hidden = 0;
|
if (empty($this->hidden)) $this->hidden = 0;
|
||||||
|
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
||||||
|
$this->accountancy_code_sell= trim($this->accountancy_code_sell);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
|
||||||
$sql .= " SET label = '" . addslashes($this->libelle) ."'";
|
$sql.= " SET label = '" . addslashes($this->libelle) ."'";
|
||||||
$sql .= ",ref = '" . $this->ref ."'";
|
$sql.= ",ref = '" . $this->ref ."'";
|
||||||
$sql .= ",tva_tx = " . $this->tva_tx;
|
$sql.= ",tva_tx = " . $this->tva_tx;
|
||||||
$sql .= ",envente = " . $this->status;
|
$sql.= ",envente = " . $this->status;
|
||||||
$sql .= ",finished = " . ($this->finished<0 ? "null" : $this->finished);
|
$sql.= ",finished = " . ($this->finished<0 ? "null" : $this->finished);
|
||||||
$sql .= ",hidden = " . ($this->hidden<0 ? "null" : $this->hidden);
|
$sql.= ",hidden = " . ($this->hidden<0 ? "null" : $this->hidden);
|
||||||
$sql .= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
|
$sql.= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
|
||||||
$sql .= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
|
$sql.= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
|
||||||
$sql .= ",length = " . ($this->length!='' ? "'".$this->length."'" : 'null');
|
$sql.= ",length = " . ($this->length!='' ? "'".$this->length."'" : 'null');
|
||||||
$sql .= ",length_units = " . ($this->length_units!='' ? "'".$this->length_units."'" : 'null');
|
$sql.= ",length_units = " . ($this->length_units!='' ? "'".$this->length_units."'" : 'null');
|
||||||
$sql .= ",surface = " . ($this->surface!='' ? "'".$this->surface."'" : 'null');
|
$sql.= ",surface = " . ($this->surface!='' ? "'".$this->surface."'" : 'null');
|
||||||
$sql .= ",surface_units = " . ($this->surface_units!='' ? "'".$this->surface_units."'" : 'null');
|
$sql.= ",surface_units = " . ($this->surface_units!='' ? "'".$this->surface_units."'" : 'null');
|
||||||
$sql .= ",volume = " . ($this->volume!='' ? "'".$this->volume."'" : 'null');
|
$sql.= ",volume = " . ($this->volume!='' ? "'".$this->volume."'" : 'null');
|
||||||
$sql .= ",volume_units = " . ($this->volume_units!='' ? "'".$this->volume_units."'" : 'null');
|
$sql.= ",volume_units = " . ($this->volume_units!='' ? "'".$this->volume_units."'" : 'null');
|
||||||
$sql .= ",seuil_stock_alerte = " . ((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->seuil_stock_alerte."'" : "null");
|
$sql.= ",seuil_stock_alerte = " . ((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->seuil_stock_alerte."'" : "null");
|
||||||
$sql .= ",description = '" . addslashes($this->description) ."'";
|
$sql.= ",description = '" . addslashes($this->description) ."'";
|
||||||
$sql .= ",note = '" . addslashes($this->note) ."'";
|
$sql.= ",note = '" . addslashes($this->note) ."'";
|
||||||
$sql .= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
|
$sql.= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
|
||||||
$sql .= " WHERE rowid = " . $id;
|
$sql.= ",accountancy_code_buy = '" . $this->accountancy_code_buy."'";
|
||||||
|
$sql.= ",accountancy_code_sell= '" . $this->accountancy_code_sell."'";
|
||||||
|
$sql.= " WHERE rowid = " . $id;
|
||||||
|
|
||||||
dol_syslog("Product::update sql=".$sql);
|
dol_syslog("Product::update sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -920,7 +927,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " price_min, price_min_ttc, price_base_type, tva_tx, envente,";
|
$sql.= " price_min, price_min_ttc, price_base_type, tva_tx, envente,";
|
||||||
$sql.= " fk_product_type, duration, seuil_stock_alerte, canvas,";
|
$sql.= " fk_product_type, duration, seuil_stock_alerte, canvas,";
|
||||||
$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, hidden,";
|
$sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, hidden,";
|
||||||
$sql.= " stock, pmp,";
|
$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
|
||||||
$sql.= " import_key";
|
$sql.= " import_key";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
if ($id) $sql.= " WHERE rowid = '".$id."'";
|
if ($id) $sql.= " WHERE rowid = '".$id."'";
|
||||||
@ -963,6 +970,9 @@ class Product extends CommonObject
|
|||||||
$this->barcode = $result["barcode"];
|
$this->barcode = $result["barcode"];
|
||||||
$this->barcode_type = $result["fk_barcode_type"];
|
$this->barcode_type = $result["fk_barcode_type"];
|
||||||
|
|
||||||
|
$this->accountancy_code_buy = $result["accountancy_code_buy"];
|
||||||
|
$this->accountancy_code_sell= $result["accountancy_code_sell"];
|
||||||
|
|
||||||
$this->stock_reel = $result["stock"];
|
$this->stock_reel = $result["stock"];
|
||||||
$this->pmp = $result["pmp"];
|
$this->pmp = $result["pmp"];
|
||||||
|
|
||||||
@ -2434,14 +2444,17 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Affiche toutes les photos du produit (nbmax maximum)
|
* \brief Show photos of a product (nbmax maximum)
|
||||||
* \param sdir Directory to scan
|
* \param sdir Directory to scan
|
||||||
* \param size 0=taille origine, 1 taille vignette
|
* \param size 0=original size, 1 use thumbnail if possible
|
||||||
* \param nbmax Nombre maximum de photos (0=pas de max)
|
* \param nbmax Nombre maximum de photos (0=pas de max)
|
||||||
* \param nbbyrow Nombre vignettes par ligne (si mode vignette)
|
* \param nbbyrow Nombre vignettes par ligne (si mode vignette)
|
||||||
* \return int Nombre de photos affichees
|
* \param showfilename 1=Show filename
|
||||||
|
* \param showaction 1=Show icon with action links (resize, delete)
|
||||||
|
* \param maxheight Max height of image when size=1
|
||||||
|
* \return int Number of photos shown
|
||||||
*/
|
*/
|
||||||
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0)
|
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxheight=120)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@ -2490,17 +2503,17 @@ class Product extends CommonObject
|
|||||||
print "\n";
|
print "\n";
|
||||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" target="_blank">';
|
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" target="_blank">';
|
||||||
|
|
||||||
// Show image (width height=120)
|
// Show image (width height=$maxheight)
|
||||||
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
|
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
|
||||||
$alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo;
|
$alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo;
|
||||||
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
||||||
if ($photo_vignette && $imgarray['height'] > 120) {
|
if ($photo_vignette && $imgarray['height'] > $maxheight) {
|
||||||
print '<!-- Show thumb -->';
|
print '<!-- Show thumb -->';
|
||||||
print '<img class="photo" border="0" height="120" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
print '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<!-- Show original file -->';
|
print '<!-- Show original file -->';
|
||||||
print '<img class="photo" border="0" height="120" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
print '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</a>';
|
print '</a>';
|
||||||
|
|||||||
@ -56,6 +56,36 @@ $mesg = '';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($_POST['action'] == 'setproductaccountancycodebuy')
|
||||||
|
{
|
||||||
|
$product = new Product($db);
|
||||||
|
$result=$product->fetch($_POST['id']);
|
||||||
|
$product->accountancy_code_buy=$_POST["productaccountancycodebuy"];
|
||||||
|
$result=$product->update($product->id,$user,1,0,1);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg=join(',',$product->errors);
|
||||||
|
}
|
||||||
|
$POST["action"]="";
|
||||||
|
$id=$_POST["id"];
|
||||||
|
$_GET["id"]=$_POST["id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST['action'] == 'setproductaccountancycodesell')
|
||||||
|
{
|
||||||
|
$product = new Product($db);
|
||||||
|
$result=$product->fetch($_POST['id']);
|
||||||
|
$product->accountancy_code_sell=$_POST["productaccountancycodesell"];
|
||||||
|
$result=$product->update($product->id,$user,1,0,1);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg=join(',',$product->errors);
|
||||||
|
}
|
||||||
|
$POST["action"]="";
|
||||||
|
$id=$_POST["id"];
|
||||||
|
$_GET["id"]=$_POST["id"];
|
||||||
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'fastappro')
|
if ($_GET["action"] == 'fastappro')
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -886,142 +916,35 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print '<table class="border" width="100%"><tr>';
|
print '<table class="border" width="100%"><tr>';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
|
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||||
print $html->showrefnav($product,'ref','',1,'ref');
|
print $html->showrefnav($product,'ref','',1,'ref');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$nblignes=3;
|
print '</tr>';
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_LIMIT) && empty($socid)) $nblignes+=$conf->global->PRODUIT_MULTIPRICES_LIMIT;
|
|
||||||
else $nblignes+=3;
|
|
||||||
|
|
||||||
|
// Label
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
||||||
|
|
||||||
|
$nblignes=4;
|
||||||
if ($product->is_photo_available($conf->produit->dir_output))
|
if ($product->is_photo_available($conf->produit->dir_output))
|
||||||
{
|
{
|
||||||
// Photo
|
// Photo
|
||||||
print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">';
|
print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">';
|
||||||
$nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0);
|
$nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0,0,0,80);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Label
|
// Accountancy buy code
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td></tr>';
|
print '<tr><td>'.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer).'</td><td>';
|
||||||
|
print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// MultiPrix
|
// Accountancy sell code
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
print '<tr><td>'.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer).'</td><td>';
|
||||||
{
|
print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer);
|
||||||
if ($socid)
|
print '</td></tr>';
|
||||||
{
|
|
||||||
$soc = new Societe($db);
|
|
||||||
$soc->id = $socid;
|
|
||||||
$soc->fetch($socid);
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td>';
|
|
||||||
|
|
||||||
if ($product->multiprices_base_type["$soc->price_level"] == 'TTC')
|
|
||||||
{
|
|
||||||
print '<td>'.price($product->multiprices_ttc["$soc->price_level"]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td>'.price($product->multiprices["$soc->price_level"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($product->multiprices_base_type["$soc->price_level"])
|
|
||||||
{
|
|
||||||
print ' '.$langs->trans($product->multiprices_base_type["$soc->price_level"]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print ' '.$langs->trans($product->price_base_type);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Prix mini
|
|
||||||
print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
|
|
||||||
if ($product->multiprices_base_type["$soc->price_level"] == 'TTC')
|
|
||||||
{
|
|
||||||
print price($product->multiprices_min_ttc["$soc->price_level"]).' '.$langs->trans($product->multiprices_base_type["$soc->price_level"]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print price($product->multiprices_min["$soc->price_level"]).' '.$langs->trans($product->multiprices_base_type["$soc->price_level"]);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// TVA
|
|
||||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->multiprices_tva_tx["$soc->price_level"],true).'</td></tr>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for ($i=1; $i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td>';
|
|
||||||
|
|
||||||
if ($product->multiprices_base_type["$i"] == 'TTC')
|
|
||||||
{
|
|
||||||
print '<td>'.price($product->multiprices_ttc["$i"]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<td>'.price($product->multiprices["$i"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($product->multiprices_base_type["$i"])
|
|
||||||
{
|
|
||||||
print ' '.$langs->trans($product->multiprices_base_type["$i"]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print ' '.$langs->trans($product->price_base_type);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Prix mini
|
|
||||||
print '<tr><td>'.$langs->trans("MinPrice").' '.$i.'</td><td>';
|
|
||||||
if ($product->multiprices_base_type["$i"] == 'TTC')
|
|
||||||
{
|
|
||||||
print price($product->multiprices_min_ttc["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print price($product->multiprices_min["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// TVA
|
|
||||||
print '<tr><td>'.$langs->trans("VATRate").' '.$i.'</td><td>'.vatrate($product->multiprices_tva_tx["$i"],true).'</td></tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Prix
|
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
|
|
||||||
if ($product->price_base_type == 'TTC')
|
|
||||||
{
|
|
||||||
print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print price($product->price).' '.$langs->trans($product->price_base_type);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Prix mini
|
|
||||||
print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
|
|
||||||
if ($product->price_base_type == 'TTC')
|
|
||||||
{
|
|
||||||
print price($product->price_min_ttc).' '.$langs->trans($product->price_base_type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print price($product->price_min).' '.$langs->trans($product->price_base_type);
|
|
||||||
}
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// TVA
|
|
||||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->tva_tx,true).'</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user