Fix: The text "All" is not appropriate.

This commit is contained in:
Laurent Destailleur 2016-02-14 20:48:25 +01:00
parent e9ffbd1406
commit b7ae5bac6f
2 changed files with 28 additions and 16 deletions

View File

@ -894,7 +894,7 @@ class Form
* @param string $selected Preselected type * @param string $selected Preselected type
* @param string $htmlname Name of field in form * @param string $htmlname Name of field in form
* @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)') * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)')
* @param int $showempty Add an empty field * @param string $showempty Add an empty field (Can be '1' or text to use on empty line)
* @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box * @param int $forcecombo Force to use combo box
* @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
@ -903,7 +903,7 @@ class Form
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @return string HTML string with select box for thirdparty. * @return string HTML string with select box for thirdparty.
*/ */
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='') function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='')
{ {
$out=''; $out='';
@ -949,7 +949,7 @@ class Form
* @param string $selected Preselected type * @param string $selected Preselected type
* @param string $htmlname Name of field in form * @param string $htmlname Name of field in form
* @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)') * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)')
* @param int $showempty Add an empty field * @param string $showempty Add an empty field (Can be '1' or text to use on empty line)
* @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $showtype Show third party type in combolist (customer, prospect or supplier)
* @param int $forcecombo Force to use combo box * @param int $forcecombo Force to use combo box
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
@ -960,7 +960,7 @@ class Form
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @return string HTML string with * @return string HTML string with
*/ */
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='') function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='')
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
@ -1017,10 +1017,13 @@ class Form
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparam?' '.$moreparam:'').' name="'.$htmlname.'"'.$nodatarole.'>'."\n"; $out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparam?' '.$moreparam:'').' name="'.$htmlname.'"'.$nodatarole.'>'."\n";
$textifempty=''; $textifempty='';
// Do not use textempty = ' ' or '&nbsp;' here, or search on key will search on ' key'. // Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
//$textifempty=' ';
//if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty=''; //if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) $textifempty.=$langs->trans("All"); if (! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT))
{
if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty);
else $textifempty.=$langs->trans("All");
}
if ($showempty) $out.= '<option value="-1">'.$textifempty.'</option>'."\n"; if ($showempty) $out.= '<option value="-1">'.$textifempty.'</option>'."\n";
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);

View File

@ -44,6 +44,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$langs->load("products"); $langs->load("products");
$langs->load("bills"); $langs->load("bills");
$langs->load("companies");
$mesg=''; $error=0; $errors=array(); $mesg=''; $error=0; $errors=array();
@ -346,8 +347,16 @@ if (empty($reshook))
$prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx"));
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
if (! ($prodcustprice->fk_soc > 0))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
$error++;
$action='add_customer_price';
}
if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier) if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier)
{ {
$langs->load("errors");
setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors'); setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
$error++; $error++;
$action='add_customer_price'; $action='add_customer_price';
@ -548,7 +557,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
print '<tr><td>' . $langs->trans("PriceByQuantity") . ' ' . $i; print '<tr><td>' . $langs->trans("PriceByQuantity") . ' ' . $i;
print '</td><td>'; print '</td><td>';
if ($object->prices_by_qty [$i] == 1) { if ($object->prices_by_qty[$i] == 1) {
print '<table width="50%" class="border" summary="List of quantities">'; print '<table width="50%" class="border" summary="List of quantities">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -558,7 +567,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
print '<td align="right">' . $langs->trans("Discount") . '</td>'; print '<td align="right">' . $langs->trans("Discount") . '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
foreach ($object->prices_by_qty_list [$i] as $ii => $prices) { foreach ($object->prices_by_qty_list[$i] as $ii => $prices) {
if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) { if ($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) {
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">'; print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
print '<input type="hidden" name="action" value="update_price_by_qty">'; print '<input type="hidden" name="action" value="update_price_by_qty">';
@ -574,7 +583,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
print '</form>'; print '</form>';
} else { } else {
print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">'; print '<tr class="' . ($ii % 2 == 0 ? 'pair' : 'impair') . '">';
print '<td>' . $prices ['quantity'] . '</td>'; print '<td>' . $prices['quantity'] . '</td>';
print '<td align="right">' . price($prices['price']) . '</td>'; print '<td align="right">' . price($prices['price']) . '</td>';
print '<td align="right">' . price($prices['unitprice']) . '</td>'; print '<td align="right">' . price($prices['unitprice']) . '</td>';
print '<td align="right">' . price($prices['remise_percent']) . ' %</td>'; print '<td align="right">' . price($prices['remise_percent']) . ' %</td>';
@ -1177,7 +1186,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
if ($action == 'add_customer_price') if ($action == 'add_customer_price')
{ {
// Create mode // Form to add a new customer price
$maxpricesupplier = $object->min_recommended_price(); $maxpricesupplier = $object->min_recommended_price();
print load_fiche_titre($langs->trans('PriceByCustomer')); print load_fiche_titre($langs->trans('PriceByCustomer'));
@ -1188,19 +1197,19 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '<input type="hidden" name="id" value="' . $object->id . '">'; print '<input type="hidden" name="id" value="' . $object->id . '">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans('ThirdParty') . '</td>'; print '<td class="fieldrequired">' . $langs->trans('ThirdParty') . '</td>';
print '<td>'; print '<td>';
print $form->select_company('', 'socid', 's.client in (1,2,3) AND s.rowid NOT IN (SELECT fk_soc FROM ' . MAIN_DB_PREFIX . 'product_customer_price WHERE fk_product='.$object->id.')', 1, 0, 0, array(), 0, 'minwidth300'); print $form->select_company('', 'socid', 's.client in (1,2,3) AND s.rowid NOT IN (SELECT fk_soc FROM ' . MAIN_DB_PREFIX . 'product_customer_price WHERE fk_product='.$object->id.')', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// VAT // VAT
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>'; print '<tr><td class="fieldrequired">' . $langs->trans("VATRate") . '</td><td>';
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr);
print '</td></tr>'; print '</td></tr>';
// Price base // Price base
print '<tr><td width="15%">'; print '<tr><td class="fieldrequired">';
print $langs->trans('PriceBase'); print $langs->trans('PriceBase');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
@ -1209,7 +1218,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '</tr>'; print '</tr>';
// Price // Price
print '<tr><td width="20%">'; print '<tr><td class="fieldrequired">';
$text = $langs->trans('SellingPrice'); $text = $langs->trans('SellingPrice');
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
print '</td><td>'; print '</td><td>';