diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php
index 85f37143748..43814ccb377 100644
--- a/htdocs/admin/expedition.php
+++ b/htdocs/admin/expedition.php
@@ -64,8 +64,8 @@ if ($action == 'updateMask')
if (isset($res))
{
- if ($res < 0)
- setEventMessage($langs->trans("SetupSaved"));
+ if ($res < 0)
+ setEventMessage($langs->trans("SetupSaved"));
else
setEventMessage($langs->trans("Error"), 'errors');
}
@@ -87,9 +87,9 @@ else if ($action == 'set_SHIPPING_DRAFT_WATERMARK')
$draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
- if ($res < 0)
- setEventMessage($langs->trans("SetupSaved"));
- else
+ if ($res < 0)
+ setEventMessage($langs->trans("SetupSaved"));
+ else
setEventMessage($langs->trans("Error"), 'errors');
}
@@ -153,22 +153,22 @@ else if ($action == 'del')
}
}
-// Set default model
-else if ($action == 'setdoc')
-{
- if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
- {
- // La constante qui a ete lue en avant du nouveau set
- // on passe donc par une variable pour avoir un affichage coherent
- $conf->global->EXPEDITION_ADDON_PDF = $value;
- }
-
- // On active le modele
- $ret = delDocumentModel($value, $type);
- if ($ret > 0)
- {
- $ret = addDocumentModel($value, $type, $label, $scandir);
- }
+// Set default model
+else if ($action == 'setdoc')
+{
+ if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
+ {
+ // La constante qui a ete lue en avant du nouveau set
+ // on passe donc par une variable pour avoir un affichage coherent
+ $conf->global->EXPEDITION_ADDON_PDF = $value;
+ }
+
+ // On active le modele
+ $ret = delDocumentModel($value, $type);
+ if ($ret > 0)
+ {
+ $ret = addDocumentModel($value, $type, $label, $scandir);
+ }
}
else if ($action == 'setmodel')
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 8d11fbc7e94..0447129381c 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -645,10 +645,10 @@ else if ($action == "addline" && $user->rights->propal->creer)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
$error++;
}
- if (empty($idprod) && ! GETPOST('product_desc'))
- {
- setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors');
- $error++;
+ if (empty($idprod) && ! GETPOST('product_desc'))
+ {
+ setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors');
+ $error++;
}
if (! $error && (GETPOST('qty') >= 0) && (GETPOST('product_desc') || ! empty($idprod)))
@@ -723,27 +723,27 @@ else if ($action == "addline" && $user->rights->propal->creer)
} else {
- // Define output language
- if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
- {
- $outputlangs = $langs;
- $newlang='';
- if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
- if (empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
-
- $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
- }
- else
- {
- $desc = $prod->description;
+ // Define output language
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
+ {
+ $outputlangs = $langs;
+ $newlang='';
+ if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
+ if (empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
+ }
+ else
+ {
+ $desc = $prod->description;
}
- $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"
\n":"\n") : "";
+ $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"
\n":"\n") : "";
$desc.= GETPOST('product_desc');
}
@@ -762,11 +762,11 @@ else if ($action == "addline" && $user->rights->propal->creer)
}
// Margin
- $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
+ $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
- // Local Taxes
- $localtax1_tx= get_localtax($tva_tx, 1, $object->client);
+ // Local Taxes
+ $localtax1_tx= get_localtax($tva_tx, 1, $object->client);
$localtax2_tx= get_localtax($tva_tx, 2, $object->client);
$info_bits=0;
@@ -822,7 +822,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
unset($_POST['qty']);
unset($_POST['type']);
- unset($_POST['idprod']);
+ unset($_POST['idprod']);
unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['price_ttc']);
@@ -858,8 +858,8 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
$localtax2_rate=get_localtax($vat_rate,2,$object->client);
$pu_ht=GETPOST('price_ht');
- // Add buying price
- $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
+ // Add buying price
+ $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
// Define special_code for special lines
@@ -881,22 +881,22 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):'');
- if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
- {
- setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors');
- $error++;
+ if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
+ {
+ setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors');
+ $error++;
}
}
- else
- {
- $type = GETPOST('type');
- $label = (GETPOST('product_label') ? GETPOST('product_label'):'');
-
- // Check parameters
- if (GETPOST('type') < 0) {
- setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
- $error++;
- }
+ else
+ {
+ $type = GETPOST('type');
+ $label = (GETPOST('product_label') ? GETPOST('product_label'):'');
+
+ // Check parameters
+ if (GETPOST('type') < 0) {
+ setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
+ $error++;
+ }
}
if (! $error)
@@ -920,49 +920,49 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
$label
);
- if ($result >= 0)
- {
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ if ($result >= 0)
+ {
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
- // Define output language
- $outputlangs = $langs;
- $newlang='';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
+ // Define output language
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
- $ret=$object->fetch($id); // Reload to get new records
+ $ret=$object->fetch($id); // Reload to get new records
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
}
- unset($_POST['qty']);
- unset($_POST['type']);
- unset($_POST['productid']);
- unset($_POST['remise_percent']);
- unset($_POST['price_ht']);
- unset($_POST['price_ttc']);
- unset($_POST['tva_tx']);
- unset($_POST['product_ref']);
- unset($_POST['product_label']);
- unset($_POST['product_desc']);
- unset($_POST['fournprice']);
+ unset($_POST['qty']);
+ unset($_POST['type']);
+ unset($_POST['productid']);
+ unset($_POST['remise_percent']);
+ unset($_POST['price_ht']);
+ unset($_POST['price_ttc']);
+ unset($_POST['tva_tx']);
+ unset($_POST['product_ref']);
+ unset($_POST['product_label']);
+ unset($_POST['product_desc']);
+ unset($_POST['fournprice']);
unset($_POST['buying_price']);
}
- else
- {
- setEventMessage($object->error, 'errors');
+ else
+ {
+ setEventMessage($object->error, 'errors');
}
}
}
-else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel'))
-{
- Header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition
- exit;
+else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel'))
+{
+ Header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition
+ exit;
}
// Generation doc (depuis lien ou depuis cartouche doc)
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 4ea2e484a2f..509ef57a856 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -587,22 +587,22 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$price_base_type = $prod->price_base_type;
}
- // Update if prices fields are defined
- if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc')))
- {
- $price_ht=price2num(GETPOST('price_ht'), 'MU');
- $price_ttc=price2num(GETPOST('price_ttc'), 'MU');
-
- if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc)
- {
- $pu_ttc = $price_ttc;
- $pu_ht = price2num($price_ttc / (1 + ($prod->tva_tx / 100)),'MU');
- }
- else if ($price_base_type != 'TTC' && $price_ht != $pu_ht)
- {
- $pu_ht = $price_ht;
- $pu_ttc = price2num($price_ht * (1 + ($prod->tva_tx / 100)),'MU');
- }
+ // Update if prices fields are defined
+ if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc')))
+ {
+ $price_ht=price2num(GETPOST('price_ht'), 'MU');
+ $price_ttc=price2num(GETPOST('price_ttc'), 'MU');
+
+ if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc)
+ {
+ $pu_ttc = $price_ttc;
+ $pu_ht = price2num($price_ttc / (1 + ($prod->tva_tx / 100)),'MU');
+ }
+ else if ($price_base_type != 'TTC' && $price_ht != $pu_ht)
+ {
+ $pu_ht = $price_ht;
+ $pu_ttc = price2num($price_ht * (1 + ($prod->tva_tx / 100)),'MU');
+ }
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
@@ -619,36 +619,36 @@ else if ($action == 'addline' && $user->rights->commande->creer)
}
}
- if (GETPOST('update_desc')) {
-
- $desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
-
- } else {
-
- // Define output language
- if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
- {
- $outputlangs = $langs;
- $newlang='';
- if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
- if (empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
-
- $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
- }
- else
- {
- $desc = $prod->description;
- }
-
- $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"
\n":"\n") : "";
- $desc.= GETPOST('product_desc');
- }
-
+ if (GETPOST('update_desc')) {
+
+ $desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
+
+ } else {
+
+ // Define output language
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
+ {
+ $outputlangs = $langs;
+ $newlang='';
+ if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
+ if (empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
+ }
+ else
+ {
+ $desc = $prod->description;
+ }
+
+ $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"
\n":"\n") : "";
+ $desc.= GETPOST('product_desc');
+ }
+
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):'');
$type = $prod->type;
@@ -664,7 +664,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
}
// Margin
- $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
+ $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
// Local Taxes
@@ -676,61 +676,61 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$info_bits=0;
if ($tva_npr) $info_bits |= 0x01;
- if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
- {
+ if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
+ {
$mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency));
- setEventMessage($mesg, 'errors');
- }
- else
- {
- // Insert line
- $result = $object->addline(
- $object->id,
- $desc,
- $pu_ht,
- GETPOST('qty'),
- $tva_tx,
- $localtax1_tx,
- $localtax2_tx,
- $idprod,
- GETPOST('remise_percent'),
- $info_bits,
- 0,
- $price_base_type,
- $pu_ttc,
- $date_start,
- $date_end,
- $type,
- -1,
+ setEventMessage($mesg, 'errors');
+ }
+ else
+ {
+ // Insert line
+ $result = $object->addline(
+ $object->id,
+ $desc,
+ $pu_ht,
+ GETPOST('qty'),
+ $tva_tx,
+ $localtax1_tx,
+ $localtax2_tx,
+ $idprod,
+ GETPOST('remise_percent'),
+ $info_bits,
0,
- GETPOST('fk_parent_line'),
+ $price_base_type,
+ $pu_ttc,
+ $date_start,
+ $date_end,
+ $type,
+ -1,
+ 0,
+ GETPOST('fk_parent_line'),
$fournprice,
$buyingprice,
- $label
- );
-
- if ($result > 0)
- {
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
- {
- // Define output language
- $outputlangs = $langs;
- $newlang=GETPOST('lang_id','alpha');
- if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
-
- $ret=$object->fetch($object->id); // Reload to get new records
- commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
- }
-
- unset($_POST['qty']);
- unset($_POST['type']);
- unset($_POST['idprod']);
- unset($_POST['remise_percent']);
+ $label
+ );
+
+ if ($result > 0)
+ {
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ {
+ // Define output language
+ $outputlangs = $langs;
+ $newlang=GETPOST('lang_id','alpha');
+ if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $ret=$object->fetch($object->id); // Reload to get new records
+ commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
+ }
+
+ unset($_POST['qty']);
+ unset($_POST['type']);
+ unset($_POST['idprod']);
+ unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
@@ -738,12 +738,12 @@ else if ($action == 'addline' && $user->rights->commande->creer)
unset($_POST['product_label']);
unset($_POST['product_desc']);
unset($_POST['fournprice']);
- unset($_POST['buying_price']);
- }
- else
- {
- setEventMessage($object->error, 'errors');
- }
+ unset($_POST['buying_price']);
+ }
+ else
+ {
+ setEventMessage($object->error, 'errors');
+ }
}
}
}
@@ -833,34 +833,34 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
if ($result >= 0)
{
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
- // Define output language
- $outputlangs = $langs;
- $newlang='';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
-
- $ret=$object->fetch($object->id); // Reload to get new records
+ // Define output language
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $ret=$object->fetch($object->id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
}
- unset($_POST['qty']);
- unset($_POST['type']);
- unset($_POST['productid']);
- unset($_POST['remise_percent']);
- unset($_POST['price_ht']);
- unset($_POST['price_ttc']);
- unset($_POST['tva_tx']);
- unset($_POST['product_ref']);
- unset($_POST['product_label']);
- unset($_POST['product_desc']);
- unset($_POST['fournprice']);
+ unset($_POST['qty']);
+ unset($_POST['type']);
+ unset($_POST['productid']);
+ unset($_POST['remise_percent']);
+ unset($_POST['price_ht']);
+ unset($_POST['price_ttc']);
+ unset($_POST['tva_tx']);
+ unset($_POST['product_ref']);
+ unset($_POST['product_label']);
+ unset($_POST['product_desc']);
+ unset($_POST['fournprice']);
unset($_POST['buying_price']);
}
else
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 86be0bd2fc4..8d7c10787b3 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -68,7 +68,7 @@ $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','al
$search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
-$origin=GETPOST('origin','alpha');
+$origin=GETPOST('origin','alpha');
$originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility
//PDF
@@ -985,9 +985,9 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
}
$ret=$object->fetch_thirdparty();
- // Clean parameters
- $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
- $date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
+ // Clean parameters
+ $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
+ $date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$price_base_type = 'HT';
// Ecrase $pu par celui du produit
@@ -1018,22 +1018,22 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$price_base_type = $prod->price_base_type;
}
- // Update if prices fields are defined
- if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc')))
- {
- $price_ht=price2num(GETPOST('price_ht'), 'MU');
- $price_ttc=price2num(GETPOST('price_ttc'), 'MU');
-
- if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc)
- {
- $pu_ttc = $price_ttc;
- $pu_ht = price2num($price_ttc / (1 + ($prod->tva_tx / 100)),'MU');
- }
- else if ($price_base_type != 'TTC' && $price_ht != $pu_ht)
- {
- $pu_ht = $price_ht;
- $pu_ttc = price2num($price_ht * (1 + ($prod->tva_tx / 100)),'MU');
- }
+ // Update if prices fields are defined
+ if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc')))
+ {
+ $price_ht=price2num(GETPOST('price_ht'), 'MU');
+ $price_ttc=price2num(GETPOST('price_ttc'), 'MU');
+
+ if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc)
+ {
+ $pu_ttc = $price_ttc;
+ $pu_ht = price2num($price_ttc / (1 + ($prod->tva_tx / 100)),'MU');
+ }
+ else if ($price_base_type != 'TTC' && $price_ht != $pu_ht)
+ {
+ $pu_ht = $price_ht;
+ $pu_ttc = price2num($price_ht * (1 + ($prod->tva_tx / 100)),'MU');
+ }
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
@@ -1050,34 +1050,34 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
}
}
- if (GETPOST('update_desc')) {
-
- $desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
-
- } else {
-
- // Define output language
- if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
- {
- $outputlangs = $langs;
- $newlang='';
- if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
- if (empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
-
- $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
- }
- else
- {
- $desc = $prod->description;
- }
-
- $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"
\n":"\n") : "";
- $desc.= GETPOST('product_desc');
+ if (GETPOST('update_desc')) {
+
+ $desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
+
+ } else {
+
+ // Define output language
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
+ {
+ $outputlangs = $langs;
+ $newlang='';
+ if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
+ if (empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
+ }
+ else
+ {
+ $desc = $prod->description;
+ }
+
+ $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"
\n":"\n") : "";
+ $desc.= GETPOST('product_desc');
}
if (! empty($prod->customcode) || ! empty($prod->country_code))
@@ -1104,75 +1104,75 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$type=GETPOST('type');
}
- // Margin
- $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
- $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
-
- // Local Taxes
- $localtax1_tx= get_localtax($tva_tx, 1, $object->client);
+ // Margin
+ $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
+ $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
+
+ // Local Taxes
+ $localtax1_tx= get_localtax($tva_tx, 1, $object->client);
$localtax2_tx= get_localtax($tva_tx, 2, $object->client);
$info_bits=0;
if ($tva_npr) $info_bits |= 0x01;
- if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
- {
+ if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
+ {
$mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency));
- setEventMessage($mesg, 'errors');
- }
- else
- {
- // Insert line
- $result = $object->addline(
- $id,
- $desc,
- $pu_ht,
- GETPOST('qty'),
- $tva_tx,
- $localtax1_tx,
- $localtax2_tx,
- $idprod,
- GETPOST('remise_percent'),
- $date_start,
- $date_end,
- 0,
- $info_bits,
- '',
- $price_base_type,
- $pu_ttc,
- $type,
- -1,
- 0,
- '',
- 0,
- GETPOST('fk_parent_line'),
- $fournprice,
+ setEventMessage($mesg, 'errors');
+ }
+ else
+ {
+ // Insert line
+ $result = $object->addline(
+ $id,
+ $desc,
+ $pu_ht,
+ GETPOST('qty'),
+ $tva_tx,
+ $localtax1_tx,
+ $localtax2_tx,
+ $idprod,
+ GETPOST('remise_percent'),
+ $date_start,
+ $date_end,
+ 0,
+ $info_bits,
+ '',
+ $price_base_type,
+ $pu_ttc,
+ $type,
+ -1,
+ 0,
+ '',
+ 0,
+ GETPOST('fk_parent_line'),
+ $fournprice,
$buyingprice,
- $label
+ $label
);
- if ($result > 0)
+ if ($result > 0)
{
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
- // Define output language
- $outputlangs = $langs;
- $newlang=GETPOST('lang_id','alpha');
- if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
-
- $ret=$object->fetch($id); // Reload to get new records
+ // Define output language
+ $outputlangs = $langs;
+ $newlang=GETPOST('lang_id','alpha');
+ if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $ret=$object->fetch($id); // Reload to get new records
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
}
-
- unset($_POST['qty']);
- unset($_POST['type']);
- unset($_POST['idprod']);
- unset($_POST['remise_percent']);
+
+ unset($_POST['qty']);
+ unset($_POST['type']);
+ unset($_POST['idprod']);
+ unset($_POST['remise_percent']);
unset($_POST['price_ht']);
unset($_POST['price_ttc']);
unset($_POST['tva_tx']);
@@ -1180,14 +1180,14 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
unset($_POST['product_label']);
unset($_POST['product_desc']);
unset($_POST['fournprice']);
- unset($_POST['buying_price']);
- }
- else
- {
- setEventMessage($object->error, 'errors');
- }
-
- $action='';
+ unset($_POST['buying_price']);
+ }
+ else
+ {
+ setEventMessage($object->error, 'errors');
+ }
+
+ $action='';
}
}
}
@@ -1200,7 +1200,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
// Clean parameters
$date_start='';
$date_end='';
- $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
+ $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description=dol_htmlcleanlastbr(GETPOST('product_desc'));
$pu_ht=GETPOST('price_ht');
@@ -1234,22 +1234,22 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):'');
- if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
- {
- setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors');
- $error++;
+ if ($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
+ {
+ setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors');
+ $error++;
}
}
- else
- {
- $type = GETPOST('type');
- $label = (GETPOST('product_label') ? GETPOST('product_label'):'');
-
- // Check parameters
- if (GETPOST('type') < 0) {
- setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
- $error++;
- }
+ else
+ {
+ $type = GETPOST('type');
+ $label = (GETPOST('product_label') ? GETPOST('product_label'):'');
+
+ // Check parameters
+ if (GETPOST('type') < 0) {
+ setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
+ $error++;
+ }
}
// Update line
@@ -1276,41 +1276,41 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
$label
);
- if ($result >= 0)
- {
- if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
+ if ($result >= 0)
+ {
+ if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
- // Define output language
- $outputlangs = $langs;
- $newlang='';
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
+ // Define output language
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
}
- $ret=$object->fetch($id); // Reload to get new records
+ $ret=$object->fetch($id); // Reload to get new records
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
}
- unset($_POST['qty']);
- unset($_POST['type']);
- unset($_POST['productid']);
- unset($_POST['remise_percent']);
- unset($_POST['price_ht']);
- unset($_POST['price_ttc']);
- unset($_POST['tva_tx']);
- unset($_POST['product_ref']);
- unset($_POST['product_label']);
- unset($_POST['product_desc']);
- unset($_POST['fournprice']);
+ unset($_POST['qty']);
+ unset($_POST['type']);
+ unset($_POST['productid']);
+ unset($_POST['remise_percent']);
+ unset($_POST['price_ht']);
+ unset($_POST['price_ttc']);
+ unset($_POST['tva_tx']);
+ unset($_POST['product_ref']);
+ unset($_POST['product_label']);
+ unset($_POST['product_desc']);
+ unset($_POST['fournprice']);
unset($_POST['buying_price']);
- }
- else
- {
- setEventMessage($object->error, 'errors');
+ }
+ else
+ {
+ setEventMessage($object->error, 'errors');
}
}
}
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index f23e16297b3..461cfaa03c0 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -62,27 +62,27 @@ $object = new FactureRec($db);
// Create predefined invoice
if ($action == 'add')
{
- if (! GETPOST('titre'))
- {
+ if (! GETPOST('titre'))
+ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Title")), 'errors');
$action = "create";
- $error++;
+ $error++;
}
if (! $error)
{
- $object->titre = GETPOST('titre', 'alpha');
- $object->note = GETPOST('comment');
-
- if ($object->create($user, $id) > 0)
- {
- $id = $object->id;
- $action = '';
- }
- else
- {
- setEventMessage($object->error, 'errors');
- $action = "create";
+ $object->titre = GETPOST('titre', 'alpha');
+ $object->note = GETPOST('comment');
+
+ if ($object->create($user, $id) > 0)
+ {
+ $id = $object->id;
+ $action = '';
+ }
+ else
+ {
+ setEventMessage($object->error, 'errors');
+ $action = "create";
}
}
}
@@ -165,12 +165,12 @@ if ($action == 'create')
print '
';
- $title = $langs->trans("ProductsAndServices");
- if (empty($conf->service->enabled))
- $title = $langs->trans("Products");
- else if (empty($conf->product->enabled))
- $title = $langs->trans("Services");
-
+ $title = $langs->trans("ProductsAndServices");
+ if (empty($conf->service->enabled))
+ $title = $langs->trans("Products");
+ else if (empty($conf->product->enabled))
+ $title = $langs->trans("Services");
+
print_titre($title);
/*
@@ -470,14 +470,14 @@ else
if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product');
- if (! empty($object->lines[$i]->label)) {
-
- $text.= ' '.$object->lines[$i]->label.'';
- print $form->textwithtooltip($text,dol_htmlentitiesbr($object->lines[$i]->desc),3,'','',$i);
-
- } else {
-
- print $text.' '.nl2br($object->lines[$i]->desc);
+ if (! empty($object->lines[$i]->label)) {
+
+ $text.= ' '.$object->lines[$i]->label.'';
+ print $form->textwithtooltip($text,dol_htmlentitiesbr($object->lines[$i]->desc),3,'','',$i);
+
+ } else {
+
+ print $text.' '.nl2br($object->lines[$i]->desc);
}
// Show range
@@ -517,15 +517,15 @@ else
* List mode
*/
- $sql = "SELECT s.nom, s.rowid as socid, f.titre, f.total, f.rowid as facid";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
- $sql.= " WHERE f.fk_soc = s.rowid";
- $sql.= " AND f.entity = ".$conf->entity;
- if ($socid) $sql .= " AND s.rowid = ".$socid;
-
- //$sql .= " ORDER BY $sortfield $sortorder, rowid DESC ";
- // $sql .= $db->plimit($limit + 1,$offset);
-
+ $sql = "SELECT s.nom, s.rowid as socid, f.titre, f.total, f.rowid as facid";
+ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
+ $sql.= " WHERE f.fk_soc = s.rowid";
+ $sql.= " AND f.entity = ".$conf->entity;
+ if ($socid) $sql .= " AND s.rowid = ".$socid;
+
+ //$sql .= " ORDER BY $sortfield $sortorder, rowid DESC ";
+ // $sql .= $db->plimit($limit + 1,$offset);
+
$result = $db->query($sql);
if ($result)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index b4124e84fc8..ba8f32e0bd1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -2581,13 +2581,13 @@ abstract class CommonObject
if (! empty($line->date_start)) $type=1; // deprecated
if (! empty($line->date_end)) $type=1; // deprecated
- if ($line->fk_product > 0)
- {
+ if ($line->fk_product > 0)
+ {
$product_static = new Product($this->db);
- $product_static->type=$line->fk_product_type;
- $product_static->id=$line->fk_product;
- $product_static->ref=$line->ref;
+ $product_static->type=$line->fk_product_type;
+ $product_static->id=$line->fk_product;
+ $product_static->ref=$line->ref;
$text=$product_static->getNomUrl(1);
}
@@ -2624,18 +2624,18 @@ abstract class CommonObject
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
}
- // Output template part (modules that overwrite templates must declare this into descriptor)
- // Use global variables + $dateSelector + $seller and $buyer
- $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
- foreach($dirtpls as $reldir)
+ // Output template part (modules that overwrite templates must declare this into descriptor)
+ // Use global variables + $dateSelector + $seller and $buyer
+ $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
+ foreach($dirtpls as $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
- if (empty($conf->file->strict_mode)) {
- $res=@include $tpl;
- } else {
- $res=include $tpl; // for debug
- }
- if ($res) break;
+ if (empty($conf->file->strict_mode)) {
+ $res=@include $tpl;
+ } else {
+ $res=include $tpl; // for debug
+ }
+ if ($res) break;
}
}
@@ -2643,23 +2643,23 @@ abstract class CommonObject
if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
{
$label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : ''));
- if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("Label").'"';
+ if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("Label").'"';
else $placeholder=' title="'.$langs->trans("Label").'"';
$pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
- // Output template part (modules that overwrite templates must declare this into descriptor)
- // Use global variables + $dateSelector + $seller and $buyer
- $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
- foreach($dirtpls as $reldir)
+ // Output template part (modules that overwrite templates must declare this into descriptor)
+ // Use global variables + $dateSelector + $seller and $buyer
+ $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
+ foreach($dirtpls as $reldir)
{
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
if (empty($conf->file->strict_mode)) {
$res=@include $tpl;
} else {
$res=include $tpl; // for debug
- }
- if ($res) break;
+ }
+ if ($res) break;
}
}
}
@@ -2804,11 +2804,11 @@ abstract class CommonObject
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir)
{
- $tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
- if (empty($conf->file->strict_mode)) {
- $res=@include $tpl;
- } else {
- $res=include $tpl; // for debug
+ $tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
+ if (empty($conf->file->strict_mode)) {
+ $res=@include $tpl;
+ } else {
+ $res=include $tpl; // for debug
}
if ($res) break;
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index d32a30e5b0c..8751708bede 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1111,8 +1111,8 @@ class Form
else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
- if ($hidelabel == 2) {
- print img_picto($langs->trans("Search"), 'search');
+ if ($hidelabel == 2) {
+ print img_picto($langs->trans("Search"), 'search');
}
}
print '';
diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php
index 1bb913792a0..b47daaf4166 100644
--- a/htdocs/core/lib/sendings.lib.php
+++ b/htdocs/core/lib/sendings.lib.php
@@ -127,11 +127,11 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$product_static=new Product($db);
$expedition=new Expedition($db);
- $sql = "SELECT obj.rowid, obj.fk_product, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked";
+ $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked";
$sql.= ", ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line";
$sql.= ", e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,";
//if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,";
- $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid,';
+ $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
$sql.= ' p.description as product_desc';
$sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql.= ", ".MAIN_DB_PREFIX."expedition as e";
@@ -204,11 +204,11 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$outputlangs->setDefaultLang($newlang);
}
- $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product;
+ $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
}
else
{
- $label = $objp->product;
+ $label = (! empty($objp->label)?$objp->label:$objp->product_label);
}
print '
| '; print ''; // ancre pour retourner sur la ligne @@ -432,7 +446,6 @@ if ($id > 0 || ! empty($ref)) $product_static->type=$objp->fk_product_type; $product_static->id=$objp->fk_product; $product_static->ref=$objp->ref; - $product_static->libelle=$label; $text=$product_static->getNomUrl(1); $text.= ' - '.$label; $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); @@ -454,7 +467,13 @@ if ($id > 0 || ! empty($ref)) print " | ";
if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product');
- print $text.' '.nl2br($objp->description);
+
+ if (! empty($objp->label)) {
+ $text.= ' '.$objp->label.'';
+ print $form->textwithtooltip($text,$objp->description,3,'','',$i);
+ } else {
+ print $text.' '.nl2br($objp->description);
+ }
// Show range
print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end));
@@ -588,7 +607,7 @@ if ($id > 0 || ! empty($ref))
// Bouton expedier avec gestion des stocks
- if ($conf->stock->enabled && ($commande->statut > 0 && $commande->statut < 3))
+ if (! empty($conf->stock->enabled) && ($commande->statut > 0 && $commande->statut < 3))
{
if ($user->rights->expedition->creer)
{
diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php
index 217a0a68093..3dfe6de2d64 100644
--- a/htdocs/fourn/ajax/getSupplierPrices.php
+++ b/htdocs/fourn/ajax/getSupplierPrices.php
@@ -79,7 +79,7 @@ if (! empty($idprod))
{
$label.= price($objp->fprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
- $title.= price($objp->fprice);
+ $title.= price($objp->fprice);
$title.= getCurrencySymbol($conf->currency)."/";
$price = $objp->fprice;
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 5c3b330410c..004c0d38891 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -171,4 +171,14 @@ CountryOrigin=Origin country
HiddenIntoCombo=Hidden into select lists
Nature=Nature
ProductCodeModel=Product code model
-ServiceCodeModel=Service code model
\ No newline at end of file
+ServiceCodeModel=Service code model
+AddThisProductCard=Create product card
+HelpAddThisProductCard=This option allows you to create or clone a product if it does not exist.
+AddThisServiceCard=Create service card
+HelpAddThisServiceCard=This option allows you to create or clone a service if it does not exist.
+UpdateOriginalProductLabel=Edit label
+HelpUpdateOriginalProductLabel=This option allows you to change the label. Disabling this option will replace the original label. +UpdateOriginalProductDescription=Edit description +HelpUpdateOriginalProductDescription=This option allows you to change the description. If you have already entered text, it will be automatically placed after. Disabling this option will remove the original description in the editor, but keep the text entered previously. +UpdateOriginalProductPrice=Edit price +HelpUpdateOriginalProductPrice=This option allows you to change the price. Calculation of VAT will automatically, based on excl. tax if you entered an excl. tax amount , based on incl. tax if you entered an incl. tax amount. Disabling this option will replace the original price. \ No newline at end of file diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 3613fdd4811..54c5d6702d5 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -173,12 +173,12 @@ Nature=Nature ProductCodeModel=Modèle de code produit ServiceCodeModel=Modèle de code service AddThisProductCard=Créer fiche produit -HelpAddThisProductCard= +HelpAddThisProductCard=Cette option permet de créer ou de cloner une fiche produit si elle n'existe pas. AddThisServiceCard=Créer fiche service -HelpAddThisServiceCard= +HelpAddThisServiceCard=Cette option permet de créer ou de cloner une fiche service si elle n'existe pas. UpdateOriginalProductLabel=Modifier le libellé -HelpUpdateOriginalProductLabel= +HelpUpdateOriginalProductLabel=Cette option permet de modifier le libellé. La desactivation de cette option replacera le libellé d'origine. UpdateOriginalProductDescription=Modifier la description -HelpUpdateOriginalProductDescription= +HelpUpdateOriginalProductDescription=Cette option permet de modifier la description. Si vous avez déjà entré un texte, il sera placé à la suite automatiquement. La desactivation de cette option supprimera le description d'origine dans l'éditeur, mais conservera le texte rentré précédemment. UpdateOriginalProductPrice=Modifier le prix -HelpUpdateOriginalProductPrice= \ No newline at end of file +HelpUpdateOriginalProductPrice=Cette option permet de modifier le prix. Le calcul de la TVA se fera automatiquement, soit sur la base du prix HT si vous rentré un montant HT, soit sur la base du prix TTC si vous rentré un montant TTC. La désactivation de cette option replacera le prix d'origine. \ No newline at end of file diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 085ea745d0a..e653f6f59d1 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -665,8 +665,8 @@ class Livraison extends CommonObject $this->lines = array(); $sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped,"; - $sql.= " cd.qty as qty_asked,"; - $sql.= " p.ref, p.fk_product_type as fk_product_type, p.label as label, p.description as product_desc"; + $sql.= " cd.qty as qty_asked, cd.label as custom_label,"; + $sql.= " p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."livraisondet as ld"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on p.rowid = ld.fk_product"; $sql.= " WHERE ld.fk_origin_line = cd.rowid"; @@ -684,19 +684,21 @@ class Livraison extends CommonObject $obj = $this->db->fetch_object($resql); - $line->description = $obj->description; - $line->fk_product = $obj->fk_product; - $line->qty_asked = $obj->qty_asked; - $line->qty_shipped = $obj->qty_shipped; + $line->label = $obj->custom_label; + $line->description = $obj->description; + $line->fk_product = $obj->fk_product; + $line->qty_asked = $obj->qty_asked; + $line->qty_shipped = $obj->qty_shipped; - $line->ref = $obj->ref; - $line->libelle = $obj->label; // Label produit - $line->label = $obj->label; - $line->product_desc = $obj->product_desc; // Description produit - $line->product_type = $obj->fk_product_type; + $line->ref = $obj->product_ref; // deprecated + $line->libelle = $obj->product_label; // deprecated + $line->product_label = $obj->product_label; // Product label + $line->product_ref = $obj->product_ref; // Product ref + $line->product_desc = $obj->product_desc; // Product description + $line->product_type = $obj->fk_product_type; - $line->price = $obj->price; - $line->total_ht = $obj->total_ht; + $line->price = $obj->price; + $line->total_ht = $obj->total_ht; $this->lines[$i] = $line; diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index f3432efdf1c..136a4e04dd9 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -1,9 +1,9 @@ - * Copyright (C) 2005-2010 Laurent Destailleur '.$delivery->error.' ';
+
$_GET["commande_id"]=$_POST["commande_id"];
- $_GET["action"]='create';
+ $action='create';
}
}
-if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $user->rights->expedition->livraison->valider)
+else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->livraison->valider)
{
$object = new Livraison($db);
- $object->fetch($_GET["id"]);
+ $object->fetch($id);
$object->fetch_thirdparty();
$result = $object->valid($user);
@@ -131,10 +135,10 @@ if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $
}
}
-if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->expedition->livraison->supprimer)
+if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->livraison->supprimer)
{
$object = new Livraison($db);
- $object->fetch($_GET["id"]);
+ $object->fetch($id);
$object->fetch_thirdparty();
$db->begin();
@@ -155,10 +159,10 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' &&
/*
* Build document
*/
-if ($_REQUEST['action'] == 'builddoc') // En get ou en post
+if ($action == 'builddoc') // En get ou en post
{
$object = new Livraison($db);
- $object->fetch($_REQUEST['id']);
+ $object->fetch($id);
$object->fetch_thirdparty();
if ($_REQUEST['model'])
@@ -220,7 +224,7 @@ $formfile = new FormFile($db);
* Mode creation
*
*********************************************************************/
-if ($_GET["action"] == 'create')
+if ($action == 'create')
{
print_fiche_titre($langs->trans("CreateADeliveryOrder"));
@@ -233,7 +237,7 @@ if ($_GET["action"] == 'create')
$commande = new Commande($db);
$commande->livraison_array();
- if ( $commande->fetch($_GET["commande_id"]))
+ if ($commande->fetch($_GET["commande_id"]))
{
$soc = new Societe($db);
$soc->fetch($commande->socid);
@@ -329,24 +333,24 @@ if ($_GET["action"] == 'create')
$product->fetch($line->fk_product);
$product->load_stock();
- // Define output language
- if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
- {
- $commande->fetch_thirdparty();
- $outputlangs = $langs;
- $newlang='';
- if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
- if (empty($newlang)) $newlang=$commande->client->default_lang;
- if (! empty($newlang))
- {
- $outputlangs = new Translate("",$conf);
- $outputlangs->setDefaultLang($newlang);
- }
+ // Define output language
+ if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
+ {
+ $commande->fetch_thirdparty();
+ $outputlangs = $langs;
+ $newlang='';
+ if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if (empty($newlang)) $newlang=$commande->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
- $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $product->libelle;
- }
- else
- $label = $product->libelle;
+ $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $product->label;
+ }
+ else
+ $label = (! empty($line->label)?$line->label:$product->label);
print '';
print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$label;
@@ -355,7 +359,19 @@ if ($_GET["action"] == 'create')
}
else
{
- print " | ".nl2br($line->description)." | \n";
+ print "";
+ if ($line->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
+ else $text = img_object($langs->trans('Product'),'product');
+
+ if (! empty($line->label)) {
+ $text.= ' '.$line->label.'';
+ print $form->textwithtooltip($text,$line->description,3,'','',$i);
+ } else {
+ print $text.' '.nl2br($line->description);
+ }
+
+ print_date_range($lines[$i]->date_start,$lines[$i]->date_end);
+ print " | \n";
}
print ''.$line->qty.' | ';
@@ -426,10 +442,10 @@ else
/* */
/* *************************************************************************** */
{
- if ($_GET["id"] > 0)
+ if ($id > 0)
{
$delivery = new Livraison($db);
- $result = $delivery->fetch($_GET["id"]);
+ $result = $delivery->fetch($id);
$delivery->fetch_thirdparty();
$expedition=new Expedition($db);
@@ -441,7 +457,7 @@ else
$delivery->fetch_origin();
}
- if ( $delivery->id > 0)
+ if ($delivery->id > 0)
{
$soc = new Societe($db);
$soc->fetch($delivery->socid);
@@ -453,7 +469,7 @@ else
* Confirmation de la suppression
*
*/
- if ($_GET["action"] == 'delete')
+ if ($action == 'delete')
{
$expedition_id = $_GET["expid"];
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1);
@@ -464,7 +480,7 @@ else
* Confirmation de la validation
*
*/
- if ($_GET["action"] == 'valid')
+ if ($action == 'valid')
{
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm",$delivery->ref),'confirm_valid','','',1);
if ($ret == 'html') print ''; @@ -570,24 +586,24 @@ else $product = new Product($db); $product->fetch($delivery->lines[$i]->fk_product); - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $delivery->fetch_thirdparty(); - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if (empty($newlang)) $newlang=$delivery->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $delivery->fetch_thirdparty(); + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if (empty($newlang)) $newlang=$delivery->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } - $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $delivery->lines[$i]->product_label; - } - else - $label = $delivery->lines[$i]->product_label; + $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $delivery->lines[$i]->product_label; + } + else + $label = ( ! empty($delivery->lines[$i]->label)?$delivery->lines[$i]->label:$delivery->lines[$i]->product_label); print ' ';
@@ -595,15 +611,15 @@ else
$text = '';
if ($delivery->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product');
- $text.= ' '.$delivery->lines[$i]->ref.'';
+ $text.= ' '.$delivery->lines[$i]->product_ref.'';
$text.= ' - '.$label;
- $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($delivery->lines[$i]->description));
+ $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($delivery->lines[$i]->description));
//print $description;
print $form->textwithtooltip($text,$description,3,'','',$i);
print_date_range($delivery->lines[$i]->date_start,$delivery->lines[$i]->date_end);
- if ($conf->global->PRODUIT_DESC_IN_FORM)
+ if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{
- print ($delivery->lines[$i]->description && $delivery->lines[$i]->description!=$delivery->lines[$i]->label)?' | '.dol_htmlentitiesbr($delivery->lines[$i]->description):''; + print (! empty($delivery->lines[$i]->description) && $delivery->lines[$i]->description!=$delivery->lines[$i]->product_label)?' '.dol_htmlentitiesbr($delivery->lines[$i]->description):''; } } else @@ -611,7 +627,14 @@ else print " ";
if ($delivery->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product');
- print $text.' '.nl2br($delivery->lines[$i]->description);
+
+ if (! empty($delivery->lines[$i]->label)) {
+ $text.= ' '.$delivery->lines[$i]->label.'';
+ print $form->textwithtooltip($text,$delivery->lines[$i]->description,3,'','',$i);
+ } else {
+ print $text.' '.nl2br($delivery->lines[$i]->description);
+ }
+
print_date_range($objp->date_start,$objp->date_end);
print " | \n";
}
@@ -700,7 +723,7 @@ else
}
}
-$db->close();
llxFooter();
-?>
+$db->close();
+?>
\ No newline at end of file
|