2
0
forked from Wavyzz/dolibarr

New: [ task #498 ] - final part

This commit is contained in:
Regis Houssin
2012-08-25 15:21:34 +02:00
parent d88abe8df0
commit f322ec50ed
22 changed files with 710 additions and 641 deletions

View File

@@ -64,8 +64,8 @@ if ($action == 'updateMask')
if (isset($res)) if (isset($res))
{ {
if ($res < 0) if ($res < 0)
setEventMessage($langs->trans("SetupSaved")); setEventMessage($langs->trans("SetupSaved"));
else else
setEventMessage($langs->trans("Error"), 'errors'); setEventMessage($langs->trans("Error"), 'errors');
} }
@@ -87,9 +87,9 @@ else if ($action == 'set_SHIPPING_DRAFT_WATERMARK')
$draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if ($res < 0) if ($res < 0)
setEventMessage($langs->trans("SetupSaved")); setEventMessage($langs->trans("SetupSaved"));
else else
setEventMessage($langs->trans("Error"), 'errors'); setEventMessage($langs->trans("Error"), 'errors');
} }
@@ -153,22 +153,22 @@ else if ($action == 'del')
} }
} }
// Set default model // Set default model
else if ($action == 'setdoc') else if ($action == 'setdoc')
{ {
if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
// La constante qui a ete lue en avant du nouveau set // La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent // on passe donc par une variable pour avoir un affichage coherent
$conf->global->EXPEDITION_ADDON_PDF = $value; $conf->global->EXPEDITION_ADDON_PDF = $value;
} }
// On active le modele // On active le modele
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} }
else if ($action == 'setmodel') else if ($action == 'setmodel')

View File

@@ -645,10 +645,10 @@ else if ($action == "addline" && $user->rights->propal->creer)
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
$error++; $error++;
} }
if (empty($idprod) && ! GETPOST('product_desc')) if (empty($idprod) && ! GETPOST('product_desc'))
{ {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors');
$error++; $error++;
} }
if (! $error && (GETPOST('qty') >= 0) && (GETPOST('product_desc') || ! empty($idprod))) if (! $error && (GETPOST('qty') >= 0) && (GETPOST('product_desc') || ! empty($idprod)))
@@ -723,27 +723,27 @@ else if ($action == "addline" && $user->rights->propal->creer)
} else { } else {
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if (empty($newlang)) $newlang=$object->client->default_lang; if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
} }
else else
{ {
$desc = $prod->description; $desc = $prod->description;
} }
$desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : ""; $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : "";
$desc.= GETPOST('product_desc'); $desc.= GETPOST('product_desc');
} }
@@ -762,11 +762,11 @@ else if ($action == "addline" && $user->rights->propal->creer)
} }
// Margin // Margin
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
// Local Taxes // Local Taxes
$localtax1_tx= get_localtax($tva_tx, 1, $object->client); $localtax1_tx= get_localtax($tva_tx, 1, $object->client);
$localtax2_tx= get_localtax($tva_tx, 2, $object->client); $localtax2_tx= get_localtax($tva_tx, 2, $object->client);
$info_bits=0; $info_bits=0;
@@ -822,7 +822,7 @@ else if ($action == "addline" && $user->rights->propal->creer)
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['idprod']); unset($_POST['idprod']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); 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); $localtax2_rate=get_localtax($vat_rate,2,$object->client);
$pu_ht=GETPOST('price_ht'); $pu_ht=GETPOST('price_ht');
// Add buying price // Add buying price
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
// Define special_code for special lines // 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'):''); $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))) 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'); setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors');
$error++; $error++;
} }
} }
else else
{ {
$type = GETPOST('type'); $type = GETPOST('type');
$label = (GETPOST('product_label') ? GETPOST('product_label'):''); $label = (GETPOST('product_label') ? GETPOST('product_label'):'');
// Check parameters // Check parameters
if (GETPOST('type') < 0) { if (GETPOST('type') < 0) {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
$error++; $error++;
} }
} }
if (! $error) if (! $error)
@@ -920,49 +920,49 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
$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 // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; 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 ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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); propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
} }
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['productid']); unset($_POST['productid']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); unset($_POST['price_ttc']);
unset($_POST['tva_tx']); unset($_POST['tva_tx']);
unset($_POST['product_ref']); unset($_POST['product_ref']);
unset($_POST['product_label']); unset($_POST['product_label']);
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel') == $langs->trans('Cancel')) 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 Header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition
exit; exit;
} }
// Generation doc (depuis lien ou depuis cartouche doc) // Generation doc (depuis lien ou depuis cartouche doc)

View File

