FIX translate update prices and add const in proposal setup

This commit is contained in:
lvessiller 2022-03-08 10:06:57 +01:00
parent 6c172d6441
commit 2561fcbb85
6 changed files with 57 additions and 4 deletions

View File

@ -198,6 +198,37 @@ if ($action == 'updateMask') {
// par appel methode canBeActivated
dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif (preg_match('/set_(.*)/',$action,$reg)) {
$code = $reg[1];
$value=(GETPOST($code) ? GETPOST($code) : 1);
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if ($error) {
setEventMessages($langs->trans('Error'), null, 'errors');
} else {
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
header("Location: " . $_SERVER["PHP_SELF"]);
exit();
}
} elseif (preg_match('/del_(.*)/',$action,$reg)) {
$code = $reg[1];
$res = dolibarr_del_const($db, $code, $conf->entity);
if (!($res > 0)) {
$error++;
}
if ($error) {
setEventMessages($langs->trans('Error'), null, 'errors');
} else {
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
header("Location: " . $_SERVER["PHP_SELF"]);
exit();
}
}
@ -593,6 +624,26 @@ print '<td class="right"><input type="submit" class="button button-edit" value="
print '</tr>';
print '</form>';
// default update prices on cloning a proposal
print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '">';
print '<input type="hidden" name="token" value="' . newToken() .'">';
print '<tr class="oddeven">';
print '<td>' . $langs->trans('DefaultPuttingPricesUpToDate').'</td>';
print '<td></td>';
print '<td class="right">';
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff('PROPOSAL_CLONE_UPDATE_PRICES', array(), $conf->entity, 0, 0, 1, 0);
} else {
if (empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES)) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_PROPOSAL_CLONE_UPDATE_PRICES">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_PROPOSAL_CLONE_UPDATE_PRICES">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
}
}
print '</td>';
print '</tr>';
print '</form>';
/*
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -220,7 +220,7 @@ if (empty($reshook)) {
}
}
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), GETPOSTISSET('update_prices'));
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false));
if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit();
@ -1915,7 +1915,7 @@ if ($action == 'create') {
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')),
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 1),
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)),
);
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);

View File

@ -412,4 +412,4 @@ SwitchOnSaleStatus=Switch on sale status
SwitchOnPurchaseStatus=Switch on purchase status
StockMouvementExtraFields= Extra Fields (stock mouvement)
InventoryExtraFields= Extra Fields (inventory)
PuttingPricesUpToDate=Update prices
PuttingPricesUpToDate=Update prices with current known prices

View File

@ -54,6 +54,7 @@ NoDraftProposals=No draft proposals
CopyPropalFrom=Create commercial proposal by copying existing proposal
CreateEmptyPropal=Create empty commercial proposal or from list of products/services
DefaultProposalDurationValidity=Default commercial proposal validity duration (in days)
DefaultPuttingPricesUpToDate=By default update prices with current known prices on cloning a proposal
UseCustomerContactAsPropalRecipientIfExist=Use contact/address with type 'Contact following-up proposal' if defined instead of third party address as proposal recipient address
ConfirmClonePropal=Are you sure you want to clone the commercial proposal <b>%s</b>?
ConfirmReOpenProp=Are you sure you want to open back the commercial proposal <b>%s</b>?

View File

@ -411,4 +411,4 @@ Rank=Classement
SwitchOnSaleStatus=Basculer le statut En vente
SwitchOnPurchaseStatus=Basculer le statut En achat
StockMouvementExtraFields= Champs supplémentaires (mouvement de stock)
PuttingPricesUpToDate=Mettre à jour les tarifs
PuttingPricesUpToDate=Mettre à jour les prix

View File

@ -54,6 +54,7 @@ NoDraftProposals=Pas de propositions brouillons
CopyPropalFrom=Créer proposition/devis par recopie d'un proposition existante
CreateEmptyPropal=Créer proposition/devis vierge ou avec la liste des produits/services
DefaultProposalDurationValidity=Délai de validité par défaut (en jours)
DefaultPuttingPricesUpToDate=Par défaut, mettre à jour les prix lors de clonage d'une proposition commerciale
UseCustomerContactAsPropalRecipientIfExist=Utiliser l'adresse de 'contact suivi client' si définie plutôt que l'adresse du tiers comme destinataire des propositions
ConfirmClonePropal=Êtes-vous sûr de vouloir cloner la proposition commerciale <b>%s</b> ?
ConfirmReOpenProp=Êtes-vous sûr de vouloir réouvrir la proposition commerciale <b>%s</b> ?