本文整理汇总了PHP中Product::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::fetch方法的具体用法?PHP Product::fetch怎么用?PHP Product::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _product_link
function _product_link($fk_product)
{
global $db, $langs, $conf;
$p = new Product($db);
$p->fetch($fk_product);
return $p->getNomUrl(1) . ' ' . $p->label;
}
示例2: formObjectOptions
function formObjectOptions($parameters, &$object, &$action, $hookmanager)
{
global $conf, $langs, $db;
if ((in_array('ordercard', explode(':', $parameters['context'])) || in_array('propalcard', explode(':', $parameters['context']))) && $conf->global->REMISE_USE_WEIGHT) {
print '<script type="text/javascript">
$(document).ready(function() { ';
foreach ($object->lines as &$line) {
if ($line->fk_product_type == 0 && $line->fk_product > 0) {
dol_include_once('/product/class/product.class.php', 'Product');
$p = new Product($db);
$p->fetch($line->fk_product);
if ($p->id > 0) {
$weight_kg = $p->weight * $line->qty * pow(10, $p->weight_units);
$id_line = !empty($line->id) ? $line->id : $line->rowid;
if (!empty($weight_kg)) {
print '$("tr#row-' . $id_line . ' td:first").append(" - ' . $langs->trans('Weight') . ' : ' . $weight_kg . 'Kg");';
}
}
}
}
print '});
</script>';
}
return 0;
}
示例3: delete
/**
* Delete product
*
* @param int $id Product ID
* @return array
*
* @url DELETE product/{id}
*/
function delete($id)
{
if (!DolibarrApiAccess::$user->rights->product->supprimer) {
throw new RestException(401);
}
$result = $this->product->fetch($id);
if (!$result) {
throw new RestException(404, 'Product not found');
}
if (!DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
return $this->product->delete($id);
}
示例4: isLineShippable
function isLineShippable(&$line, &$TSomme)
{
global $conf, $user;
$db =& $this->db;
$TSomme[$line->fk_product] += $line->qty_toship;
if (!isset($line->stock) && $line->fk_product > 0) {
if (empty($this->TProduct[$line->fk_product])) {
$produit = new Product($db);
$produit->fetch($line->fk_product);
$produit->load_stock(false);
$this->TProduct[$line->fk_product] = $produit;
} else {
$produit =& $this->TProduct[$line->fk_product];
}
$line->stock = $produit->stock_reel;
// Filtre par entrepot de l'utilisateur
if (!empty($conf->global->SHIPPABLEORDER_ENTREPOT_BY_USER) && !empty($user->array_options['options_entrepot_preferentiel'])) {
$line->stock = $produit->stock_warehouse[$user->array_options['options_entrepot_preferentiel']]->real;
} elseif (!empty($conf->global->SHIPPABLEORDER_SPECIFIC_WAREHOUSE)) {
$line->stock = 0;
//Récupération des entrepôts valide
$TIdWarehouse = explode(',', $conf->global->SHIPPABLEORDER_SPECIFIC_WAREHOUSE);
foreach ($produit->stock_warehouse as $identrepot => $objecttemp) {
if (in_array($identrepot, $TIdWarehouse)) {
$line->stock += $objecttemp->real;
}
}
}
}
if ($conf->global->SHIPPABLE_ORDER_ALLOW_SHIPPING_IF_NOT_ENOUGH_STOCK) {
$isShippable = 1;
$qtyShippable = $line->qty;
$line->stock = $line->qty;
} else {
if ($line->stock <= 0 || $line->qty_toship <= 0) {
$isShippable = 0;
$qtyShippable = 0;
} else {
if ($TSomme[$line->fk_product] <= $line->stock) {
$isShippable = 1;
$qtyShippable = $line->qty_toship;
} else {
$isShippable = 2;
$qtyShippable = $line->qty_toship - $TSomme[$line->fk_product] + $line->stock;
}
}
}
$this->TlinesShippable[$line->id] = array('stock' => $line->stock, 'shippable' => $isShippable, 'to_ship' => $line->qty_toship, 'qty_shippable' => $qtyShippable);
return $isShippable;
}
示例5: mouvement
function mouvement(&$PDOdb, &$object, $fk_product, $qty, $fk_warehouse_from, $fk_warehouse_to)
{
global $db, $user, $langs;
dol_include_once('/product/stock/class/mouvementstock.class.php');
dol_include_once('/product/class/product.class.php');
/*var_dump($fk_product, $qty,$fk_warehouse_from, $fk_warehouse_to);
exit;
*/
$stock = new MouvementStock($db);
$label = '';
if (method_exists($object, 'getNomUrl')) {
$label .= $object->getNomUrl(1);
}
if (!empty($conf->global->ROUTING_INFO_ALERT)) {
$product = new Product($db);
$product->fetch($fk_product);
$msg = $product->getNomUrl(0) . ' ' . $product->label . ' ' . $langs->trans('MoveFrom') . ' ' . $wh_from_label . ' ' . $langs->trans('MoveTo') . ' ' . $wh_to_label;
setEventMessage($msg);
}
$stock->origin = $object;
$stock->reception($user, $fk_product, $fk_warehouse_to, $qty, 0, $label);
$stock->livraison($user, $fk_product, $fk_warehouse_from, $qty, 0, $label);
}
示例6: Product
if ($idproduct > 0) {
$sql .= " AND p.rowid = '" . $idproduct . "'";
}
if ($head_check != '') {
$sql .= " AND m.checked = 1";
} else {
$sql .= " AND m.checked = -1";
}
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
if ($idproduct) {
$product = new Product($db);
$product->fetch($idproduct);
}
if ($id > 0) {
$entrepot = new Entrepot($db);
$result = $entrepot->fetch($id);
if ($result < 0) {
dol_print_error($db);
}
}
$i = 0;
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
$texte = $langs->trans("ListOfStockMovements");
if ($id) {
$texte .= ' (' . $langs->trans("ForThisWarehouse") . ')';
}
llxHeader("", $texte, $help_url);
示例7: count
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $user, $langs, $conf, $mysoc, $db, $hookmanager;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$nblignes = count($object->lines);
// Loop on each lines to detect if there is at least one image to show
$realpatharray = array();
if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) {
for ($i = 0; $i < $nblignes; $i++) {
if (empty($object->lines[$i]->fk_product)) {
continue;
}
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product . "/photos/";
$dir = $conf->product->dir_output . '/' . $pdir;
$realpath = '';
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
$filename = $obj['photo'];
//if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette'];
$realpath = $dir . $filename;
break;
}
if ($realpath) {
$realpatharray[$i] = $realpath;
}
}
}
if (count($realpatharray) == 0) {
$this->posxpicture = $this->posxtva;
}
if ($conf->facture->dir_output) {
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement();
$amount_credit_notes_included = $object->getSumCreditNotesUsed();
$amount_deposits_included = $object->getSumDepositsUsed();
// Definition of $dir and $file
if ($object->specimen) {
$dir = $conf->facture->dir_output;
$file = $dir . "/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->facture->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
// Add pdfgeneration hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action);
// Note that $action and $object may have been modified by some hooks
// Set nblignes with the new facture lines content after hook
$nblignes = count($object->lines);
// Create pdf instance
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Must be after pdf_getInstance
$heightforinfotot = 50;
// Height reserved to output the info and total part
$heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
// Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8;
// Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//.........这里部分代码省略.........
示例8: accessforbidden
if ($modulepart == 'holiday' && !$user->rights->holiday->read) {
accessforbidden();
}
$accessallowed = 1;
}
// Security:
// Limit access if permissions are wrong
if (!$accessallowed) {
accessforbidden();
}
// Define dir according to modulepart
if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'service' || $modulepart == 'produit|service') {
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
$object = new Product($db);
if ($id > 0) {
$result = $object->fetch($id);
if ($result <= 0) {
dol_print_error($db, 'Failed to load object');
}
$dir = $conf->product->multidir_output[$object->entity];
// By default
if ($object->type == Product::TYPE_PRODUCT) {
$dir = $conf->product->multidir_output[$object->entity];
}
if ($object->type == Product::TYPE_SERVICE) {
$dir = $conf->service->multidir_output[$object->entity];
}
}
} elseif ($modulepart == 'holiday') {
require_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php';
$object = new Holiday($db);
示例9: header
if ($result < 0) {
dol_print_error('', $object->error);
}
}
if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confirm == 'yes') {
if ($object->delete($user) >= 0) {
header("Location: " . DOL_URL_ROOT . '/categories/index.php?type=' . $type);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer)) {
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
$newobject = new Product($db);
$result = $newobject->fetch($elemid);
$elementtype = 'product';
// TODO Add into categ
$result = $object->add_type($newobject, $elementtype);
if ($result >= 0) {
setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs');
} else {
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
/*
* View
示例10: getHeadForObject
static function getHeadForObject($tab_object, $fk_object)
{
global $db, $conf, $langs, $user;
$head = array();
if (empty($tab_object)) {
return $head;
}
if ($tab_object === 'product') {
dol_include_once('/product/class/product.class.php');
dol_include_once('/core/lib/product.lib.php');
$object = new Product($db);
$object->fetch($fk_object);
$head = product_prepare_head($object);
} else {
if ($tab_object === 'thirdparty') {
dol_include_once('/societe/class/societe.class.php');
dol_include_once('/core/lib/company.lib.php');
$object = new Societe($db);
$object->fetch($fk_object);
$head = societe_prepare_head($object);
} else {
if ($tab_object === 'contact') {
dol_include_once('/contact/class/contact.class.php');
dol_include_once('/core/lib/contact.lib.php');
$object = new Contact($db);
$object->fetch($fk_object);
$head = contact_prepare_head($object);
} else {
if ($tab_object === 'user') {
dol_include_once('/user/class/user.class.php');
dol_include_once('/core/lib/usergroups.lib.php');
$object = new User($db);
$object->fetch($fk_object);
$head = user_prepare_head($object);
} else {
if ($tab_object === 'group') {
dol_include_once('/user/class/usergroup.class.php');
dol_include_once('/lib/usergroups.lib.php');
$object = new UserGroup($db);
$object->fetch($fk_object);
$head = group_prepare_head($object);
} else {
if ($tab_object === 'project') {
dol_include_once('/projet/class/project.class.php');
dol_include_once('/core/lib/project.lib.php');
$object = new Project($db);
$object->fetch($fk_object);
$head = project_prepare_head($object);
}
}
}
}
}
}
return $head;
}
示例11: Product
/**
* Assign custom values for canvas (for example into this->tpl to be used by templates)
*
* @param string &$action Type of action
* @param string $id Id of object
* @param string $ref Ref of object
* @return void
*/
function assign_values(&$action, $id=0, $ref='')
{
global $conf, $langs, $user, $mysoc, $canvas;
global $form, $formproduct;
$tmpobject = new Product($this->db);
if (! empty($id) || ! empty($ref)) $tmpobject->fetch($id,$ref);
$this->object = $tmpobject;
//parent::assign_values($action);
foreach($this->object as $key => $value)
{
$this->tpl[$key] = $value;
}
$this->tpl['error'] = get_htmloutput_errors($this->object->error,$this->object->errors);
// canvas
$this->tpl['canvas'] = $this->canvas;
// id
$this->tpl['id'] = $this->id;
// Ref
$this->tpl['ref'] = $this->ref;
// Label
$this->tpl['label'] = $this->libelle;
// Description
$this->tpl['description'] = nl2br($this->description);
// Statut
$this->tpl['status'] = $this->getLibStatut(2);
// Note
$this->tpl['note'] = nl2br($this->note);
if ($action == 'create')
{
// Price
$this->tpl['price'] = $this->price;
$this->tpl['price_min'] = $this->price_min;
$this->tpl['price_base_type'] = $form->load_PriceBaseType($this->price_base_type, "price_base_type");
// VAT
$this->tpl['tva_tx'] = $form->load_tva("tva_tx",-1,$mysoc,'');
}
if ($action == 'create' || $action == 'edit')
{
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $form->selectarray('statut',$statutarray,$this->status);
//To Buy
$statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No"));
$this->tpl['tobuy'] = $form->selectarray('tobuy',$statutarray,$this->status_buy);
$this->tpl['description'] = $this->description;
$this->tpl['note'] = $this->note;
}
if ($action == 'view')
{
$head = product_prepare_head($this->object,$user);
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'ref','',1,'ref');
$titre=$langs->trans("CardProduct".$this->object->type);
$picto=($this->object->type==1?'service':'product');
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $titre, 0, $picto);
$this->tpl['showend']=dol_get_fiche_end();
// Accountancy buy code
$this->tpl['accountancyBuyCodeKey'] = $form->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,$this,$user->rights->produit->creer);
$this->tpl['accountancyBuyCodeVal'] = $form->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,$this,$user->rights->produit->creer);
// Accountancy sell code
$this->tpl['accountancySellCodeKey'] = $form->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,$this,$user->rights->produit->creer);
$this->tpl['accountancySellCodeVal'] = $form->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,$this,$user->rights->produit->creer);
}
$this->tpl['finished'] = $this->object->finished;
$this->tpl['ref'] = $this->object->ref;
$this->tpl['label'] = $this->object->label;
$this->tpl['id'] = $this->object->id;
$this->tpl['type'] = $this->object->type;
$this->tpl['note'] = $this->object->note;
$this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;
//.........这里部分代码省略.........
示例12: Product
/**
* Add line into array
* $this->client doit etre charge
* @param idproduct Id du produit a ajouter
* @param qty Quantite
* @param remise_percent Remise relative effectuee sur le produit
* @param date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @return void
* TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products
*/
function add_product($idproduct, $qty, $remise_percent = 0, $date_start = '', $date_end = '')
{
global $conf, $mysoc;
if (!$qty) {
$qty = 1;
}
if ($idproduct > 0) {
$prod = new Product($this->db);
$prod->fetch($idproduct);
$tva_tx = get_default_tva($mysoc, $this->client, $prod->id);
$localtax1_tx = get_localtax($tva_tx, 1, $this->client);
$localtax2_tx = get_localtax($tva_tx, 2, $this->client);
// multiprix
if ($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level) {
$price = $prod->multiprices[$this->client->price_level];
} else {
$price = $prod->price;
}
$line = new OrderLine($this->db);
$line->fk_product = $idproduct;
$line->desc = $prod->description;
$line->qty = $qty;
$line->subprice = $price;
$line->remise_percent = $remise_percent;
$line->tva_tx = $tva_tx;
$line->localtax1_tx = $localtax1_tx;
$line->localtax2_tx = $localtax2_tx;
$line->ref = $prod->ref;
$line->libelle = $prod->libelle;
$line->product_desc = $prod->description;
// Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
// Save the start and end date of the line in the object
if ($date_start) {
$line->date_start = $date_start;
}
if ($date_end) {
$line->date_end = $date_end;
}
$this->lines[] = $line;
/** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
{
$prod = new Product($this->db, $idproduct);
$prod -> get_sousproduits_arbo ();
$prods_arbo = $prod->get_each_prod();
if(sizeof($prods_arbo) > 0)
{
foreach($prods_arbo as $key => $value)
{
// print "id : ".$value[1].' :qty: '.$value[0].'<br>';
if(! in_array($value[1],$this->products))
$this->add_product($value[1], $value[0]);
}
}
}
**/
}
}
示例13: _genInfoEtiquette
function _genInfoEtiquette(&$db, &$PDOdb, &$TPrintTicket)
{
global $conf;
$TInfoEtiquette = array();
if (empty($TPrintTicket)) {
return $TInfoEtiquette;
}
dol_include_once('/commande/class/commande.class.php');
$assetOf = new TAssetOF();
$cmd = new Commande($db);
$product = new Product($db);
$pos = 1;
$cpt = 0;
foreach ($TPrintTicket as $fk_assetOf => $qty) {
if ($qty <= 0) {
continue;
}
$load = $assetOf->load($PDOdb, $fk_assetOf);
if ($load === true) {
$cmd->fetch($assetOf->fk_commande);
foreach ($assetOf->TAssetOFLine as &$assetOfLine) {
if ($assetOfLine->type == 'TO_MAKE' && $product->fetch($assetOfLine->fk_product) > 0) {
for ($i = 0; $i < $qty; $i++) {
$cpt++;
if ($cpt % 2 == 0) {
$div = 'pair';
} else {
$div = 'impair';
}
$TInfoEtiquette[] = array('numOf' => $assetOf->numero, 'float' => $div, 'refCmd' => $cmd->ref, 'refCliCmd' => $cmd->ref_client, 'refProd' => $product->ref, 'qty_to_print' => $qty, 'qty_to_make' => $assetOfLine->qty, 'label' => wordwrap(preg_replace('/\\s\\s+/', ' ', $product->label), 20, $conf->global->DEFAULT_ETIQUETTES == 2 ? "\n" : "</br>"), 'pos' => ceil($pos / 8));
//var_dump($TInfoEtiquette);exit;
$pos++;
//var_dump($TInfoEtiquette);
}
}
}
}
}
//exit;
return $TInfoEtiquette;
}
示例14:
$line = $object->lines[$indiceAsked];
$var = !$var;
// Show product and description
$type = $line->product_type ? $line->product_type : $line->fk_product_type;
// Try to enhance type detection using date_start and date_end for free lines where type
// was not saved.
if (!empty($line->date_start)) {
$type = 1;
}
if (!empty($line->date_end)) {
$type = 1;
}
print "<tr " . $bc[$var] . ">\n";
// Product label
if ($line->fk_product > 0) {
$product->fetch($line->fk_product);
$product->load_stock();
print '<td>';
print '<a name="' . $line->rowid . '"></a>';
// ancre pour retourner sur la ligne
// Show product and description
$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;
$description = $conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc);
print $html->textwithtooltip($text, $description, 3, '', '', $i);
// Show range
print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
示例15: pdf_getlinedesc
/**
* Return line description translated in outputlangs and encoded into htmlentities and with <br>
*
* @param Object $object Object
* @param int $i Current line number (0 = first line, 1 = second line, ...)
* @param Translate $outputlangs Object langs for output
* @param int $hideref Hide reference
* @param int $hidedesc Hide description
* @param int $issupplierline Is it a line for a supplier object ?
* @return string String with line
*/
function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
{
global $db, $conf, $langs;
$idprod = !empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false;
$label = !empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '');
$desc = !empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '');
$ref_supplier = !empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '');
// TODO Not yet saved for supplier invoices, only supplier orders
$note = !empty($object->lines[$i]->note) ? $object->lines[$i]->note : '';
$dbatch = !empty($object->lines[$i]->detail_batch) ? $object->lines[$i]->detail_batch : false;
if ($issupplierline) {
$prodser = new ProductFournisseur($db);
} else {
$prodser = new Product($db);
}
if ($idprod) {
$prodser->fetch($idprod);
// If a predefined product and multilang and on other lang, we renamed label with label translated
if (!empty($conf->global->MAIN_MULTILANGS) && $outputlangs->defaultlang != $langs->defaultlang) {
$translatealsoifmodified = !empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED);
// By default if value was modified manually, we keep it (no translation because we don't have it)
// TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation
// ($textwasmodified is replaced with $textwasmodifiedorcompleted and we add completion).
// Set label
// If we want another language, and if label is same than default language (we did force it to a specific value), we can use translation.
//var_dump($outputlangs->defaultlang.' - '.$langs->defaultlang.' - '.$label.' - '.$prodser->label);exit;
$textwasmodified = $label == $prodser->label;
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && ($textwasmodified || $translatealsoifmodified)) {
$label = $prodser->multilangs[$outputlangs->defaultlang]["label"];
}
// Set desc
// Manage HTML entities description test because $prodser->description is store with htmlentities but $desc no
$textwasmodified = false;
if (!empty($desc) && dol_textishtml($desc) && !empty($prodser->description) && dol_textishtml($prodser->description)) {
$textwasmodified = strpos(dol_html_entity_decode($desc, ENT_QUOTES | ENT_HTML401), dol_html_entity_decode($prodser->description, ENT_QUOTES | ENT_HTML401)) !== false;
} else {
$textwasmodified = $desc == $prodser->description;
}
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($textwasmodified || $translatealsoifmodified)) {
$desc = $prodser->multilangs[$outputlangs->defaultlang]["description"];
}
// Set note
$textwasmodified = $note == $prodser->note;
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) {
$note = $prodser->multilangs[$outputlangs->defaultlang]["note"];
}
}
}
// Description short of product line
$libelleproduitservice = $label;
// Description long of product line
if (!empty($desc) && $desc != $label) {
if ($libelleproduitservice && empty($hidedesc)) {
$libelleproduitservice .= '__N__';
}
if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromCreditNote", $discount->ref_facture_source);
} elseif ($desc == '(DEPOSIT)' && $object->lines[$i]->fk_remise_except) {
$discount = new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $discount->ref_facture_source);
// Add date of deposit
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) {
echo ' (' . dol_print_date($discount->datec, 'day', '', $outputlangs) . ')';
}
} else {
if ($idprod) {
if (empty($hidedesc)) {
$libelleproduitservice .= $desc;
}
} else {
$libelleproduitservice .= $desc;
}
}
}
// If line linked to a product
if ($idprod) {
// We add ref
if ($prodser->ref) {
$prefix_prodserv = "";
$ref_prodserv = "";
if (!empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) {
if ($prodser->isService()) {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service") . " ";
} else {
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product") . " ";
}
//.........这里部分代码省略.........