@@ -587,22 +587,22 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$price_base_type = $prod->price_base_type; $price_base_type = $prod->price_base_type;
} }
// Update if prices fields are defined // Update if prices fields are defined
if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc'))) if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc')))
{ {
$price_ht=price2num(GETPOST('price_ht'), 'MU'); $price_ht=price2num(GETPOST('price_ht'), 'MU');
$price_ttc=price2num(GETPOST('price_ttc'), 'MU'); $price_ttc=price2num(GETPOST('price_ttc'), 'MU');
if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc) if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc)
{ {
$pu_ttc = $price_ttc; $pu_ttc = $price_ttc;
$pu_ht = price2num($price_ttc / (1 + ($prod->tva_tx / 100)),'MU'); $pu_ht = price2num($price_ttc / (1 + ($prod->tva_tx / 100)),'MU');
} }
else if ($price_base_type != 'TTC' && $price_ht != $pu_ht) else if ($price_base_type != 'TTC' && $price_ht != $pu_ht)
{ {
$pu_ht = $price_ht; $pu_ht = $price_ht;
$pu_ttc = price2num($price_ht * (1 + ($prod->tva_tx / 100)),'MU'); $pu_ttc = price2num($price_ht * (1 + ($prod->tva_tx / 100)),'MU');
} }
} }
// On reevalue prix selon taux tva car taux tva transaction peut etre different // 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')) { if (GETPOST('update_desc')) {
$desc = (GETPOST('product_desc')?GETPOST('product_desc'):''); $desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
} else { } else {
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if (empty($newlang)) $newlang=$object->client->default_lang; if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
} }
else else
{ {
$desc = $prod->description; $desc = $prod->description;
} }
$desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : ""; $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : "";
$desc.= GETPOST('product_desc'); $desc.= GETPOST('product_desc');
} }
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):''); $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label'):'');
$type = $prod->type; $type = $prod->type;
@@ -664,7 +664,7 @@ else if ($action == 'addline' && $user->rights->commande->creer)
} }
// Margin // Margin
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
// Local Taxes // Local Taxes
@@ -676,61 +676,61 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$info_bits=0; $info_bits=0;
if ($tva_npr) $info_bits |= 0x01; 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)); $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency));
setEventMessage($mesg, 'errors'); setEventMessage($mesg, 'errors');
} }
else else
{ {
// Insert line // Insert line
$result = $object->addline( $result = $object->addline(
$object->id, $object->id,
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), GETPOST('qty'),
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$idprod, $idprod,
GETPOST('remise_percent'), GETPOST('remise_percent'),
$info_bits, $info_bits,
0,
$price_base_type,
$pu_ttc,
$date_start,
$date_end,
$type,
-1,
0, 0,
GETPOST('fk_parent_line'), $price_base_type,
$pu_ttc,
$date_start,
$date_end,
$type,
-1,
0,
GETPOST('fk_parent_line'),
$fournprice, $fournprice,
$buyingprice, $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 // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang=GETPOST('lang_id','alpha'); $newlang=GETPOST('lang_id','alpha');
if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$ret=$object->fetch($object->id); // Reload to get new records $ret=$object->fetch($object->id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
} }
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['idprod']); unset($_POST['idprod']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); unset($_POST['price_ttc']);
unset($_POST['tva_tx']); unset($_POST['tva_tx']);
@@ -738,12 +738,12 @@ else if ($action == 'addline' && $user->rights->commande->creer)
unset($_POST['product_label']); unset($_POST['product_label']);
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }
} }
@@ -833,34 +833,34 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
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 // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); 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 ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$ret=$object->fetch($object->id); // Reload to get new records $ret=$object->fetch($object->id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
} }
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['productid']); unset($_POST['productid']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); unset($_POST['price_ttc']);
unset($_POST['tva_tx']); unset($_POST['tva_tx']);
unset($_POST['product_ref']); unset($_POST['product_ref']);
unset($_POST['product_label']); unset($_POST['product_label']);
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
} }
else else

View File

