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