diff --git a/ChangeLog b/ChangeLog index e64bbc9e6b4a475e367d29295f9594cbeaa34b34..f081802dee6489b47b7e1515182197544968ad3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,7 @@ For users: - New: Status "validated" for project are renamed into "opened". - New: Add barcode fields into user database. - New: Add manager name (ceo, director, president...) into main company information page. +- New: Add field url as product properties. - Fix: Project Task numbering customs rule works. TODO diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 87914442b1d3c79157002cc6116ccc5419654440..92bbdc6229816879b96ebd265564eea6218658ba 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Christophe Battarel <contact@altairis.fr> - * Copyright (C) 2014 C�dric Gross <c.gross@kreiz-it.fr> + * Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr> * * 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 @@ -153,15 +153,15 @@ class modProduct extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("produit","export")); - $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); + $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.customcode'=>'CustomCode','p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'); if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.pmp'=>'PMPValue')); if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices')); - $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); + $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Number",'p.surface'=>"Number",'p.volume'=>"Number",'p.weight'=>"Number",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Number",'p.price_ttc'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.pmp'=>'Number')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Number')); - $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); + $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.stock'=>'product','p.pmp'=>'product')); if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('p.barcode'=>'product')); if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r],array('s.nom'=>'product','pf.ref_fourn'=>'product','pf.unitprice'=>'product')); @@ -218,7 +218,7 @@ class modProduct extends DolibarrModules $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields'); $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id - $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*'); + $this->import_fields_array[$r]=array('p.ref'=>"Ref*",'p.label'=>"Label*",'p.description'=>"Description",'p.url'=>"PublicUrl",'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",'p.note'=>"Note",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.weight'=>"Weight",'p.duration'=>"Duration",'p.customcode'=>'CustomCode','p.price'=>"SellingPriceHT",'p.price_ttc'=>"SellingPriceTTC",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell*",'p.tobuy'=>"OnBuy*",'p.fk_product_type'=>"Type*",'p.finished'=>'Nature','p.datec'=>'DateCreation*'); // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity = ".$conf->entity; $resql=$this->db->query($sql); diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index 3738701e18dfa6ef386adfdc99ca4cc64bac79a1..eef2d5eedce5033eb28c3a06f881ddcb38bd6e13 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -996,6 +996,8 @@ ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_customer_price_fk_soc F ALTER TABLE llx_user ADD COLUMN barcode varchar(255) DEFAULT NULL; ALTER TABLE llx_user ADD COLUMN fk_barcode_type integer DEFAULT 0; +ALTER TABLE llx_product ADD COLUMN url varchar(255); + create table llx_product_customer_price_log ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 14e47fe7fe680d4a80398d82d15cc196e07357b6..582f816136598506e965f360422f3ad2cb95d83f 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -54,6 +54,7 @@ create table llx_product fk_product_type integer DEFAULT 0, -- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module) duration varchar(6), seuil_stock_alerte integer DEFAULT 0, + url varchar(255), barcode varchar(255) DEFAULT NULL, fk_barcode_type integer DEFAULT 0, accountancy_code_sell varchar(15), -- Selling accountancy code diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index b713991b94f41488a408533e0cf9d549e8838dd2..ef13f96e85cc34bc35762314b3a3db7b829c85d5 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -667,6 +667,7 @@ OriginFileName=Original filename SetDemandReason=Set source ViewPrivateNote=View notes XMoreLines=%s line(s) hidden +PublicUrl=Public URL # Week day Monday=Monday diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b0b0e1f908f3420bce1010b64a25233ef3f8b8d2..bd79584578332df98e38268d1cd36d9266ab0e32 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -610,7 +610,8 @@ class Product extends CommonObject $sql.= ", volume_units = " . ($this->volume_units!='' ? "'".$this->volume_units."'" : 'null'); $sql.= ", seuil_stock_alerte = " . ((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->seuil_stock_alerte."'" : "null"); $sql.= ", description = '" . $this->db->escape($this->description) ."'"; - $sql.= ", customcode = '" . $this->db->escape($this->customcode) ."'"; + $sql.= ", url = " . ($this->url?"'".$this->db->escape($this->url)."'":''); + $sql.= ", customcode = '" . $this->db->escape($this->customcode) ."'"; $sql.= ", fk_country = " . ($this->country_id > 0 ? $this->country_id : 'null'); $sql.= ", note = '" . $this->db->escape($this->note) ."'"; $sql.= ", duration = '" . $this->duration_value . $this->duration_unit ."'"; @@ -1277,7 +1278,7 @@ class Product extends CommonObject return -1; } - $sql = "SELECT rowid, ref, label, description, note, customcode, fk_country, price, price_ttc,"; + $sql = "SELECT rowid, ref, label, description, url, note, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, tosell,"; $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,"; $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; @@ -1305,6 +1306,7 @@ class Product extends CommonObject $this->libelle = $obj->label; // TODO deprecated $this->label = $obj->label; $this->description = $obj->description; + $this->url = $obj->url; $this->note = $obj->note; $this->type = $obj->fk_product_type; diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index d0b4f9142107d2c86e09431c288add2a0e3f16d4..b966c089d45800064f018c2f549c6052fde2876b 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -203,8 +203,9 @@ if (empty($reshook)) $object->barcode_type = GETPOST('fk_barcode_type'); $object->barcode = GETPOST('barcode'); - + $object->description = dol_htmlcleanlastbr(GETPOST('desc')); + $object->url = GETPOST('url'); $object->note = dol_htmlcleanlastbr(GETPOST('note')); $object->customcode = GETPOST('customcode'); $object->country_id = GETPOST('country_id'); @@ -278,6 +279,7 @@ if (empty($reshook)) $object->ref = $ref; $object->libelle = GETPOST('libelle'); $object->description = dol_htmlcleanlastbr(GETPOST('desc')); + $object->url = GETPOST('url'); $object->note = dol_htmlcleanlastbr(GETPOST('note')); $object->customcode = GETPOST('customcode'); $object->country_id = GETPOST('country_id'); @@ -805,11 +807,16 @@ else // Description (used in invoice, propal...) print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; - $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 90); + $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); $doleditor->Create(); print "</td></tr>"; + // Public URL + print '<tr><td valign="top">'.$langs->trans("PublicUrl").'</td><td colspan="3">'; + print '<input type="text" name="url" size="90" value="'.GETPOST('url').'">'; + print '</td></tr>'; + // Stock min level if ($type != 1 && ! empty($conf->stock->enabled)) { @@ -1057,13 +1064,18 @@ else // Description (used in invoice, propal...) print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; - // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. + // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); $doleditor->Create(); print "</td></tr>"; print "\n"; + // Public Url + print '<tr><td valign="top">'.$langs->trans("PublicUrl").'</td><td colspan="3">'; + print '<input type="text" name="url" size="80" value="'.$object->url.'">'; + print '</td></tr>'; + // Stock if ($object->isproduct() && ! empty($conf->stock->enabled)) { @@ -1322,6 +1334,11 @@ else // Description print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'</td></tr>'; + // Public URL + print '<tr><td valign="top">'.$langs->trans("PublicUrl").'</td><td colspan="2">'; + print dol_print_url($object->url); + print '</td></tr>'; + // Nature if($object->type!=1) {