@@ -68,7 +68,7 @@ $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','al
$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');
$search_montant_ttc=GETPOST('search_montant_ttc','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 $originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility
//PDF //PDF
@@ -985,9 +985,9 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
} }
$ret=$object->fetch_thirdparty(); $ret=$object->fetch_thirdparty();
// Clean parameters // 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_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')); $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'; $price_base_type = 'HT';
// Ecrase $pu par celui du produit // 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; $price_base_type = $prod->price_base_type;
} }
// Update if prices fields are defined // Update if prices fields are defined
if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc'))) if (GETPOST('update_price') && (GETPOST('price_ht') || GETPOST('price_ttc')))
{ {
$price_ht=price2num(GETPOST('price_ht'), 'MU'); $price_ht=price2num(GETPOST('price_ht'), 'MU');
$price_ttc=price2num(GETPOST('price_ttc'), 'MU'); $price_ttc=price2num(GETPOST('price_ttc'), 'MU');
if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc) if ($price_base_type == 'TTC' && $price_ttc != $pu_ttc)
{ {
$pu_ttc = $price_ttc; $pu_ttc = $price_ttc;
$pu_ht = price2num($price_ttc / (1 + ($prod->tva_tx / 100)),'MU'); $pu_ht = price2num($price_ttc / (1 + ($prod->tva_tx / 100)),'MU');
} }
else if ($price_base_type != 'TTC' && $price_ht != $pu_ht) else if ($price_base_type != 'TTC' && $price_ht != $pu_ht)
{ {
$pu_ht = $price_ht; $pu_ht = $price_ht;
$pu_ttc = price2num($price_ht * (1 + ($prod->tva_tx / 100)),'MU'); $pu_ttc = price2num($price_ht * (1 + ($prod->tva_tx / 100)),'MU');
} }
} }
// On reevalue prix selon taux tva car taux tva transaction peut etre different // 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')) { if (GETPOST('update_desc')) {
$desc = (GETPOST('product_desc')?GETPOST('product_desc'):''); $desc = (GETPOST('product_desc')?GETPOST('product_desc'):'');
} else { } else {
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
if (empty($newlang)) $newlang=$object->client->default_lang; if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description; $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
} }
else else
{ {
$desc = $prod->description; $desc = $prod->description;
} }
$desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : ""; $desc.= ($desc && GETPOST('product_desc')) ? ((dol_textishtml($desc) || dol_textishtml(GETPOST('product_desc')))?"<br />\n":"\n") : "";
$desc.= GETPOST('product_desc'); $desc.= GETPOST('product_desc');
} }
if (! empty($prod->customcode) || ! empty($prod->country_code)) if (! empty($prod->customcode) || ! empty($prod->country_code))
@@ -1104,75 +1104,75 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$type=GETPOST('type'); $type=GETPOST('type');
} }
// Margin // Margin
$fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):'');
$buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):'');
// Local Taxes // Local Taxes
$localtax1_tx= get_localtax($tva_tx, 1, $object->client); $localtax1_tx= get_localtax($tva_tx, 1, $object->client);
$localtax2_tx= get_localtax($tva_tx, 2, $object->client); $localtax2_tx= get_localtax($tva_tx, 2, $object->client);
$info_bits=0; $info_bits=0;
if ($tva_npr) $info_bits |= 0x01; 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)); $mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').getCurrencySymbol($conf->currency));
setEventMessage($mesg, 'errors'); setEventMessage($mesg, 'errors');
} }
else else
{ {
// Insert line // Insert line
$result = $object->addline( $result = $object->addline(
$id, $id,
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), GETPOST('qty'),
$tva_tx, $tva_tx,
$localtax1_tx, $localtax1_tx,
$localtax2_tx, $localtax2_tx,
$idprod, $idprod,
GETPOST('remise_percent'), GETPOST('remise_percent'),
$date_start, $date_start,
$date_end, $date_end,
0, 0,
$info_bits, $info_bits,
'', '',
$price_base_type, $price_base_type,
$pu_ttc, $pu_ttc,
$type, $type,
-1, -1,
0, 0,
'', '',
0, 0,
GETPOST('fk_parent_line'), GETPOST('fk_parent_line'),
$fournprice, $fournprice,
$buyingprice, $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 // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang=GETPOST('lang_id','alpha'); $newlang=GETPOST('lang_id','alpha');
if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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); facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
} }
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['idprod']); unset($_POST['idprod']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); unset($_POST['price_ttc']);
unset($_POST['tva_tx']); unset($_POST['tva_tx']);
@@ -1180,14 +1180,14 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
unset($_POST['product_label']); unset($_POST['product_label']);
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
$action=''; $action='';
} }
} }
} }
@@ -1200,7 +1200,7 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
// Clean parameters // Clean parameters
$date_start=''; $date_start='';
$date_end=''; $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')); $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')); $description=dol_htmlcleanlastbr(GETPOST('product_desc'));
$pu_ht=GETPOST('price_ht'); $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'):''); $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))) 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'); setEventMessage($langs->trans("CantBeLessThanMinPrice", price2num($price_min,'MU')).getCurrencySymbol($conf->currency), 'errors');
$error++; $error++;
} }
} }
else else
{ {
$type = GETPOST('type'); $type = GETPOST('type');
$label = (GETPOST('product_label') ? GETPOST('product_label'):''); $label = (GETPOST('product_label') ? GETPOST('product_label'):'');
// Check parameters // Check parameters
if (GETPOST('type') < 0) { if (GETPOST('type') < 0) {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
$error++; $error++;
} }
} }
// Update line // Update line
@@ -1276,41 +1276,41 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
$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 // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); 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 ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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); facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
} }
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['productid']); unset($_POST['productid']);
unset($_POST['remise_percent']); unset($_POST['remise_percent']);
unset($_POST['price_ht']); unset($_POST['price_ht']);
unset($_POST['price_ttc']); unset($_POST['price_ttc']);
unset($_POST['tva_tx']); unset($_POST['tva_tx']);
unset($_POST['product_ref']); unset($_POST['product_ref']);
unset($_POST['product_label']); unset($_POST['product_label']);
unset($_POST['product_desc']); unset($_POST['product_desc']);
unset($_POST['fournprice']); unset($_POST['fournprice']);
unset($_POST['buying_price']); unset($_POST['buying_price']);
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
} }
} }
} }

View File

@@ -62,27 +62,27 @@ $object = new FactureRec($db);
// Create predefined invoice // Create predefined invoice
if ($action == 'add') if ($action == 'add')
{ {
if (! GETPOST('titre')) if (! GETPOST('titre'))
{ {
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Title")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Title")), 'errors');
$action = "create"; $action = "create";
$error++; $error++;
} }
if (! $error) if (! $error)
{ {
$object->titre = GETPOST('titre', 'alpha'); $object->titre = GETPOST('titre', 'alpha');
$object->note = GETPOST('comment'); $object->note = GETPOST('comment');
if ($object->create($user, $id) > 0) if ($object->create($user, $id) > 0)
{ {
$id = $object->id; $id = $object->id;
$action = ''; $action = '';
} }
else else
{ {
setEventMessage($object->error, 'errors'); setEventMessage($object->error, 'errors');
$action = "create"; $action = "create";
} }
} }
} }
@@ -165,12 +165,12 @@ if ($action == 'create')
print '<br>'; print '<br>';
$title = $langs->trans("ProductsAndServices"); $title = $langs->trans("ProductsAndServices");
if (empty($conf->service->enabled)) if (empty($conf->service->enabled))
$title = $langs->trans("Products"); $title = $langs->trans("Products");
else if (empty($conf->product->enabled)) else if (empty($conf->product->enabled))
$title = $langs->trans("Services"); $title = $langs->trans("Services");
print_titre($title); print_titre($title);
/* /*
@@ -470,14 +470,14 @@ else
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
if (! empty($object->lines[$i]->label)) { if (! empty($object->lines[$i]->label)) {
$text.= ' <strong>'.$object->lines[$i]->label.'</strong>'; $text.= ' <strong>'.$object->lines[$i]->label.'</strong>';
print $form->textwithtooltip($text,dol_htmlentitiesbr($object->lines[$i]->desc),3,'','',$i); print $form->textwithtooltip($text,dol_htmlentitiesbr($object->lines[$i]->desc),3,'','',$i);
} else { } else {
print $text.' '.nl2br($object->lines[$i]->desc); print $text.' '.nl2br($object->lines[$i]->desc);
} }
// Show range // Show range
@@ -517,15 +517,15 @@ else
* List mode * List mode
*/ */
$sql = "SELECT s.nom, s.rowid as socid, f.titre, f.total, f.rowid as facid"; $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.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($socid) $sql .= " AND s.rowid = ".$socid; if ($socid) $sql .= " AND s.rowid = ".$socid;
//$sql .= " ORDER BY $sortfield $sortorder, rowid DESC "; //$sql .= " ORDER BY $sortfield $sortorder, rowid DESC ";
// $sql .= $db->plimit($limit + 1,$offset); // $sql .= $db->plimit($limit + 1,$offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)

