Debug v11

This commit is contained in:
Laurent Destailleur
2020-01-20 12:25:25 +01:00
parent 969da828fa
commit 18f2b09fb1
17 changed files with 141 additions and 106 deletions

View File

@@ -746,6 +746,9 @@ class BOM extends CommonObject
$label = '<u>'.$langs->trans("BillOfMaterials").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->status)) {
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;

View File

@@ -612,7 +612,7 @@ if (empty($reshook))
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST ['prod_entry_mode']);
unset($_POST['prod_entry_mode']);
unset($_POST['qty']);
unset($_POST['type']);
@@ -626,8 +626,8 @@ if (empty($reshook))
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST ['np_marginRate']);
unset($_POST ['np_markRate']);
unset($_POST['np_marginRate']);
unset($_POST['np_markRate']);
unset($_POST['dp_desc']);
unset($_POST['idprod']);
@@ -1114,6 +1114,7 @@ if ($action == 'create')
if (GETPOST('origin') && GETPOST('originid'))
{
// Parse element/subelement (ex: project_task)
$regs = array();
$element = $subelement = GETPOST('origin');
if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin'), $regs))
{
@@ -1544,7 +1545,7 @@ else
$sql .= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
$sql .= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
$sql .= " cd.fk_unit,";
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql .= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity, p.tosell, p.tobuy, p.tobatch";
$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql .= " WHERE cd.rowid = ".$object->lines[$cursorline - 1]->id;
@@ -1577,12 +1578,16 @@ else
// Label
if ($objp->fk_product > 0)
{
print '<td>';
$productstatic->id = $objp->fk_product;
$productstatic->type = $objp->ptype;
$productstatic->ref = $objp->pref;
$productstatic->entity = $objp->pentity;
$productstatic->label = $objp->plabel;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->status_batch = $objp->tobatch;
print '<td>';
$text = $productstatic->getNomUrl(1, '', 32);
if ($objp->plabel)
{

View File

@@ -1381,10 +1381,10 @@ class Contrat extends CommonObject
/**
* Ajoute une ligne de contrat en base
*
* @param string $desc Description de la ligne
* @param float $pu_ht Prix unitaire HT
* @param int $qty Quantite
* @param float $txtva Taux tva
* @param string $desc Description of line
* @param float $pu_ht Unit price net
* @param int $qty Quantity
* @param float $txtva Vat rate
* @param float $txlocaltax1 Local tax 1 rate
* @param float $txlocaltax2 Local tax 2 rate
* @param int $fk_product Id produit

View File

@@ -4199,6 +4199,7 @@ abstract class CommonObject
$product_static->ref = $line->ref; //can change ref in hook
$product_static->label = $line->label; //can change label in hook
$text = $product_static->getNomUrl(1);
// Define output language and label

View File

@@ -3060,7 +3060,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'address', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
'address', 'barcode', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
'object_bookmark', 'object_list', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',

View File

@@ -66,11 +66,11 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
$coldisplay = 0; ?>
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->
<tr id="row-<?php echo $line->id?>" class="drag drop oddeven" <?php echo $domData; ?> >
<tr id="row-<?php print $line->id?>" class="drag drop oddeven" <?php print $domData; ?> >
<?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?>
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i + 1); ?></td>
<td class="linecolnum center"><?php $coldisplay++; ?><?php print ($i + 1); ?></td>
<?php } ?>
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div>
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php print $line->id; ?>"></div>
<?php
if (($line->info_bits & 2) == 2) {
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$this->socid.'">';
@@ -88,32 +88,32 @@ if (($line->info_bits & 2) == 2) {
{
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0));
}
elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0)
{
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0));
// Add date of deposit
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE))
echo ' ('.dol_print_date($discount->datec).')';
print ' ('.dol_print_date($discount->datec).')';
}
elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0)
{
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0));
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0));
}
elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0)
{
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0));
print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0));
}
else
{
echo ($txt ? ' - ' : '').dol_htmlentitiesbr($line->description);
print ($txt ? ' - ' : '').dol_htmlentitiesbr($line->description);
}
}
}
@@ -123,7 +123,7 @@ else
if ($line->fk_product > 0)
{
echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
}
else
{
@@ -132,30 +132,30 @@ else
if (!empty($line->label)) {
$text .= ' <strong>'.$line->label.'</strong>';
echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
print $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
} else {
if (!empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
if (!empty($line->fk_parent_line)) print img_picto('', 'rightarrow');
if (preg_match('/^\(DEPOSIT\)/', $line->description)) {
$newdesc = preg_replace('/^\(DEPOSIT\)/', $langs->trans("Deposit"), $line->description);
echo $text.' '.dol_htmlentitiesbr($newdesc);
print $text.' '.dol_htmlentitiesbr($newdesc);
}
else {
echo $text.' '.dol_htmlentitiesbr($line->description);
print $text.' '.dol_htmlentitiesbr($line->description);
}
}
}
// Show date range
if ($line->element == 'facturedetrec') {
if ($line->date_start_fill || $line->date_end_fill) echo '<br><div class="clearboth nowraponall">';
if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
if ($line->date_start_fill && $line->date_end_fill) echo ' - ';
if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
if ($line->date_start_fill || $line->date_end_fill) echo '</div>';
if ($line->date_start_fill || $line->date_end_fill) print '<br><div class="clearboth nowraponall">';
if ($line->date_start_fill) print $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
if ($line->date_start_fill && $line->date_end_fill) print ' - ';
if ($line->date_end_fill) print $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
if ($line->date_start_fill || $line->date_end_fill) print '</div>';
}
else {
if ($line->date_start || $line->date_end) echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
//echo get_date_range($line->date_start, $line->date_end, $format);
if ($line->date_start || $line->date_end) print '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
//print get_date_range($line->date_start, $line->date_end, $format);
}
// Add description in form
@@ -170,15 +170,16 @@ if ($user->rights->fournisseur->lire && $line->fk_fournprice > 0)
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productfourn = new ProductFournisseur($this->db);
$productfourn->fetch_product_fournisseur_price($line->fk_fournprice);
echo '<div class="clearboth"></div><span class="opacitymedium">'.$langs->trans('Supplier').' : </span>'.$productfourn->getSocNomUrl(1, 'supplier').' - <span class="opacitymedium">'.$langs->trans('Ref').' : </span>';
print '<div class="clearboth"></div>';
print '<span class="opacitymedium">'.$langs->trans('Supplier').' : </span>'.$productfourn->getSocNomUrl(1, 'supplier').' - <span class="opacitymedium">'.$langs->trans('Ref').' : </span>';
// Supplier ref
if ($user->rights->produit->creer || $user->rights->service->creer) // change required right here
{
echo $productfourn->getNomUrl();
print $productfourn->getNomUrl();
}
else
{
echo $productfourn->ref_supplier;
print $productfourn->ref_supplier;
}
}
@@ -186,14 +187,14 @@ if (!empty($conf->accounting->enabled) && $line->fk_accounting_account > 0)
{
$accountingaccount = new AccountingAccount($this->db);
$accountingaccount->fetch($line->fk_accounting_account);
echo '<div class="clearboth"></div><br><span class="opacitymedium">'.$langs->trans('AccountingAffectation').' : </span>'.$accountingaccount->getNomUrl(0, 1, 1);
print '<div class="clearboth"></div><br><span class="opacitymedium">'.$langs->trans('AccountingAffectation').' : </span>'.$accountingaccount->getNomUrl(0, 1, 1);
}
print '</td>';
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
print '<td class="linecolrefsupplier">';
echo ($line->ref_fourn ? $line->ref_fourn : $line->ref_supplier);
print ($line->ref_fourn ? $line->ref_fourn : $line->ref_supplier);
print '</td>';
}
// VAT Rate
@@ -204,18 +205,18 @@ if (price2num($line->tva_tx)) $positiverates .= ($positiverates ? '/' :
if (price2num($line->total_localtax1)) $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax1_tx);
if (price2num($line->total_localtax2)) $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax2_tx);
if (empty($positiverates)) $positiverates = '0';
echo vatrate($positiverates.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), '%', $line->info_bits);
//echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits);
print vatrate($positiverates.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), '%', $line->info_bits);
//print vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits);
?></td>
<td class="linecoluht nowrap right"><?php $coldisplay++; ?><?php echo price($line->subprice); ?></td>
<td class="linecoluht nowrap right"><?php $coldisplay++; ?><?php print price($line->subprice); ?></td>
<?php if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?>
<td class="linecoluht_currency nowrap right"><?php $coldisplay++; ?><?php echo price($line->multicurrency_subprice); ?></td>
<td class="linecoluht_currency nowrap right"><?php $coldisplay++; ?><?php print price($line->multicurrency_subprice); ?></td>
<?php }
if ($inputalsopricewithtax) { ?>
<td class="linecoluttc nowrap right"><?php $coldisplay++; ?><?php echo (isset($line->pu_ttc) ?price($line->pu_ttc) : price($line->subprice)); ?></td>
<td class="linecoluttc nowrap right"><?php $coldisplay++; ?><?php print (isset($line->pu_ttc) ?price($line->pu_ttc) : price($line->subprice)); ?></td>
<?php } ?>
<td class="linecolqty nowrap right"><?php $coldisplay++; ?>
@@ -225,8 +226,8 @@ if ((($line->info_bits & 2) != 2) && $line->special_code != 3) {
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
} else echo '&nbsp;';
print price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
} else print '&nbsp;';
print '</td>';
if ($conf->global->PRODUCT_USE_UNITS)
@@ -242,7 +243,7 @@ if (!empty($line->remise_percent) && $line->special_code != 3) {
print '<td class="linecoldiscount right">';
$coldisplay++;
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
echo dol_print_reduction($line->remise_percent, $langs);
print dol_print_reduction($line->remise_percent, $langs);
print '</td>';
} else {
print '<td class="linecoldiscount">&nbsp;</td>';
@@ -264,17 +265,17 @@ if ($this->situation_cycle_ref)
if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid))
{
if (!empty($user->rights->margins->creer)) { ?>
<td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php echo price($line->pa_ht); ?></td>
<td class="linecolmargin1 nowrap margininfos right"><?php $coldisplay++; ?><?php print price($line->pa_ht); ?></td>
<?php }
if (!empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?>
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php echo (($line->pa_ht == 0) ? 'n/a' : price(price2num($line->marge_tx, 'MT')).'%'); ?></td>
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php print (($line->pa_ht == 0) ? 'n/a' : price(price2num($line->marge_tx, 'MT')).'%'); ?></td>
<?php }
if (!empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?>
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php echo price(price2num($line->marque_tx, 'MT')).'%'; ?></td>
<td class="linecolmargin2 nowrap margininfos right"><?php $coldisplay++; ?><?php print price(price2num($line->marque_tx, 'MT')).'%'; ?></td>
<?php }
}
if ($line->special_code == 3) { ?>
<td class="linecoloption nowrap right"><?php $coldisplay++; ?><?php echo $langs->trans('Option'); ?></td>
<td class="linecoloption nowrap right"><?php $coldisplay++; ?><?php print $langs->trans('Option'); ?></td>
<?php } else {
print '<td class="linecolht nowrap right">';
$coldisplay++;
@@ -309,8 +310,8 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
$coldisplay++;
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
} else { ?>
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
<?php echo img_edit().'</a>';
<a href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>">
<?php print img_edit().'</a>';
}
print '</td>';
@@ -327,13 +328,13 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
print '<td class="linecolmove tdlineupdown center">';
$coldisplay++;
if ($i > 0) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
<?php echo img_up('default', 0, 'imgupforline'); ?>
<a class="lineupdown" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>">
<?php print img_up('default', 0, 'imgupforline'); ?>
</a>
<?php }
if ($i < $num - 1) { ?>
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id; ?>">
<?php echo img_down('default', 0, 'imgdownforline'); ?>
<a class="lineupdown" href="<?php print $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id; ?>">
<?php print img_down('default', 0, 'imgdownforline'); ?>
</a>
<?php }
print '</td>';
@@ -347,7 +348,7 @@ if ($this->statut == 0 && ($object_rights->creer) && $action != 'selectlines') {
}
if ($action == 'selectlines') { ?>
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td>
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php print $i + 1; ?>]" value="<?php print $line->id; ?>" ></td>
<?php }
print "</tr>\n";

View File

@@ -732,6 +732,9 @@ class MyObject extends CommonObject
$label = '<u>'.$langs->trans("MyObject").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->status)) {
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
$url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id;

View File

@@ -964,6 +964,9 @@ class Mo extends CommonObject
$label = '<u>'.$langs->trans("MO").'</u>';
$label .= '<br>';
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (isset($this->status)) {
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
$url = dol_buildpath('/mrp/mo_card.php', 1).'?id='.$this->id;

View File

@@ -4240,10 +4240,7 @@ class Product extends CommonObject
$label .= "<br><b>".$langs->trans("ManageLotSerial").'</b>: '.$this->getLibStatut(0, 2);
}
}
//if ($this->type == Product::TYPE_SERVICE)
//{
//
//}
if (!empty($conf->accounting->enabled) && $this->status) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= '<br><b>'.$langs->trans('ProductAccountancySellCode').':</b> '.length_accountg($this->accountancy_code_sell);
@@ -4256,6 +4253,11 @@ class Product extends CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= '<br><b>'.$langs->trans('ProductAccountancyBuyCode').':</b> '.length_accountg($this->accountancy_code_buy);
}
if (isset($this->status) && isset($this->status_buy)) {
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5, 0);
$label.= ' '.$this->getLibStatut(5, 1);
}
if (!empty($this->entity)) {
$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80);
if ($this->nbphoto > 0) { $label .= '<br>'.$tmpphoto;

View File

@@ -312,6 +312,15 @@ if ($result)
{
$objp = $db->fetch_object($result);
$product_static->id = $objp->rowid;
$product_static->ref = $objp->ref;
$product_static->label = $objp->label;
$product_static->type = $objp->fk_product_type;
$product_static->entity = $objp->entity;
$product_static->status = $objp->tosell;
$product_static->status_buy = $objp->tobuy;
$product_static->status_batch = $objp->tobatch;
//Multilangs
if (!empty($conf->global->MAIN_MULTILANGS))
{
@@ -331,12 +340,6 @@ if ($result)
print '<tr class="oddeven">';
print '<td class="nowrap">';
$product_static->id = $objp->rowid;
$product_static->ref = $objp->ref;
$product_static->label = $objp->label;
$product_static->type = $objp->fk_product_type;
$product_static->entity = $objp->entity;
$product_static->status_batch = $objp->tobatch;
print $product_static->getNomUrl(1, '', 16);
print "</td>\n";
print '<td>'.dol_trunc($objp->label, 32).'</td>';

View File

@@ -118,7 +118,7 @@ $title=$langs->trans("ProductsAndServices");
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tobatch,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,';
$sql.= ' ps.fk_entrepot,';
$sql.= ' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,';
$sql.= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,';
@@ -160,7 +160,7 @@ if ($search_warehouse) $sql .= natural_search("e.ref", $search_warehouse);
if ($search_batch) $sql .= natural_search("pb.batch", $search_batch);
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
$sql.= " p.fk_product_type, p.tms,";
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tobatch,";
$sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,";
$sql.= " ps.fk_entrepot,";
$sql.= " e.ref, e.lieu, e.fk_parent,";
$sql.= " pb.batch, pb.eatby, pb.sellby,";
@@ -206,21 +206,21 @@ if ($resql)
$texte.=' ('.$langs->trans("StocksByLotSerial").')';
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.="&sall=".$sall;
if ($tosell) $param.="&tosell=".$tosell;
if ($tobuy) $param.="&tobuy=".$tobuy;
if ($type) $param.="&type=".$type;
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
if ($snom) $param.="&snom=".$snom;
if ($sref) $param.="&sref=".$sref;
if ($search_batch) $param.="&search_batch=".$search_batch;
if ($sbarcode) $param.="&sbarcode=".$sbarcode;
if ($search_warehouse) $param.="&search_warehouse=".$search_warehouse;
if ($catid) $param.="&catid=".$catid;
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
if ($search_sale) $param.="&search_sale=".$search_sale;
if ($search_categ) $param.="&search_categ=".$search_categ;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sall) $param.="&sall=".urlencode($sall);
if ($tosell) $param.="&tosell=".urlencode($tosell);
if ($tobuy) $param.="&tobuy=".urlencode($tobuy);
if ($type) $param.="&type=".urlencode($type);
if ($fourn_id) $param.="&fourn_id=".urlencode($fourn_id);
if ($snom) $param.="&snom=".urlencode($snom);
if ($sref) $param.="&sref=".urlencode($sref);
if ($search_batch) $param.="&search_batch=".urlencode($search_batch);
if ($sbarcode) $param.="&sbarcode=".urlencode($sbarcode);
if ($search_warehouse) $param.="&search_warehouse=".urlencode($search_warehouse);
if ($catid) $param.="&catid=".urlencode($catid);
if ($toolowstock) $param.="&toolowstock=".urlencode($toolowstock);
if ($search_sale) $param.="&search_sale=".urlencode($search_sale);
if ($search_categ) $param.="&search_categ=".urlencode($search_categ);
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
@@ -349,6 +349,8 @@ if ($resql)
$product_static->label = $objp->label;
$product_static->type=$objp->fk_product_type;
$product_static->entity=$objp->entity;
$product_static->status=$objp->tosell;
$product_static->status_buy=$objp->tobuy;
$product_static->status_batch=$objp->tobatch;
$product_lot_static->batch=$objp->batch;

View File

@@ -701,10 +701,12 @@ class Entrepot extends CommonObject
$label = '<u>' . $langs->trans("ShowWarehouse").'</u>';
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref);
if (! empty($this->lieu))
if (! empty($this->lieu)) {
$label.= '<br><b>' . $langs->trans('LocationSummary').':</b> '.$this->lieu;
if (isset($this->statut))
}
if (isset($this->statut)) {
$label.= '<br><b>' . $langs->trans("Status").":</b> ".$this->getLibStatut(5);
}
$url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id;

View File

@@ -195,12 +195,12 @@ if ($action == "correct_stock")
if ($product->hasbatch())
{
$batch = GETPOST('batch_number');
$batch = GETPOST('batch_number', 'alphanohtml');
//$eatby=GETPOST('eatby');
//$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'));
$eatby = dol_mktime(0, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int'));
$sellby = dol_mktime(0, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int'));
$result = $product->correct_stock_batch(
$user,
@@ -210,7 +210,7 @@ if ($action == "correct_stock")
GETPOST("label", 'san_alpha'),
GETPOST('unitprice'),
$eatby, $sellby, $batch,
GETPOST('inventorycode'),
GETPOST('inventorycode', 'alphanohtml'),
$origin_element,
$origin_id
); // We do not change value of stock for a correction
@@ -224,7 +224,7 @@ if ($action == "correct_stock")
GETPOST("mouvement"),
GETPOST("label", 'san_alpha'),
GETPOST('unitprice'),
GETPOST('inventorycode'),
GETPOST('inventorycode', 'alphanohtml'),
$origin_element,
$origin_id
); // We do not change value of stock for a correction
@@ -329,7 +329,7 @@ if ($action == "transfert_stock" && !$cancel)
else
{
$srcwarehouseid = $id;
$batch = GETPOST('batch_number');
$batch = GETPOST('batch_number', 'alphanohtml');
$eatby = $d_eatby;
$sellby = $d_sellby;
}
@@ -356,7 +356,7 @@ if ($action == "transfert_stock" && !$cancel)
GETPOST("label", 'san_alpha'),
$pricedest,
$eatby, $sellby, $batch,
GETPOST('inventorycode')
GETPOST('inventorycode', 'alphanohtml')
);
}
}
@@ -368,9 +368,9 @@ if ($action == "transfert_stock" && !$cancel)
$id,
GETPOST("nbpiece"),
1,
GETPOST("label"),
GETPOST("label", 'san_alpha'),
$pricesrc,
GETPOST('inventorycode')
GETPOST('inventorycode', 'alphanohtml')
);
// Add stock
@@ -379,9 +379,9 @@ if ($action == "transfert_stock" && !$cancel)
GETPOST("id_entrepot_destination"),
GETPOST("nbpiece"),
0,
GETPOST("label"),
GETPOST("label", 'san_alpha'),
$pricedest,
GETPOST('inventorycode')
GETPOST('inventorycode', 'alphanohtml')
);
}
if (!$error && $result1 >= 0 && $result2 >= 0)
@@ -424,7 +424,7 @@ $formother = new FormOther($db);
$formproduct = new FormProduct($db);
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,";
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tosell, p.tobuy, p.tobatch, p.fk_product_type as type, p.entity,";
$sql .= " e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,";
$sql .= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql .= " m.batch, m.price,";
@@ -976,6 +976,8 @@ if ($resql)
$productstatic->label = $objp->produit;
$productstatic->type = $objp->type;
$productstatic->entity = $objp->entity;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->status_batch = $objp->tobatch;
$productlot->id = $objp->lotid;

View File

@@ -214,6 +214,8 @@ $sql.= " t.import_key,";
$sql.= " p.fk_product_type as product_type,";
$sql.= " p.ref as product_ref,";
$sql.= " p.label as product_label,";
$sql.= " p.tosell,";
$sql.= " p.tobuy,";
$sql.= " p.tobatch";
// Add fields for extrafields
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
@@ -300,7 +302,7 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'products', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'barcode', 0, '', '', $limit);
$topicmail = "Information";
$modelmail = "productlot";
@@ -418,6 +420,7 @@ if ($resql)
if ($obj)
{
$productlot->id = $obj->rowid;
$productlot->status = $obj->tosell;
$productlot->batch = $obj->batch;
// You can use here results
@@ -438,7 +441,10 @@ if ($resql)
$productstatic->type = $obj->product_type;
$productstatic->ref = $obj->product_ref;
$productstatic->label = $obj->product_label;
$productstatic->status = $obj->tosell;
$productstatic->status_buy = $obj->tobuy;
$productstatic->status_batch = $obj->tobatch;
print '<td>'.$productstatic->getNomUrl(1).'</td>';
if (!$i) $totalarray['nbfield']++;
}

View File

@@ -229,7 +229,7 @@ if (empty($reshook))
dol_print_error($db, $object->error);
}
// Create askprice
// Create supplier proposal
elseif ($action == 'add' && $user->rights->supplier_proposal->creer)
{
$object->socid = $socid;
@@ -630,7 +630,7 @@ if (empty($reshook))
elseif (GETPOST('idprodfournprice', 'alpha') > 0)
{
//$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat.
$qtytosearch = -1; // We force qty to -1 to be sure to find if a supplier price exist
$qtytosearch = -1; // We force qty to -1 to be sure to find if the supplier price that exists
$idprod = $productsupplier->get_buyprice(GETPOST('idprodfournprice', 'alpha'), $qtytosearch);
$res = $productsupplier->fetch($idprod);
}
@@ -660,7 +660,8 @@ if (empty($reshook))
$pu_ht = $productsupplier->fourn_pu;
if (empty($pu_ht)) $pu_ht = 0; // If pu is '' or null, we force to have a numeric value
$fournprice = 0;
// If GETPOST('idprodfournprice') is a numeric, we can use it. If it is empty or if it is 'idprod_123', we should use -1 (not used)
$fournprice = (is_numeric(GETPOST('idprodfournprice', 'alpha')) ? GETPOST('idprodfournprice', 'alpha') : -1);
$buyingprice = 0;
$result = $object->addline(

View File

@@ -388,7 +388,7 @@ class SupplierProposal extends CommonObject
* @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!)
* @param int $fk_parent_line Id of parent line
* @param int $fk_fournprice Id supplier price
* @param int $fk_fournprice Id supplier price. If 0, we will take best price. If -1 we keep it empty.
* @param int $pa_ht Buying price without tax
* @param string $label ???
* @param array $array_option extrafields array
@@ -583,15 +583,16 @@ class SupplierProposal extends CommonObject
// infos marge
if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
// by external module, take lowest buying price
// When fk_fournprice is 0, we take the lowest buying price
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$productFournisseur = new ProductFournisseur($this->db);
$productFournisseur->find_min_price_product_fournisseur($fk_product);
$this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
} else {
$this->line->fk_fournprice = $fk_fournprice;
$this->line->fk_fournprice = ($fk_fournprice > 0 ? $fk_fournprice : 0); // If fk_fournprice is -1, we will not use fk_fournprice
}
$this->line->pa_ht = $pa_ht;
//var_dump($this->line->fk_fournprice);exit;
// Multicurrency
$this->line->fk_multicurrency = $this->fk_multicurrency;

View File

@@ -148,9 +148,9 @@ if ($action != 'edit') {
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
}
print '<table class="border" style="width: 100%">';
print '<table class="border centpercent tableforfield">';
print '<tr>';
print '<td class="titlefield fieldrequired">'.$langs->trans('Ref').'</td>';
print '<td class="titlefield'.($action == 'edit' ? ' fieldrequired' : '').'">'.$langs->trans('Ref').'</td>';
print '<td>';
if ($action == 'edit') {
print '<input type="text" name="ref" value="'.$object->ref.'">';
@@ -160,7 +160,7 @@ if ($action == 'edit') {
print '</td>';
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('Label').'</td>';
print '<td'.($action == 'edit' ? ' class="fieldrequired"' : '').'>'.$langs->trans('Label').'</td>';
print '<td>';
if ($action == 'edit') {
print '<input type="text" name="label" value="'.$object->label.'">';