Fix: add customer_ref in propal list and clean code
This commit is contained in:
parent
533d862470
commit
1c2f192dd6
@ -104,9 +104,9 @@ if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc
|
|||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
if ($search_categ) $sql.= " AND s.rowid = cs.fk_societe"; // Join for the needed table to filter by categ
|
if ($search_categ) $sql.= " AND s.rowid = cs.fk_societe"; // Join for the needed table to filter by categ
|
||||||
if ($search_nom) $sql.= " AND s.nom like '%".$db->escape(strtolower($search_nom))."%'";
|
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape(strtolower($search_nom))."%'";
|
||||||
if ($search_ville) $sql.= " AND s.ville like '%".$db->escape(strtolower($search_ville))."%'";
|
if ($search_ville) $sql.= " AND s.ville LIKE '%".$db->escape(strtolower($search_ville))."%'";
|
||||||
if ($search_code) $sql.= " AND s.code_client like '%".$db->escape(strtolower($search_code))."%'";
|
if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape(strtolower($search_code))."%'";
|
||||||
if ($search_compta) $sql .= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'";
|
if ($search_compta) $sql .= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'";
|
||||||
// Insert sale filter
|
// Insert sale filter
|
||||||
if ($search_sale)
|
if ($search_sale)
|
||||||
@ -120,7 +120,7 @@ if ($search_categ)
|
|||||||
}
|
}
|
||||||
if ($socname)
|
if ($socname)
|
||||||
{
|
{
|
||||||
$sql.= " AND s.nom like '%".$db->escape(strtolower($socname))."%'";
|
$sql.= " AND s.nom LIKE '%".$db->escape(strtolower($socname))."%'";
|
||||||
$sortfield = "s.nom";
|
$sortfield = "s.nom";
|
||||||
$sortorder = "ASC";
|
$sortorder = "ASC";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,7 @@ $confirm=GETPOST('confirm','alpha');
|
|||||||
$lineid=GETPOST('lineid','int');
|
$lineid=GETPOST('lineid','int');
|
||||||
|
|
||||||
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
|
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
|
||||||
|
$search_refcustomer=GETPOST('search_refcustomer','alpha');
|
||||||
$search_societe=GETPOST('search_societe','alpha');
|
$search_societe=GETPOST('search_societe','alpha');
|
||||||
$search_montant_ht=GETPOST('search_montant_ht','alpha');
|
$search_montant_ht=GETPOST('search_montant_ht','alpha');
|
||||||
|
|
||||||
@ -1567,16 +1568,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php');
|
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO test using div instead of tables
|
|
||||||
//print '<div class="table" id="tablelines">';
|
|
||||||
print '<table id="tablelines" class="noborder" width="100%">';
|
print '<table id="tablelines" class="noborder" width="100%">';
|
||||||
|
|
||||||
// Show object lines
|
// Show object lines
|
||||||
$result = $object->getLinesArray();
|
$result = $object->getLinesArray();
|
||||||
if (! empty($object->lines)) $object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager);
|
if (! empty($object->lines)) $object->printObjectLines($action,$mysoc,$soc,$lineid,0,$hookmanager);
|
||||||
|
|
||||||
//print '<table id="tablelines" class="noborder" width="100%">';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Form to add new line
|
* Form to add new line
|
||||||
*/
|
*/
|
||||||
@ -1601,9 +1598,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO test using div instead of tables
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
//print '</div>';
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -1872,7 +1867,7 @@ else
|
|||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
|
|
||||||
$sql = 'SELECT s.nom, s.rowid, s.client, ';
|
$sql = 'SELECT s.nom, s.rowid, s.client, ';
|
||||||
$sql.= 'p.rowid as propalid, p.total_ht, p.ref, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
$sql.= 'p.rowid as propalid, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||||
$sql.= ' u.login';
|
$sql.= ' u.login';
|
||||||
$sql.= ' FROM ('.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p';
|
$sql.= ' FROM ('.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p';
|
||||||
@ -1891,6 +1886,10 @@ else
|
|||||||
{
|
{
|
||||||
$sql.= " AND p.ref LIKE '%".$db->escape(trim($search_ref))."%'";
|
$sql.= " AND p.ref LIKE '%".$db->escape(trim($search_ref))."%'";
|
||||||
}
|
}
|
||||||
|
if ($search_refcustomer)
|
||||||
|
{
|
||||||
|
$sql.= " AND p.ref_client LIKE '%".$db->escape(trim($search_refcustomer))."%'";
|
||||||
|
}
|
||||||
if ($search_societe)
|
if ($search_societe)
|
||||||
{
|
{
|
||||||
$sql.= " AND s.nom LIKE '%".$db->escape(trim($search_societe))."%'";
|
$sql.= " AND s.nom LIKE '%".$db->escape(trim($search_societe))."%'";
|
||||||
@ -1944,6 +1943,7 @@ else
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||||
@ -1961,11 +1961,13 @@ else
|
|||||||
print '<td class="liste_titre" align="left">';
|
print '<td class="liste_titre" align="left">';
|
||||||
print '<input class="flat" type="text" size="16" name="search_societe" value="'.$search_societe.'">';
|
print '<input class="flat" type="text" size="16" name="search_societe" value="'.$search_societe.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input class="flat" size="10" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre" colspan="1" align="center">';
|
print '<td class="liste_titre" colspan="1" align="center">';
|
||||||
print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||||
print ' '.$langs->trans('Year').': ';
|
print ' '.$langs->trans('Year').': ';
|
||||||
$syear = $year;
|
$syear = $year;
|
||||||
//if($syear == '') $syear = date("Y");
|
|
||||||
$formother->select_year($syear,'year',1, 20, 5);
|
$formother->select_year($syear,'year',1, 20, 5);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre" colspan="1"> </td>';
|
print '<td class="liste_titre" colspan="1"> </td>';
|
||||||
@ -2027,6 +2029,11 @@ else
|
|||||||
print $companystatic->getNomUrl(1,'customer');
|
print $companystatic->getNomUrl(1,'customer');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Customer ref
|
||||||
|
print '<td nowrap="nowrap">';
|
||||||
|
print $objp->ref_client;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Date propale
|
// Date propale
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
$y = dol_print_date($db->jdate($objp->dp),'%Y');
|
$y = dol_print_date($db->jdate($objp->dp),'%Y');
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -2365,23 +2365,6 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
// TODO test using div instead of tables
|
|
||||||
/*
|
|
||||||
print '<div class="table" id="tablelines">';
|
|
||||||
print '<div class="thead">';
|
|
||||||
print '<div class="tr">';
|
|
||||||
print '<div class="td firstcol">'.$langs->trans('Description').'</div>';
|
|
||||||
print '<div class="td">'.$langs->trans('VAT').'</div>';
|
|
||||||
print '<div class="td">'.$langs->trans('PriceUHT').'</div>';
|
|
||||||
print '<div class="td">'.$langs->trans('Qty').'</div>';
|
|
||||||
print '<div class="td">'.$langs->trans('ReductionShort').'</div>';
|
|
||||||
print '<div class="td">'.$langs->trans('TotalHTShort').'</div>';
|
|
||||||
print '<div class="td endcol"> </div>';
|
|
||||||
print '<div class="td endcol"> </div>';
|
|
||||||
print '<div class="td end"> </div>';
|
|
||||||
print '</div></div>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '<tr class="liste_titre nodrag nodrop">';
|
print '<tr class="liste_titre nodrag nodrop">';
|
||||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||||
{
|
{
|
||||||
@ -2402,8 +2385,6 @@ abstract class CommonObject
|
|||||||
$var = true;
|
$var = true;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
//print '<div class="tbody">';
|
|
||||||
|
|
||||||
foreach ($this->lines as $line)
|
foreach ($this->lines as $line)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -2423,8 +2404,6 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//print '</div></div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2450,9 +2429,6 @@ abstract class CommonObject
|
|||||||
global $conf,$langs,$user;
|
global $conf,$langs,$user;
|
||||||
global $form,$bc,$bcdd;
|
global $form,$bc,$bcdd;
|
||||||
|
|
||||||
$element = $this->element;
|
|
||||||
if ($element == 'propal') $element = 'propale'; // To work with non standard path
|
|
||||||
|
|
||||||
// Show product and description
|
// Show product and description
|
||||||
$type=$line->product_type?$line->product_type:$line->fk_product_type;
|
$type=$line->product_type?$line->product_type:$line->fk_product_type;
|
||||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||||
@ -2486,7 +2462,8 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $line->product_label;
|
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $line->product_label;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
$label = $line->product_label;
|
$label = $line->product_label;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2500,7 +2477,6 @@ abstract class CommonObject
|
|||||||
|
|
||||||
// Use global variables + $seller and $buyer
|
// Use global variables + $seller and $buyer
|
||||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_view.tpl.php');
|
include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductline_view.tpl.php');
|
||||||
//include(DOL_DOCUMENT_ROOT.'/core/tpl/predefinedproductlinediv_view.tpl.php');
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -688,7 +688,7 @@ class FormOther
|
|||||||
$currentyear = date("Y")+$offset;
|
$currentyear = date("Y")+$offset;
|
||||||
$max_year = $currentyear+$max_year;
|
$max_year = $currentyear+$max_year;
|
||||||
$min_year = $currentyear-$min_year;
|
$min_year = $currentyear-$min_year;
|
||||||
if(empty($selected)) $selected = $currentyear;
|
if(empty($selected) && empty($useempty)) $selected = $currentyear;
|
||||||
|
|
||||||
$out.= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >';
|
$out.= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '"'.$option.' >';
|
||||||
if($useempty)
|
if($useempty)
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
|
||||||
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
|
||||||
|
|
||||||
<div class="tr pair" <?php echo 'id="row-'.$line->id.'"'; ?>>
|
|
||||||
<div class="td firstcol">
|
|
||||||
<div id="<?php echo $line->id; ?>"></div>
|
|
||||||
<?php
|
|
||||||
echo $form->textwithtooltip($text,$description,3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
|
|
||||||
|
|
||||||
// Show range
|
|
||||||
print_date_range($line->date_start, $line->date_end);
|
|
||||||
|
|
||||||
// Add description in form
|
|
||||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
|
||||||
{
|
|
||||||
print ($line->description && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="td"><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></div>
|
|
||||||
|
|
||||||
<div class="td"><?php echo price($line->subprice); ?></div>
|
|
||||||
|
|
||||||
<div class="td">
|
|
||||||
<?php if ((($line->info_bits & 2) != 2) && $line->special_code != 3) echo $line->qty;
|
|
||||||
else echo ' '; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="td">
|
|
||||||
<?php if (!empty($line->remise_percent) && $line->special_code != 3) {
|
|
||||||
echo dol_print_reduction($line->remise_percent,$langs);
|
|
||||||
} else {
|
|
||||||
echo ' ';
|
|
||||||
} ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="td">
|
|
||||||
<?php if ($line->special_code == 3) {
|
|
||||||
echo $langs->trans('Option');
|
|
||||||
} else {
|
|
||||||
echo price($line->total_ht);
|
|
||||||
} ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($this->statut == 0 && $user->rights->$element->creer) { ?>
|
|
||||||
<div class="td endcol">
|
|
||||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
|
||||||
<?php } else { ?>
|
|
||||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'#'.$line->id; ?>">
|
|
||||||
<?php echo img_edit(); ?>
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="td endcol">
|
|
||||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=ask_deleteline&lineid='.$line->id; ?>">
|
|
||||||
<?php echo img_delete(); ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($num > 1) { ?>
|
|
||||||
<div class="td end tdlineupdown">
|
|
||||||
<?php if ($i > 0) { ?>
|
|
||||||
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id; ?>">
|
|
||||||
<?php echo img_up(); ?>
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
<?php if ($i < $num-1) { ?>
|
|
||||||
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id; ?>">
|
|
||||||
<?php echo img_down(); ?>
|
|
||||||
</a>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
<?php } else { ?>
|
|
||||||
<div class="td endcol tdlineupdown"> </div>
|
|
||||||
<?php } ?>
|
|
||||||
<?php } else { ?>
|
|
||||||
<div class="td endcol"> </div>
|
|
||||||
<div class="td endcol"> </div>
|
|
||||||
<div class="td end"> </div>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- END PHP TEMPLATE predefinedproductline_view.tpl.php -->
|
|
||||||
Loading…
Reference in New Issue
Block a user