View File

@@ -2581,13 +2581,13 @@ abstract class CommonObject
if (! empty($line->date_start)) $type=1; // deprecated if (! empty($line->date_start)) $type=1; // deprecated
if (! empty($line->date_end)) $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 = new Product($this->db);
$product_static->type=$line->fk_product_type; $product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product; $product_static->id=$line->fk_product;
$product_static->ref=$line->ref; $product_static->ref=$line->ref;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
} }
@@ -2624,18 +2624,18 @@ abstract class CommonObject
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description)); $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
} }
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $reldir)
{ {
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php'); $tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
$res=include $tpl; // for debug $res=include $tpl; // for debug
} }
if ($res) break; if ($res) break;
} }
} }
@@ -2643,23 +2643,23 @@ abstract class CommonObject
if ($this->statut == 0 && $action == 'editline' && $selected == $line->id) if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
{ {
$label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : '')); $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").'"'; else $placeholder=' title="'.$langs->trans("Label").'"';
$pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU'); $pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx/100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor) // Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer // Use global variables + $dateSelector + $seller and $buyer
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $reldir)
{ {
$tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php'); $tpl = dol_buildpath($reldir.'/objectline_edit.tpl.php');
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
$res=include $tpl; // for debug $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')); $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $reldir)
{ {
$tpl = dol_buildpath($reldir.'/originproductline.tpl.php'); $tpl = dol_buildpath($reldir.'/originproductline.tpl.php');
if (empty($conf->file->strict_mode)) { if (empty($conf->file->strict_mode)) {
$res=@include $tpl; $res=@include $tpl;
} else { } else {
$res=include $tpl; // for debug $res=include $tpl; // for debug
} }
if ($res) break; if ($res) break;
} }

View File

@@ -1111,8 +1111,8 @@ class Form
else if ($hidelabel > 1) { else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"'; if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"'; else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) { if ($hidelabel == 2) {
print img_picto($langs->trans("Search"), 'search'); print img_picto($langs->trans("Search"), 'search');
} }
} }
print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />'; print '<input type="text" size="20" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' />';

View File

