NEW Can edit a label for each price segment when using several segment

prices for products.
This commit is contained in:
Laurent Destailleur 2016-08-29 16:30:31 +02:00
parent f7c89b0044
commit cd1a12c686
2 changed files with 33 additions and 5 deletions

View File

@ -136,7 +136,7 @@ print '<br>';
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
$urlwikitranslatordoc='https://wiki.dolibarr.org/index.php/Translator_documentation';
print ' ('.$langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$urlwikitranslatordoc.'</a>)<br>';
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("TranslatedStringToShow"))."<br>\n";
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("NewTranslationStringToShow"))."<br>\n";
print '<br>';

View File

@ -92,6 +92,14 @@ if (empty($reshook))
$search_soc = '';
}
if ($action == 'setlabelsellingprice' && $user->admin)
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
$keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.GETPOST('pricelevel');
dolibarr_set_const($db, $keyforlabel, GETPOST('labelsellingprice','alpha'), 'chaine', 0, '', $conf->entity);
$action = '';
}
if (($action == 'update_vat') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
{
$tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)'
@ -661,7 +669,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
$soc->fetch($socid);
// Selling price
print '<tr><td class="titlefield">' . $langs->trans("SellingPrice") . '</td>';
print '<tr><td class="titlefield">';
print $langs->trans("SellingPrice");
print '</td>';
print '<td colspan="2">';
if ($object->multiprices_base_type[$soc->price_level] == 'TTC') {
print price($object->multiprices_ttc[$soc->price_level]);
@ -722,16 +732,34 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
print '</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>';
print '<tr class="liste_titre"><td style="text-align: center">';
print $langs->trans("PriceLevel");
if ($user->admin) print ' <a href="'.$_SERVER["PHP_SELF"].'?action=editlabelsellingprice&amp;pricelevel='.$i.'&amp;id='.$object->id.'">'.img_edit($langs->trans('EditSellingPriceLabel'),0).'</a>';
print '</td><td style="text-align: center">'.$langs->trans("SellingPrice").'</td><td style="text-align: center">'.$langs->trans("MinPrice").'</td></tr>';
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
{
print '<tr>';
// Label of price
print '<td>' . $langs->trans("SellingPrice") . ' ' . $i;
print '<td>';
$keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i;
if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
if (preg_match('/editlabelsellingprice/', $action))
{
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setlabelsellingprice">';
print '<input type="hidden" name="pricelevel" value="'.$i.'">';
print $langs->trans("SellingPrice") . ' ' . $i.' - ';
print '<input size="10" class="maxwidthonsmartphone" type="text" name="labelsellingprice" value="'.$conf->global->$keyforlabel.'">';
print '&nbsp;<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
}
else
{
print $langs->trans("SellingPrice") . ' ' . $i;
if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
}
print '</td>';
if ($object->multiprices_base_type [$i] == 'TTC') {