@@ -127,11 +127,11 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$product_static=new Product($db); $product_static=new Product($db);
$expedition=new Expedition($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.= ", 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,"; $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,"; //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.= ' p.description as product_desc';
$sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql.= ", ".MAIN_DB_PREFIX."expedition as e"; $sql.= ", ".MAIN_DB_PREFIX."expedition as e";
@@ -204,11 +204,11 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$outputlangs->setDefaultLang($newlang); $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 else
{ {
$label = $objp->product; $label = (! empty($objp->label)?$objp->label:$objp->product_label);
} }
print '<td>'; print '<td>';
@@ -217,19 +217,18 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$product_static->type=$objp->fk_product_type; $product_static->type=$objp->fk_product_type;
$product_static->id=$objp->fk_product; $product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref; $product_static->ref=$objp->ref;
$product_static->libelle=$label;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
$text.= ' - '.$label; $text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description));
print $form->textwithtooltip($text,$description,3,'','',$i); print $form->textwithtooltip($text,$description,3,'','',$i);
// Show range // Show range
print_date_range($objp->date_start,$objp->date_end); print_date_range($objp->date_start,$objp->date_end);
// Add description in form // Add description in form
if ($conf->global->PRODUIT_DESC_IN_FORM) if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
print ($objp->description && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):''; print (! empty($objp->description) && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):'';
} }
print '</td>'; print '</td>';
@@ -239,7 +238,13 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
print "<td>"; print "<td>";
if ($objp->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); if ($objp->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($objp->description);
if (! empty($objp->label)) {
$text.= ' <strong>'.$objp->label.'</strong>';
print $form->textwithtooltip($text,$objp->description,3,'','',$i);
} else {
print $text.' '.nl2br($objp->description);
}
// Show range // Show range
print_date_range($objp->date_start,$objp->date_end); print_date_range($objp->date_start,$objp->date_end);

View File

@@ -1,11 +1,11 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* 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
@@ -173,8 +173,8 @@ class modCommande extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("commande","commande","export")); $this->export_permission[$r]=array(array("commande","commande","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"DateOrder",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"OrderShortStatusInvoicee",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'Label'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"DateOrder",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"OrderShortStatusInvoicee",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"Linelabel",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@@ -84,11 +84,11 @@ class modExpedition extends DolibarrModules
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$r++; $r++;
$this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER";
$this->const[$r][1] = "chaine"; $this->const[$r][1] = "chaine";
$this->const[$r][2] = "mod_expedition_safor"; $this->const[$r][2] = "mod_expedition_safor";
$this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions'; $this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions';
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$r++; $r++;
$this->const[$r][0] = "LIVRAISON_ADDON_PDF"; $this->const[$r][0] = "LIVRAISON_ADDON_PDF";

View File

@@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 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
@@ -174,8 +174,8 @@ class modFacture extends DolibarrModules
$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='bill'; $this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export")); $this->export_permission[$r]=array(array("facture","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','c.code'=>'CountryCode','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"NotePrivate",'f.note_public'=>"NotePublic",'fd.rowid'=>'LineId','fd.label'=>"LineLabel",'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','c.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@@ -1,10 +1,10 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menentr <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* 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
@@ -169,8 +169,8 @@ class modPropale extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("propale","export")); $this->export_permission[$r]=array(array("propale","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','cp.code'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'Label'); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','cp.code'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note'=>"Note",'c.date_livraison'=>'DeliveryDate','cd.rowid'=>'LineId','cd.label'=>"LineLabel",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','cp.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','cp.code'=>'company','s.tel'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
$this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@@ -121,22 +121,22 @@ if (! empty($conf->margin->enabled)) {
echo $form->select_type_of_lines((GETPOST('type')?GETPOST('type'):-1), 'type', 1); echo $form->select_type_of_lines((GETPOST('type')?GETPOST('type'):-1), 'type', 1);
echo '<span id="product_ref_area" class="hideobject">&nbsp;<label for="product_ref">'.$langs->trans("Ref").'</label>'; echo '<span id="product_ref_area" class="hideobject">&nbsp;<label for="product_ref">'.$langs->trans("Ref").'</label>';
echo '<input id="product_ref" name="product_ref" size="20" value="'.GETPOST('product_ref').'"></span>'; echo '<input id="product_ref" name="product_ref" size="20" value="'.GETPOST('product_ref').'"></span>';
echo '&nbsp;<label for="product_label">'.$langs->trans("Label").'</label>'; echo '&nbsp;<label for="product_label">'.$langs->trans("Label").'</label>';
echo '<input id="product_label" name="product_label" size="40" value="'.GETPOST('product_label').'">'; echo '<input id="product_label" name="product_label" size="40" value="'.GETPOST('product_label').'">';
echo '<input type="hidden" id="origin_label_cache" name="origin_label_cache" value="" />'; echo '<input type="hidden" id="origin_label_cache" name="origin_label_cache" value="" />';
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
$parameters=array('fk_parent_line'=>GETPOST('fk_parent_line')); $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line'));
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
} }
?> ?>
</td> </td>
<tr <?php echo $bcnd[$var]; ?>> <tr <?php echo $bcnd[$var]; ?>>
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> <td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<?php <?php

View File

@@ -62,31 +62,31 @@
{ {
if ($line->fk_product > 0) { if ($line->fk_product > 0) {
echo $form->textwithtooltip($text,$description,3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):'')); echo $form->textwithtooltip($text,$description,3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
// Show range // Show range
print_date_range($line->date_start, $line->date_end); print_date_range($line->date_start, $line->date_end);
// Add description in form // Add description in form
if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):''; print (! empty($line->description) && $line->description!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->description):'';
} }
} else { } else {
if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow'); if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow');
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
if (! empty($line->label)) { if (! empty($line->label)) {
$text.= ' <strong>'.$line->label.'</strong>'; $text.= ' <strong>'.$line->label.'</strong>';
echo $form->textwithtooltip($text,dol_htmlentitiesbr($line->description),3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):'')); echo $form->textwithtooltip($text,dol_htmlentitiesbr($line->description),3,'','',$i,0,($line->fk_parent_line?img_picto('', 'rightarrow'):''));
} else { } else {
echo $text.' '.dol_htmlentitiesbr($line->description); echo $text.' '.dol_htmlentitiesbr($line->description);
} }
// Show range // Show range
print_date_range($line->date_start,$line->date_end); print_date_range($line->date_start,$line->date_end);
} }
} }

View File

@@ -854,7 +854,7 @@ class Expedition extends CommonObject
{ {
// TODO: recuperer les champs du document associe a part // TODO: recuperer les champs du document associe a part
$sql = "SELECT cd.rowid, cd.fk_product, cd.description, cd.qty as qty_asked"; $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked";
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice"; $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice";
$sql.= ", ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
@@ -893,8 +893,8 @@ class Expedition extends CommonObject
$line->ref = $obj->product_ref; // TODO deprecated $line->ref = $obj->product_ref; // TODO deprecated
$line->product_ref = $obj->product_ref; $line->product_ref = $obj->product_ref;
$line->product_label = $obj->product_label; $line->product_label = $obj->product_label;
//$line->label = $obj->product_label;
$line->libelle = $obj->product_label; // TODO deprecated $line->libelle = $obj->product_label; // TODO deprecated
$line->label = $obj->custom_label;
$line->description = $obj->description; $line->description = $obj->description;
$line->qty_asked = $obj->qty_asked; $line->qty_asked = $obj->qty_asked;
$line->qty_shipped = $obj->qty_shipped; $line->qty_shipped = $obj->qty_shipped;

View File

@@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* *
* 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
@@ -543,6 +543,7 @@ llxHeader('',$langs->trans('Sending'),'Expedition');
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
$product_static = new Product($db);
if ($action == 'create2') if ($action == 'create2')
{ {
@@ -700,8 +701,6 @@ if ($action == 'create')
print "</tr>\n"; print "</tr>\n";
} }
$product_static = new Product($db);
$var=true; $var=true;
$indiceAsked = 0; $indiceAsked = 0;
while ($indiceAsked < $numAsked) while ($indiceAsked < $numAsked)
@@ -733,9 +732,8 @@ if ($action == 'create')
$product_static->type=$line->fk_product_type; $product_static->type=$line->fk_product_type;
$product_static->id=$line->fk_product; $product_static->id=$line->fk_product;
$product_static->ref=$line->ref; $product_static->ref=$line->ref;
$product_static->libelle=$line->product_label;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
$text.= ' - '.$line->product_label; $text.= ' - '.(! empty($line->label)?$line->label:$line->product_label);
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->desc)); $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->desc));
print $form->textwithtooltip($text,$description,3,'','',$i); print $form->textwithtooltip($text,$description,3,'','',$i);
@@ -755,7 +753,13 @@ if ($action == 'create')
print "<td>"; print "<td>";
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($line->desc);
if (! empty($line->label)) {
$text.= ' <strong>'.$line->label.'</strong>';
print $form->textwithtooltip($text,$line->desc,3,'','',$i);
} else {
print $text.' '.nl2br($line->desc);
}
// Show range // Show range
print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end));
@@ -1205,23 +1209,22 @@ else
$label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label; $label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label;
} }
else else
$label = $lines[$i]->product_label; $label = (! empty($lines[$i]->label)?$lines[$i]->label:$lines[$i]->product_label);
print '<td>'; print '<td>';
// Affiche ligne produit // Show product and description
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lines[$i]->fk_product.'">'; $product_static->type=$lines[$i]->fk_product_type;
if ($lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service'); $product_static->id=$lines[$i]->fk_product;
else $text.= img_object($langs->trans('ShowProduct'),'product'); $product_static->ref=$lines[$i]->ref;
$text.= ' '.$lines[$i]->ref.'</a>'; $text=$product_static->getNomUrl(1);
$text.= ' - '.$label; $text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($lines[$i]->description)); $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description));
//print $description;
print $form->textwithtooltip($text,$description,3,'','',$i); print $form->textwithtooltip($text,$description,3,'','',$i);
print_date_range($lines[$i]->date_start,$lines[$i]->date_end); print_date_range($lines[$i]->date_start,$lines[$i]->date_end);
if ($conf->global->PRODUIT_DESC_IN_FORM) if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
print ($lines[$i]->description && $lines[$i]->description!=$lines[$i]->product)?'<br>'.dol_htmlentitiesbr($lines[$i]->description):''; print (! empty($lines[$i]->description) && $lines[$i]->description!=$lines[$i]->product)?'<br>'.dol_htmlentitiesbr($lines[$i]->description):'';
} }
} }
else else
@@ -1229,7 +1232,14 @@ else
print "<td>"; print "<td>";
if ($lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); if ($lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($lines[$i]->description);
if (! empty($lines[$i]->label)) {
$text.= ' <strong>'.$lines[$i]->label.'</strong>';
print $form->textwithtooltip($text,$lines[$i]->description,3,'','',$i);
} else {
print $text.' '.nl2br($lines[$i]->description);
}
print_date_range($lines[$i]->date_start,$lines[$i]->date_end); print_date_range($lines[$i]->date_start,$lines[$i]->date_end);
print "</td>\n"; print "</td>\n";
} }
@@ -1473,7 +1483,7 @@ else
} }
} }
$db->close();
llxFooter(); llxFooter();
?> $db->close();
?>

View File

@@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* 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
@@ -29,11 +29,25 @@ require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->projet->enabled))
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->stock->enabled))
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; if (! empty($conf->propal->enabled)) {
if (! class_exists('Propal')) {
require DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
}
}
if (! empty($conf->commande->enabled)) {
if (! class_exists('Commande')) {
require DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
}
}
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) {
if (! class_exists('Product')) {
require DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
}
}
$langs->load('orders'); $langs->load('orders');
$langs->load("companies"); $langs->load("companies");
@@ -350,7 +364,7 @@ if ($id > 0 || ! empty($ref))
*/ */
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
$sql = "SELECT cd.rowid, cd.fk_product, cd.product_type, cd.description,"; $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type, cd.label, cd.description,";
$sql.= " cd.price, cd.tva_tx, cd.subprice,"; $sql.= " cd.price, cd.tva_tx, cd.subprice,";
$sql.= " cd.qty,"; $sql.= " cd.qty,";
$sql.= ' cd.date_start,'; $sql.= ' cd.date_start,';
@@ -423,7 +437,7 @@ if ($id > 0 || ! empty($ref))
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
} }
else else
$label = $objp->product_label; $label = (! empty($objp->label)?$objp->label:$objp->product_label);
print '<td>'; print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
@@ -432,7 +446,6 @@ if ($id > 0 || ! empty($ref))
$product_static->type=$objp->fk_product_type; $product_static->type=$objp->fk_product_type;
$product_static->id=$objp->fk_product; $product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref; $product_static->ref=$objp->ref;
$product_static->libelle=$label;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
$text.= ' - '.$label; $text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
@@ -454,7 +467,13 @@ if ($id > 0 || ! empty($ref))
print "<td>"; print "<td>";
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($objp->description);
if (! empty($objp->label)) {
$text.= ' <strong>'.$objp->label.'</strong>';
print $form->textwithtooltip($text,$objp->description,3,'','',$i);
} else {
print $text.' '.nl2br($objp->description);
}
// Show range // Show range
print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); 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 // 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) if ($user->rights->expedition->creer)
{ {

View File

@@ -79,7 +79,7 @@ if (! empty($idprod))
{ {
$label.= price($objp->fprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit")); $label.= price($objp->fprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
$title.= price($objp->fprice); $title.= price($objp->fprice);
$title.= getCurrencySymbol($conf->currency)."/"; $title.= getCurrencySymbol($conf->currency)."/";
$price = $objp->fprice; $price = $objp->fprice;

View File

@@ -171,4 +171,14 @@ CountryOrigin=Origin country
HiddenIntoCombo=Hidden into select lists HiddenIntoCombo=Hidden into select lists
Nature=Nature Nature=Nature
ProductCodeModel=Product code model ProductCodeModel=Product code model
ServiceCodeModel=Service code model 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=<strong>This option allows you to change the label.</strong><br>Disabling this option will replace the original label.
UpdateOriginalProductDescription=Edit description
HelpUpdateOriginalProductDescription=<strong>This option allows you to change the description.</strong><br>If you have already entered text, it will be automatically placed after.<br>Disabling this option will remove the original description in the editor,<br>but keep the text entered previously.
UpdateOriginalProductPrice=Edit price
HelpUpdateOriginalProductPrice=<strong>This option allows you to change the price.</strong><br>Calculation of VAT will automatically,<br>based on excl. tax if you entered an excl. tax amount<br>, based on incl. tax if you entered an incl. tax amount.<br>Disabling this option will replace the original price.

View File

@@ -173,12 +173,12 @@ Nature=Nature
ProductCodeModel=Modèle de code produit ProductCodeModel=Modèle de code produit
ServiceCodeModel=Modèle de code service ServiceCodeModel=Modèle de code service
AddThisProductCard=Créer fiche produit 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 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é UpdateOriginalProductLabel=Modifier le libellé
HelpUpdateOriginalProductLabel= HelpUpdateOriginalProductLabel=<strong>Cette option permet de modifier le libellé.</strong><br>La desactivation de cette option replacera le libellé d'origine.
UpdateOriginalProductDescription=Modifier la description UpdateOriginalProductDescription=Modifier la description
HelpUpdateOriginalProductDescription= HelpUpdateOriginalProductDescription=<strong>Cette option permet de modifier la description.</strong><br>Si vous avez déjà entré un texte, il sera placé à la suite automatiquement.<br>La desactivation de cette option supprimera le description d'origine dans l'éditeur,<br>mais conservera le texte rentré précédemment.
UpdateOriginalProductPrice=Modifier le prix UpdateOriginalProductPrice=Modifier le prix
HelpUpdateOriginalProductPrice= HelpUpdateOriginalProductPrice=<strong>Cette option permet de modifier le prix.</strong><br>Le calcul de la TVA se fera automatiquement,<br>soit sur la base du prix HT si vous rentré un montant HT,<br>soit sur la base du prix TTC si vous rentré un montant TTC.<br>La désactivation de cette option replacera le prix d'origine.

View File

@@ -665,8 +665,8 @@ class Livraison extends CommonObject
$this->lines = array(); $this->lines = array();
$sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped,"; $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.= " cd.qty as qty_asked, cd.label as custom_label,";
$sql.= " p.ref, p.fk_product_type as fk_product_type, p.label as label, p.description as product_desc"; $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.= " 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.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on p.rowid = ld.fk_product";
$sql.= " WHERE ld.fk_origin_line = cd.rowid"; $sql.= " WHERE ld.fk_origin_line = cd.rowid";
@@ -684,19 +684,21 @@ class Livraison extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$line->description = $obj->description; $line->label = $obj->custom_label;
$line->fk_product = $obj->fk_product; $line->description = $obj->description;
$line->qty_asked = $obj->qty_asked; $line->fk_product = $obj->fk_product;
$line->qty_shipped = $obj->qty_shipped; $line->qty_asked = $obj->qty_asked;
$line->qty_shipped = $obj->qty_shipped;
$line->ref = $obj->ref; $line->ref = $obj->product_ref; // deprecated
$line->libelle = $obj->label; // Label produit $line->libelle = $obj->product_label; // deprecated
$line->label = $obj->label; $line->product_label = $obj->product_label; // Product label
$line->product_desc = $obj->product_desc; // Description produit $line->product_ref = $obj->product_ref; // Product ref
$line->product_type = $obj->fk_product_type; $line->product_desc = $obj->product_desc; // Product description
$line->product_type = $obj->fk_product_type;
$line->price = $obj->price; $line->price = $obj->price;
$line->total_ht = $obj->total_ht; $line->total_ht = $obj->total_ht;
$this->lines[$i] = $line; $this->lines[$i] = $line;

View File

@@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* *
* 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
@@ -30,20 +30,23 @@ require_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
if ($conf->product->enabled || $conf->service->enabled) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
if ($conf->expedition_bon->enabled) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if ($conf->stock->enabled) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; if (! empty($conf->expedition_bon->enabled))
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
if (! empty($conf->stock->enabled))
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
if (!$user->rights->expedition->livraison->lire) accessforbidden();
$langs->load("sendings"); $langs->load("sendings");
$langs->load("bills"); $langs->load("bills");
$langs->load('deliveries'); $langs->load('deliveries');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
// Security check // Security check
$id = isset($_GET["id"])?$_GET["id"]:''; $id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'expedition',$id,'livraison','livraison'); $result=restrictedArea($user,'expedition',$id,'livraison','livraison');
@@ -53,7 +56,7 @@ $result=restrictedArea($user,'expedition',$id,'livraison','livraison');
* Actions * Actions
*/ */
if ($_POST["action"] == 'add') if ($action == 'add')
{ {
$db->begin(); $db->begin();
@@ -89,22 +92,23 @@ if ($_POST["action"] == 'add')
if ($ret > 0) if ($ret > 0)
{ {
$db->commit(); $db->commit();
Header("Location: fiche.php?id=".$delivery->id); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$delivery->id);
exit; exit;
} }
else else
{ {
setEventMessage($delivery->error, 'errors');
$db->rollback(); $db->rollback();
$mesg='<div class="error">'.$delivery->error.'</div>';
$_GET["commande_id"]=$_POST["commande_id"]; $_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 = new Livraison($db);
$object->fetch($_GET["id"]); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$result = $object->valid($user); $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 = new Livraison($db);
$object->fetch($_GET["id"]); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$db->begin(); $db->begin();
@@ -155,10 +159,10 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' &&
/* /*
* Build document * Build document
*/ */
if ($_REQUEST['action'] == 'builddoc') // En get ou en post if ($action == 'builddoc') // En get ou en post
{ {
$object = new Livraison($db); $object = new Livraison($db);
$object->fetch($_REQUEST['id']); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
if ($_REQUEST['model']) if ($_REQUEST['model'])
@@ -220,7 +224,7 @@ $formfile = new FormFile($db);
* Mode creation * Mode creation
* *
*********************************************************************/ *********************************************************************/
if ($_GET["action"] == 'create') if ($action == 'create')
{ {
print_fiche_titre($langs->trans("CreateADeliveryOrder")); print_fiche_titre($langs->trans("CreateADeliveryOrder"));
@@ -233,7 +237,7 @@ if ($_GET["action"] == 'create')
$commande = new Commande($db); $commande = new Commande($db);
$commande->livraison_array(); $commande->livraison_array();
if ( $commande->fetch($_GET["commande_id"])) if ($commande->fetch($_GET["commande_id"]))
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($commande->socid); $soc->fetch($commande->socid);
@@ -329,24 +333,24 @@ if ($_GET["action"] == 'create')
$product->fetch($line->fk_product); $product->fetch($line->fk_product);
$product->load_stock(); $product->load_stock();
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
$commande->fetch_thirdparty(); $commande->fetch_thirdparty();
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$commande->client->default_lang; if (empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $product->libelle; $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $product->label;
} }
else else
$label = $product->libelle; $label = (! empty($line->label)?$line->label:$product->label);
print '<td>'; print '<td>';
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$label; print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$label;
@@ -355,7 +359,19 @@ if ($_GET["action"] == 'create')
} }
else else
{ {
print "<td>".nl2br($line->description)."</td>\n"; print "<td>";
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.= ' <strong>'.$line->label.'</strong>';
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 "</td>\n";
} }
print '<td align="center">'.$line->qty.'</td>'; print '<td align="center">'.$line->qty.'</td>';
@@ -426,10 +442,10 @@ else
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
{ {
if ($_GET["id"] > 0) if ($id > 0)
{ {
$delivery = new Livraison($db); $delivery = new Livraison($db);
$result = $delivery->fetch($_GET["id"]); $result = $delivery->fetch($id);
$delivery->fetch_thirdparty(); $delivery->fetch_thirdparty();
$expedition=new Expedition($db); $expedition=new Expedition($db);
@@ -441,7 +457,7 @@ else
$delivery->fetch_origin(); $delivery->fetch_origin();
} }
if ( $delivery->id > 0) if ($delivery->id > 0)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($delivery->socid); $soc->fetch($delivery->socid);
@@ -453,7 +469,7 @@ else
* Confirmation de la suppression * Confirmation de la suppression
* *
*/ */
if ($_GET["action"] == 'delete') if ($action == 'delete')
{ {
$expedition_id = $_GET["expid"]; $expedition_id = $_GET["expid"];
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&amp;expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1); $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&amp;expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1);
@@ -464,7 +480,7 @@ else
* Confirmation de la validation * 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); $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 '<br>'; if ($ret == 'html') print '<br>';
@@ -570,24 +586,24 @@ else
$product = new Product($db); $product = new Product($db);
$product->fetch($delivery->lines[$i]->fk_product); $product->fetch($delivery->lines[$i]->fk_product);
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
$delivery->fetch_thirdparty(); $delivery->fetch_thirdparty();
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$delivery->client->default_lang; if (empty($newlang)) $newlang=$delivery->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $delivery->lines[$i]->product_label; $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $delivery->lines[$i]->product_label;
} }
else else
$label = $delivery->lines[$i]->product_label; $label = ( ! empty($delivery->lines[$i]->label)?$delivery->lines[$i]->label:$delivery->lines[$i]->product_label);
print '<td>'; print '<td>';
@@ -595,15 +611,15 @@ else
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$delivery->lines[$i]->fk_product.'">'; $text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$delivery->lines[$i]->fk_product.'">';
if ($delivery->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service'); if ($delivery->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product'); else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$delivery->lines[$i]->ref.'</a>'; $text.= ' '.$delivery->lines[$i]->product_ref.'</a>';
$text.= ' - '.$label; $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 $description;
print $form->textwithtooltip($text,$description,3,'','',$i); print $form->textwithtooltip($text,$description,3,'','',$i);
print_date_range($delivery->lines[$i]->date_start,$delivery->lines[$i]->date_end); 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)?'<br>'.dol_htmlentitiesbr($delivery->lines[$i]->description):''; print (! empty($delivery->lines[$i]->description) && $delivery->lines[$i]->description!=$delivery->lines[$i]->product_label)?'<br>'.dol_htmlentitiesbr($delivery->lines[$i]->description):'';
} }
} }
else else
@@ -611,7 +627,14 @@ else
print "<td>"; print "<td>";
if ($delivery->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); if ($delivery->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($delivery->lines[$i]->description);
if (! empty($delivery->lines[$i]->label)) {
$text.= ' <strong>'.$delivery->lines[$i]->label.'</strong>';
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_date_range($objp->date_start,$objp->date_end);
print "</td>\n"; print "</td>\n";
} }
@@ -700,7 +723,7 @@ else
} }
} }
$db->close();
llxFooter(); llxFooter();
?> $db->close();
?>