Merge pull request #15164 from marc-dll/NEW_product_customer_price_ref

NEW: customer ref for product customer prices
This commit is contained in:
Laurent Destailleur 2021-01-13 14:22:55 +01:00 committed by GitHub
commit df9f2cdca4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 675 additions and 11 deletions

View File

@ -2169,8 +2169,8 @@ class Form
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid))
{
$sql .= ', pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,';
$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx';
$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx";
$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx, pcp.ref_customer as custref';
$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custref";
}
// Units
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -2280,6 +2280,7 @@ class Form
if ($i > 0) $sql .= " AND ";
$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && ! empty($socid)) $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
if (!empty($conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION))
{
$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
@ -2469,6 +2470,7 @@ class Form
$outkey = $objp->rowid;
$outref = $objp->ref;
$outrefcust = empty($objp->custref) ? '' : $objp->custref;
$outlabel = $objp->label;
$outdesc = $objp->description;
if (!empty($conf->global->MAIN_MULTILANGS))
@ -2543,11 +2545,13 @@ class Form
}
$opt .= '>';
$opt .= $objp->ref;
if (! empty($objp->custref)) $opt.= ' (' . $objp->custref . ')';
if ($outbarcode) $opt .= ' ('.$outbarcode.')';
$opt .= ' - '.dol_trunc($label, $maxlengtharticle);
if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) $opt .= ' ('.getCountry($outorigin, 1).')';
$objRef = $objp->ref;
if (! empty($objp->custref)) $objRef .= ' (' . $objp->custref . ')';
if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
$outval .= $objRef;
if ($outbarcode) $outval .= ' ('.$outbarcode.')';
@ -2727,7 +2731,8 @@ class Form
'duration_unit'=>$outdurationunit,
'pbq'=>$outpbq,
'labeltrans'=>$outlabel_translated,
'desctrans'=>$outdesc_translated
'desctrans'=>$outdesc_translated,
'ref_customer'=>$outrefcust
);
}

View File

@ -139,7 +139,8 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
type: item.type, qty: item.qty, discount: item.discount,
pricebasetype: item.pricebasetype, price_ht: item.price_ht,
price_ttc: item.price_ttc,
up: item.up, description : item.description}
up: item.up, description : item.description,
ref_customer: item.ref_customer }
}));
}
else console.error("Error: Ajax url '.$url.($urloption ? '?'.$urloption : '').' has returned an empty page. Should be an empty json array.");
@ -157,6 +158,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
$("#'.$htmlname.'").attr("data-discount", ui.item.discount);
$("#'.$htmlname.'").attr("data-qty", ui.item.qty);
$("#'.$htmlname.'").attr("data-description", ui.item.description);
$("#'.$htmlname.'").attr("data-ref-customer", ui.item.ref_customer);
//For customer price
';

View File

@ -1236,6 +1236,10 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
} else {
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$prodser = new Product($db);
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
}
}
if ($idprod)
@ -1375,6 +1379,32 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
} else {
$ref_prodserv = $prodser->ref; // Show local ref only
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$productCustomerPriceStatic = new Productcustomerprice($db);
$filter = array('fk_product' => $idprod, 'fk_soc' => $object->socid);
$nbCustomerPrices = $productCustomerPriceStatic->fetch_all('', '', 1, 0, $filter);
if ($nbCustomerPrices > 0) {
$productCustomerPrice = $productCustomerPriceStatic->lines[0];
if (! empty($productCustomerPrice->ref_customer)) {
switch ($conf->global->PRODUIT_CUSTOMER_PRICES_PDF_REF_MODE) {
case 1:
$ref_prodserv = $productCustomerPrice->ref_customer;
break;
case 2:
$ref_prodserv = $productCustomerPrice->ref_customer . ' (' . $outputlangs->transnoentitiesnoconv('InternalRef') . ' ' . $ref_prodserv . ')';
break;
default:
$ref_prodserv = $ref_prodserv . ' (' . $outputlangs->transnoentitiesnoconv('RefCustomer') . ' ' . $productCustomerPrice->ref_customer . ')';
}
}
}
}
}
if (!empty($libelleproduitservice) && !empty($ref_prodserv)) $ref_prodserv .= " - ";

View File

@ -0,0 +1,568 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 13.0.0 or higher.
--
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres):
-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- Note: fields with type BLOB/TEXT can't have default value.
-- Missing in v12 or lower
ALTER TABLE llx_payment_salary MODIFY COLUMN ref varchar(30) NULL;
ALTER TABLE llx_payment_various MODIFY COLUMN ref varchar(30) NULL;
ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order';
ALTER TABLE llx_prelevement_facture CHANGE COLUMN fk_facture_foun fk_facture_fourn integer NULL;
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);
ALTER TABLE llx_document_model MODIFY COLUMN type varchar(64);
ALTER TABLE llx_bom_bom MODIFY COLUMN duration double(24,8);
ALTER TABLE llx_bom_bom_extrafields ADD INDEX idx_bom_bom_extrafields_fk_object (fk_object);
create table llx_mrp_mo_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_mrp_mo_extrafields DROP INDEX idx_fk_object;
ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_mrp_mo_fk_object(fk_object);
-- For v13
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (111,11, '0','0','No Sales Tax',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (112,11, '4','0','Sales Tax 4%',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (113,11, '6','0','Sales Tax 6%',1);
ALTER TABLE llx_bom_bom ADD COLUMN bomtype integer DEFAULT 0;
UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Ticket_Requests' WHERE ref = 'Collect_Ticket_Requets';
UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Responses_In' WHERE ref = 'Collect_Responses';
UPDATE llx_document_model set nom = 'standard' where nom = 'Standard' and type ='stock';
UPDATE llx_document_model set nom = 'stdmovement', type = 'movement' where nom = 'StdMouvement' and type ='mouvement';
UPDATE llx_const SET value = 0 WHERE name = 'FACTURE_TVAOPTION' and value = 'franchise';
UPDATE llx_const SET value = 1 WHERE name = 'FACTURE_TVAOPTION' and value <> 'franchise' AND value <> '0' AND value <> '1';
ALTER TABLE llx_commande MODIFY COLUMN date_livraison DATETIME;
ALTER TABLE llx_website ADD COLUMN position integer DEFAULT 0;
ALTER TABLE llx_establishment ADD COLUMN ref varchar(30);
ALTER TABLE llx_establishment ADD COLUMN label varchar(128);
UPDATE llx_establishment SET ref = rowid WHERE ref IS NULL;
ALTER TABLE llx_establishment MODIFY COLUMN ref varchar(30) NOT NULL;
ALTER TABLE llx_establishment MODIFY COLUMN label varchar(128);
INSERT INTO llx_const (name, entity, value, type, visible) VALUES ('PRODUCT_PRICE_BASE_TYPE', 0, 'HT', 'string', 0);
ALTER TABLE llx_subscription MODIFY COLUMN datef DATETIME;
ALTER TABLE llx_loan_schedule ADD column fk_payment_loan INTEGER;
ALTER TABLE llx_user DROP COLUMN jabberid;
ALTER TABLE llx_user DROP COLUMN skype;
ALTER TABLE llx_user DROP COLUMN twitter;
ALTER TABLE llx_user DROP COLUMN facebook;
ALTER TABLE llx_user DROP COLUMN linkedin;
ALTER TABLE llx_user DROP COLUMN instagram;
ALTER TABLE llx_user DROP COLUMN snapchat;
ALTER TABLE llx_user DROP COLUMN googleplus;
ALTER TABLE llx_user DROP COLUMN youtube;
ALTER TABLE llx_user DROP COLUMN whatsapp;
ALTER TABLE llx_user ADD COLUMN datelastpassvalidation datetime;
ALTER TABLE llx_user ADD COLUMN datestartvalidity datetime;
ALTER TABLE llx_user ADD COLUMN dateendvalidity datetime;
ALTER TABLE llx_user ADD COLUMN idpers1 varchar(128);
ALTER TABLE llx_user ADD COLUMN idpers2 varchar(128);
ALTER TABLE llx_user ADD COLUMN idpers3 varchar(128);
-- Intracomm Report
CREATE TABLE llx_c_transport_mode (
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
code varchar(3) NOT NULL,
label varchar(255) NOT NULL,
active tinyint DEFAULT 1 NOT NULL
) ENGINE=innodb;
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('MAR', 'Transport maritime (y compris camions ou wagons sur bateau)', 1);
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('TRA', 'Transport par chemin de fer (y compris camions sur wagon)', 1);
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('ROU', 'Transport par route', 1);
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('AIR', 'Transport par air', 1);
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('POS', 'Envois postaux', 1);
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('OLE', 'Installations de transport fixe (oléoduc)', 1);
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('NAV', 'Transport par navigation intérieure', 1);
INSERT INTO llx_c_transport_mode (code, label, active) VALUES ('PRO', 'Propulsion propre', 1);
ALTER TABLE llx_facture ADD COLUMN fk_transport_mode integer after location_incoterms;
ALTER TABLE llx_facture_fourn ADD COLUMN fk_transport_mode integer after location_incoterms;
ALTER TABLE llx_societe ADD COLUMN transport_mode tinyint after cond_reglement;
ALTER TABLE llx_societe ADD COLUMN transport_mode_supplier tinyint after cond_reglement_supplier;
CREATE TABLE llx_intracommreport
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
ref varchar(30) NOT NULL, -- report reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
type_declaration varchar(32),
periods varchar(32),
mode varchar(32),
content_xml text,
type_export varchar(10),
datec datetime,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)ENGINE=innodb;
ALTER TABLE llx_c_incoterms ADD COLUMN label varchar(100) NULL;
CREATE TABLE llx_recruitment_recruitmentjobposition(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
entity INTEGER DEFAULT 1 NOT NULL,
label varchar(255) NOT NULL,
qty integer DEFAULT 1 NOT NULL,
fk_soc integer,
fk_project integer,
fk_user_recruiter integer,
fk_user_supervisor integer,
fk_establishment integer,
date_planned date,
remuneration_suggested varchar(255),
description text,
note_public text,
note_private text,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
last_main_doc varchar(255),
import_key varchar(14),
model_pdf varchar(255),
status smallint NOT NULL
) ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentjobposition ADD INDEX idx_recruitment_recruitmentjobposition_rowid (rowid);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD INDEX idx_recruitment_recruitmentjobposition_ref (ref);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD INDEX idx_recruitment_recruitmentjobposition_fk_soc (fk_soc);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD INDEX idx_recruitment_recruitmentjobposition_fk_project (fk_project);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD CONSTRAINT llx_recruitment_recruitmentjobposition_fk_user_recruiter FOREIGN KEY (fk_user_recruiter) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD CONSTRAINT llx_recruitment_recruitmentjobposition_fk_user_supervisor FOREIGN KEY (fk_user_supervisor) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD CONSTRAINT llx_recruitment_recruitmentjobposition_fk_establishment FOREIGN KEY (fk_establishment) REFERENCES llx_establishment(rowid);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD CONSTRAINT llx_recruitment_recruitmentjobposition_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD INDEX idx_recruitment_recruitmentjobposition_status (status);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN email_recruiter varchar(255);
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN entity INTEGER DEFAULT 1 NOT NULL;
ALTER TABLE llx_recruitment_recruitmentjobposition ADD COLUMN remuneration_suggested varchar(255);
create table llx_recruitment_recruitmentjobposition_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentjobposition_extrafields ADD INDEX idx_recruitmentjobposition_fk_object(fk_object);
CREATE TABLE llx_recruitment_recruitmentcandidature(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer NOT NULL DEFAULT 1,
fk_recruitmentjobposition INTEGER NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
description text,
note_public text,
note_private text,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14),
model_pdf varchar(255),
status smallint NOT NULL,
firstname varchar(128),
lastname varchar(128),
email varchar(255),
phone varchar(64),
date_birth date,
remuneration_requested integer,
remuneration_proposed integer,
email_msgid varchar(255),
fk_recruitment_origin INTEGER NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN entity integer NOT NULL DEFAULT 1;
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN email_msgid varchar(255);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN fk_recruitment_origin INTEGER NULL;
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN date_birth date;
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_rowid (rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_ref (ref);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD CONSTRAINT llx_recruitment_recruitmentcandidature_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD INDEX idx_recruitment_recruitmentcandidature_status (status);
create table llx_recruitment_recruitmentcandidature_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentcandidature_extrafields ADD INDEX idx_recruitmentcandidature_fk_object(fk_object);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid);
ALTER TABLE llx_product_attribute ADD COLUMN ref_ext VARCHAR(255) after ref;
ALTER TABLE llx_product_attribute_combination ADD COLUMN variation_ref_ext varchar(255) AFTER variation_weight;
CREATE TABLE llx_product_attribute_combination_price_level
(
rowid INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
fk_product_attribute_combination INTEGER DEFAULT 1 NOT NULL,
fk_price_level INTEGER DEFAULT 1 NOT NULL,
variation_price DOUBLE(24,8) NOT NULL,
variation_price_percentage INTEGER NULL
)ENGINE=innodb;
ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE( fk_product_attribute_combination, fk_price_level);
-- Add dictionary for prospect level and action commercial on contacts (Using this is not recommanded)
create table llx_c_prospectcontactlevel
(
code varchar(12) PRIMARY KEY,
label varchar(30),
sortorder smallint,
active smallint DEFAULT 1 NOT NULL,
module varchar(32) NULL
) ENGINE=innodb;
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_NONE', 'None', 1);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3);
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4);
create table llx_c_stcommcontact
(
id integer PRIMARY KEY,
code varchar(12) NOT NULL,
libelle varchar(30),
picto varchar(128),
active tinyint default 1 NOT NULL
)ENGINE=innodb;
ALTER TABLE llx_c_stcommcontact ADD UNIQUE INDEX uk_c_stcommcontact(code);
insert into llx_c_stcommcontact (id,code,libelle) values (-1, 'ST_NO', 'Do not contact');
insert into llx_c_stcommcontact (id,code,libelle) values ( 0, 'ST_NEVER', 'Never contacted');
insert into llx_c_stcommcontact (id,code,libelle) values ( 1, 'ST_TODO', 'To contact');
insert into llx_c_stcommcontact (id,code,libelle) values ( 2, 'ST_PEND', 'Contact in progress');
insert into llx_c_stcommcontact (id,code,libelle) values ( 3, 'ST_DONE', 'Contacted');
ALTER TABLE llx_socpeople ADD COLUMN fk_prospectcontactlevel varchar(12) AFTER priv;
ALTER TABLE llx_socpeople ADD COLUMN fk_stcommcontact integer DEFAULT 0 NOT NULL AFTER fk_prospectcontactlevel;
create table llx_c_recruitment_origin
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
code varchar(32) NOT NULL,
label varchar(64) NOT NULL,
active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb;
ALTER TABLE llx_recruitment_recruitmentcandidature ADD UNIQUE INDEX uk_recruitmentcandidature_email_msgid(email_msgid);
ALTER TABLE llx_product MODIFY COLUMN seuil_stock_alerte float;
ALTER TABLE llx_product MODIFY COLUMN desiredstock float;
ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN seuil_stock_alerte float;
ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN desiredstock float;
ALTER TABLE llx_product ADD COLUMN fk_state integer DEFAULT NULL;
ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255);
ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255);
ALTER TABLE llx_actioncomm ADD COLUMN reply_to varchar(255);
ALTER TABLE llx_paiement ADD pos_change DOUBLE(24,8) DEFAULT 0 AFTER fk_export_compta;
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52);
ALTER TABLE llx_opensurvey_sondage CHANGE COLUMN tms tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_ecm_directories CHANGE COLUMN date_m tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_ecm_files CHANGE COLUMN date_m tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,<br><br>\n\n__(YourCandidatureAnswer)__<br>\n<br><br>\n__(Sincerely)__<br>__USER_SIGNATURE__',null, 0);
ALTER TABLE llx_c_action_trigger MODIFY COLUMN code varchar(64) NOT NULL;
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516);
ALTER TABLE llx_actioncomm_reminder ADD COLUMN entity integer NOT NULL DEFAULT 1;
ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_actioncomm integer NOT NULL;
ALTER TABLE llx_actioncomm_reminder ADD COLUMN fk_email_template integer;
ALTER TABLE llx_actioncomm_reminder ADD COLUMN lasterror varchar(128) NULL;
ALTER TABLE llx_actioncomm_reminder DROP INDEX uk_actioncomm_reminder_unique;
ALTER TABLE llx_actioncomm_reminder ADD UNIQUE uk_actioncomm_reminder_unique (fk_user, typeremind, offsetvalue, offsetunit, fk_actioncomm);
ALTER TABLE llx_actioncomm_reminder ADD INDEX idx_actioncomm_reminder_status (status);
ALTER TABLE llx_inventorydet ADD UNIQUE uk_inventorydet(fk_inventory, fk_warehouse, fk_product, batch);
ALTER TABLE llx_commandedet ADD COLUMN ref_ext varchar(255) AFTER label;
ALTER TABLE llx_facturedet ADD COLUMN ref_ext varchar(255) AFTER multicurrency_total_ttc;
ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL;
ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL;
ALTER TABLE llx_c_ticket_severity CHANGE color color VARCHAR(10) NULL;
ALTER TABLE llx_expensereport ADD COLUMN fk_user_creat integer NULL;
ALTER TABLE llx_expensereport_ik ADD COLUMN ikoffset double DEFAULT 0 NOT NULL;
ALTER TABLE llx_paiement ADD COLUMN ref_ext varchar(255) AFTER ref;
ALTER TABLE llx_bank ADD COLUMN origin_id integer;
ALTER TABLE llx_bank ADD COLUMN origin_type varchar(64) NULL;
ALTER TABLE llx_bank ADD COLUMN import_key varchar(14);
ALTER TABLE llx_menu MODIFY COLUMN enabled text;
CREATE TABLE llx_ecm_files_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_ecm_files_extrafields ADD INDEX idx_ecm_files_extrafields (fk_object);
ALTER TABLE llx_ecm_files ADD COLUMN note_private text AFTER fk_user_m;
ALTER TABLE llx_ecm_files ADD COLUMN note_public text AFTER note_private;
CREATE TABLE llx_ecm_directories_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_ecm_directories_extrafields ADD INDEX idx_ecm_directories_extrafields (fk_object);
ALTER TABLE llx_ecm_directories ADD COLUMN note_private text AFTER fk_user_m;
ALTER TABLE llx_ecm_directories ADD COLUMN note_public text AFTER note_private;
ALTER TABLE llx_website_page ADD COLUMN allowed_in_frames integer DEFAULT 0;
ALTER TABLE llx_website_page ADD COLUMN object_type varchar(255);
ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255);
DELETE FROM llx_const WHERE name in ('MAIN_INCLUDE_ZERO_VAT_IN_REPORTS');
UPDATE llx_projet_task_time SET tms = null WHERE tms = 0;
ALTER TABLE llx_projet_task_time MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime;
DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous');
DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous';
UPDATE llx_rights_def set perms = 'readall' WHERE perms = 'read_all' and module = 'holiday';
CREATE TABLE llx_c_product_nature (
rowid integer AUTO_INCREMENT PRIMARY KEY,
code tinyint NOT NULL,
label varchar(100),
active tinyint DEFAULT 1 NOT NULL
) ENGINE=innodb;
ALTER TABLE llx_c_product_nature ADD UNIQUE INDEX uk_c_product_nature(code, active);
INSERT INTO llx_c_product_nature (code, label, active) VALUES (0, 'RowMaterial', 1);
INSERT INTO llx_c_product_nature (code, label, active) VALUES (1, 'Finished', 1);
ALTER TABLE llx_product MODIFY COLUMN finished tinyint DEFAULT NULL;
ALTER TABLE llx_product ADD CONSTRAINT fk_product_finished FOREIGN KEY (finished) REFERENCES llx_c_product_nature (code);
<<<<<<< HEAD
ALTER TABLE llx_product_customer_price ADD COLUMN ref_customer varchar(30);
ALTER TABLE llx_product_customer_price_log ADD COLUMN ref_customer varchar(30);
=======
>>>>>>> a93227ac2f04c80c76b517215d1d422168607fb1
-- MIGRATION TO DO AFTER RENAMING AN OBJECT
-- drop constraint
ALTER TABLE llx_livraison DROP FOREIGN KEY fk_livraison_fk_soc;
ALTER TABLE llx_livraison DROP FOREIGN KEY fk_livraison_fk_user_author;
ALTER TABLE llx_livraison DROP FOREIGN KEY fk_livraison_fk_user_valid;
-- rename Table
ALTER TABLE llx_livraison RENAME TO llx_delivery;
ALTER TABLE llx_livraison_extrafields RENAME TO llx_delivery_extrafields;
ALTER TABLE llx_livraisondet RENAME TO llx_deliverydet;
ALTER TABLE llx_livraisondet_extrafields RENAME TO llx_deliverydet_extrafields;
-- rename index
ALTER TABLE llx_delivery DROP INDEX idx_livraison_uk_ref;
ALTER TABLE llx_delivery ADD UNIQUE INDEX idx_delivery_uk_ref (ref, entity);
ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_soc;
ALTER TABLE llx_delivery ADD INDEX idx_delivery_fk_soc (fk_soc);
ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_user_author;
ALTER TABLE llx_delivery ADD INDEX idx_delivery_fk_user_author (fk_user_author);
ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_user_valid;
ALTER TABLE llx_delivery ADD INDEX idx_delivery_fk_user_valid (fk_user_valid);
-- drop constraint
ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_soc;
ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_author;
ALTER TABLE llx_delivery DROP FOREIGN KEY fk_livraison_fk_user_valid;
-- add constraint
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);
ALTER TABLE llx_deliverydet DROP FOREIGN KEY fk_livraisondet_fk_livraison;
ALTER TABLE llx_deliverydet DROP INDEX idx_livraisondet_fk_expedition;
ALTER TABLE llx_deliverydet CHANGE COLUMN fk_livraison fk_delivery integer;
ALTER TABLE llx_deliverydet ADD INDEX idx_deliverydet_fk_delivery (fk_delivery);
ALTER TABLE llx_deliverydet ADD CONSTRAINT fk_deliverydet_fk_delivery FOREIGN KEY (fk_delivery) REFERENCES llx_delivery (rowid);
UPDATE llx_extrafields SET elementtype = 'delivery' WHERE elementtype = 'livraison';
UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE elementtype = 'livraisondet';
-- update llx_ecm_files
UPDATE llx_ecm_files SET src_object_type = 'delivery' WHERE src_object_type = 'livraison';
-- update llx_links
UPDATE llx_links SET objecttype = 'delivery' WHERE objecttype = 'livraison';
-- update llx_document_model
UPDATE llx_document_model SET type = 'delivery' WHERE type = 'livraison';
-- update llx_object_lang
UPDATE llx_object_lang SET type_object = 'delivery' WHERE type_object = 'livraison';
-- update llx_c_type_contact
UPDATE llx_c_type_contact SET element = 'delivery' WHERE element = 'livraison';
-- update llx_c_email_template
UPDATE llx_c_email_template SET type_template = 'delivery' WHERE type_template = 'livraison';
-- update llx_element_element
UPDATE llx_element_element SET sourcetype = 'delivery' WHERE sourcetype = 'livraison';
UPDATE llx_element_element SET targettype = 'delivery' WHERE targettype = 'livraison';
-- update llx_actioncomm
UPDATE llx_actioncomm SET element_type = 'delivery' WHERE element_type = 'livraison';
-- update llx_const
UPDATE llx_const set name = 'DELIVERY_ADDON_NUMBER' WHERE name = 'LIVRAISON_ADDON_NUMBER';
UPDATE llx_const set value = 'mod_delivery_jade' WHERE value = 'mod_livraison_jade' AND name = 'DELIVERY_ADDON_NUMBER';
UPDATE llx_const set value = 'mod_delivery_saphir' WHERE value = 'mod_livraison_saphir' AND name = 'DELIVERY_ADDON_NUMBER';
-- update llx_rights_def
UPDATE llx_rights_def set perms = 'delivery' WHERE perms = 'livraison' and module = 'expedition';
UPDATE llx_rights_def set perms = 'delivery_advance' WHERE perms = 'livraison_advance' and module = 'expedition';
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_commande (fk_commande);
ALTER TABLE llx_commande_fournisseurdet ADD INDEX idx_commande_fournisseurdet_fk_product (fk_product);
CREATE TABLE llx_zapier_hook(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL,
url varchar(255),
event varchar(255),
module varchar(128),
action varchar(128),
status integer,
date_creation datetime NOT NULL,
fk_user integer NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
import_key varchar(14)
) ENGINE=innodb;
CREATE TABLE llx_session(
session_id varchar(50) PRIMARY KEY,
session_variable text,
last_accessed datetime NOT NULL,
fk_user integer NOT NULL,
remote_ip varchar(64) NULL,
user_agent varchar(128) NULL
) ENGINE=innodb;
INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES(1, 'github', 'Github', 'https://github.com/{socialid}', 'fa-github', 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_funnel_of_prospection.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_funnel_of_prospection.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_customers_outstanding_bill_reached.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_customers_outstanding_bill_reached.php' AND entity = 1);
-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_scheduled_jobs.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_scheduled_jobs.php' AND entity = 1);
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64);
ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL;

View File

@ -98,3 +98,5 @@ ALTER TABLE llx_propal ADD CONSTRAINT llx_propal_fk_warehouse FOREIGN KEY (fk_wa
ALTER TABLE llx_propal ADD INDEX idx_propal_fk_warehouse(fk_warehouse);
ALTER TABLE llx_product_customer_price ADD COLUMN ref_customer varchar(30);
ALTER TABLE llx_product_customer_price_log ADD COLUMN ref_customer varchar(30);

View File

@ -27,7 +27,8 @@ create table llx_product_customer_price
datec datetime,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_product integer NOT NULL,
fk_soc integer NOT NULL,
fk_soc integer NOT NULL,
ref_customer varchar(30),
price double(24,8) DEFAULT 0,
price_ttc double(24,8) DEFAULT 0,
price_min double(24,8) DEFAULT 0,

View File

@ -26,7 +26,8 @@ create table llx_product_customer_price_log
entity integer DEFAULT 1 NOT NULL, -- multi company id
datec datetime,
fk_product integer NOT NULL,
fk_soc integer DEFAULT 0 NOT NULL,
fk_soc integer DEFAULT 0 NOT NULL,
ref_customer varchar(30),
price double(24,8) DEFAULT 0,
price_ttc double(24,8) DEFAULT 0,
price_min double(24,8) DEFAULT 0,

View File

@ -655,6 +655,7 @@ SupplierPreview=Vendor preview
ShowCustomerPreview=Show customer preview
ShowSupplierPreview=Show vendor preview
RefCustomer=Ref. customer
InternalRef=Internal ref.
Currency=Currency
InfoAdmin=Information for administrators
Undo=Undo

View File

@ -56,6 +56,11 @@ class Productcustomerprice extends CommonObject
*/
public $fk_soc;
/**
* @var string Customer reference
*/
public $ref_customer;
public $price;
public $price_ttc;
public $price_min;
@ -108,6 +113,8 @@ class Productcustomerprice extends CommonObject
$this->fk_product = trim($this->fk_product);
if (isset($this->fk_soc))
$this->fk_soc = trim($this->fk_soc);
if (isset($this->ref_customer))
$this->ref_customer = trim($this->ref_customer);
if (isset($this->price))
$this->price = trim($this->price);
if (isset($this->price_ttc))
@ -171,6 +178,7 @@ class Productcustomerprice extends CommonObject
$sql .= "datec,";
$sql .= "fk_product,";
$sql .= "fk_soc,";
$sql .= 'ref_customer,';
$sql .= "price,";
$sql .= "price_ttc,";
$sql .= "price_min,";
@ -190,6 +198,7 @@ class Productcustomerprice extends CommonObject
$sql .= " '".$this->db->idate(dol_now())."',";
$sql .= " ".(!isset($this->fk_product) ? 'NULL' : "'".$this->db->escape($this->fk_product)."'").",";
$sql .= " ".(!isset($this->fk_soc) ? 'NULL' : "'".$this->db->escape($this->fk_soc)."'").",";
$sql .= " ".(!isset($this->ref_customer) ? 'NULL' : "'".$this->db->escape($this->ref_customer)."'").",";
$sql .= " ".(empty($this->price) ? '0' : "'".$this->db->escape($this->price)."'").",";
$sql .= " ".(empty($this->price_ttc) ? '0' : "'".$this->db->escape($this->price_ttc)."'").",";
$sql .= " ".(empty($this->price_min) ? '0' : "'".$this->db->escape($this->price_min)."'").",";
@ -264,6 +273,7 @@ class Productcustomerprice extends CommonObject
$sql .= " t.tms,";
$sql .= " t.fk_product,";
$sql .= " t.fk_soc,";
$sql .= " t.ref_customer,";
$sql .= " t.price,";
$sql .= " t.price_ttc,";
$sql .= " t.price_min,";
@ -293,6 +303,7 @@ class Productcustomerprice extends CommonObject
$this->tms = $this->db->jdate($obj->tms);
$this->fk_product = $obj->fk_product;
$this->fk_soc = $obj->fk_soc;
$this->ref_customer = $obj->ref_customer;
$this->price = $obj->price;
$this->price_ttc = $obj->price_ttc;
$this->price_min = $obj->price_min;
@ -341,6 +352,7 @@ class Productcustomerprice extends CommonObject
$sql .= " t.tms,";
$sql .= " t.fk_product,";
$sql .= " t.fk_soc,";
$sql .= " t.ref_customer,";
$sql .= " t.price,";
$sql .= " t.price_ttc,";
$sql .= " t.price_min,";
@ -400,6 +412,7 @@ class Productcustomerprice extends CommonObject
$line->tms = $this->db->jdate($obj->tms);
$line->fk_product = $obj->fk_product;
$line->fk_soc = $obj->fk_soc;
$line->ref_customer = $obj->ref_customer;
$line->price = $obj->price;
$line->price_ttc = $obj->price_ttc;
$line->price_min = $obj->price_min;
@ -454,6 +467,7 @@ class Productcustomerprice extends CommonObject
$sql .= " t.datec,";
$sql .= " t.fk_product,";
$sql .= " t.fk_soc,";
$sql .= " t.ref_customer,";
$sql .= " t.price,";
$sql .= " t.price_ttc,";
$sql .= " t.price_min,";
@ -509,6 +523,7 @@ class Productcustomerprice extends CommonObject
$line->tms = $this->db->jdate($obj->tms);
$line->fk_product = $obj->fk_product;
$line->fk_soc = $obj->fk_soc;
$line->ref_customer = $obj->ref_customer;
$line->price = $obj->price;
$line->price_ttc = $obj->price_ttc;
$line->price_min = $obj->price_min;
@ -557,6 +572,8 @@ class Productcustomerprice extends CommonObject
$this->fk_product = trim($this->fk_product);
if (isset($this->fk_soc))
$this->fk_soc = trim($this->fk_soc);
if (isset($this->ref_customer))
$this->ref_customer = trim($this->ref_customer);
if (isset($this->price))
$this->price = trim($this->price);
if (isset($this->price_ttc))
@ -622,6 +639,7 @@ class Productcustomerprice extends CommonObject
$sql .= "datec,";
$sql .= "fk_product,";
$sql .= "fk_soc,";
$sql .= "ref_customer,";
$sql .= "price,";
$sql .= "price_ttc,";
$sql .= "price_min,";
@ -644,6 +662,7 @@ class Productcustomerprice extends CommonObject
$sql .= " t.datec,";
$sql .= " t.fk_product,";
$sql .= " t.fk_soc,";
$sql .= " t.ref_customer,";
$sql .= " t.price,";
$sql .= " t.price_ttc,";
$sql .= " t.price_min,";
@ -678,6 +697,7 @@ class Productcustomerprice extends CommonObject
$sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").",";
$sql .= " fk_soc=".(isset($this->fk_soc) ? $this->fk_soc : "null").",";
$sql .= " ref_customer=".(isset($this->ref_customer) ? "'" . $this->db->escape($this->ref_customer) . "'" : "null").",";
$sql .= " price=".(isset($this->price) ? $this->price : "null").",";
$sql .= " price_ttc=".(isset($this->price_ttc) ? $this->price_ttc : "null").",";
$sql .= " price_min=".(isset($this->price_min) ? $this->price_min : "null").",";
@ -797,6 +817,7 @@ class Productcustomerprice extends CommonObject
// If line do not exits then create it
$prodsocpricenew = new Productcustomerprice($this->db);
$prodsocpricenew->fk_soc = $obj->rowid;
$prodsocpricenew->ref_customer = $obj->ref_customer;
$prodsocpricenew->fk_product = $this->fk_product;
$prodsocpricenew->price = $this->price;
$prodsocpricenew->price_min = $this->price_min;
@ -938,6 +959,7 @@ class Productcustomerprice extends CommonObject
$this->tms = '';
$this->fk_product = '';
$this->fk_soc = '';
$this->ref_customer = '';
$this->price = '';
$this->price_ttc = '';
$this->price_min = '';
@ -976,6 +998,11 @@ class PriceByCustomerLine
*/
public $fk_product;
/**
* @var string Customer reference
*/
public $ref_customer;
/**
* @var int Thirdparty ID
*/

View File

@ -507,6 +507,7 @@ if (empty($reshook))
// add price by customer
$prodcustprice->fk_soc = GETPOST('socid', 'int');
$prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
$prodcustprice->fk_product = $object->id;
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
@ -608,6 +609,7 @@ if (empty($reshook))
$prodcustprice->fetch(GETPOST('lineid', 'int'));
// update price by customer
$prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
@ -1667,6 +1669,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '</td>';
print '</tr>';
// Ref. Customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td>';
print '<td><input name="ref_customer" size="12"></td></tr>';
// VAT
print '<tr><td class="fieldrequired">'.$langs->trans("DefaultTaxRate").'</td><td>';
print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1);
@ -1753,6 +1759,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print "<td colspan='2'>".$staticsoc->getNomUrl(1)."</td>";
print '</tr>';
// Ref. Customer
print '<tr><td>' . $langs->trans('RefCustomer') . '</td>';
print '<td><input name="ref_customer" size="12" value="' . dol_escape_htmltag($prodcustprice->ref_customer) . '"></td></tr>';
// VAT
print '<tr><td>'.$langs->trans("DefaultTaxRate").'</td><td colspan="2">';
print $form->load_tva("tva_tx", $prodcustprice->default_vat_code ? $prodcustprice->tva_tx.' ('.$prodcustprice->default_vat_code.')' : $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1);
@ -1859,6 +1869,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td>'.$langs->trans('RefCustomer').'</td>';
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
print '<td class="center">'.$langs->trans("PriceBase").'</td>';
print '<td class="right">'.$langs->trans("DefaultTaxRate").'</td>';
@ -1906,6 +1917,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '<tr class="oddeven">';
print "<td>".$staticsoc->getNomUrl(1)."</td>";
print '<td>' . $line->ref_customer . '</td>';
print "<td>".dol_print_date($line->datec, "dayhour")."</td>";
print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";
print '<td class="right">';
@ -1974,7 +1986,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
if (count($prodcustprice->lines) > 0 || $search_soc)
{
$colspan = 8;
$colspan = 9;
//if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") $colspan++;
print '<tr class="liste_titre">';
@ -1990,6 +2002,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td>' . $langs->trans('RefCustomer') . '</td>';
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
print '<td class="center">'.$langs->trans("PriceBase").'</td>';
print '<td class="right">'.$langs->trans("DefaultTaxRate").'</td>';
@ -2028,8 +2041,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
$total_ttc = $resultarray[2];
print '<tr class="oddeven">';
print "<td>".$langs->trans("Default")."</td>";
print "<td></td>";
print '<td colspan="3">' . $langs->trans('Default') . '</td>';
print '<td class="center">'.$langs->trans($object->price_base_type)."</td>";
print '<td class="right">';
@ -2107,6 +2119,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
print '<tr class="oddeven">';
print "<td>".$staticsoc->getNomUrl(1)."</td>";
print '<td>' . $line->ref_customer . '</td>';
print "<td>".dol_print_date($line->datec, "dayhour")."</td>";
print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";

View File

@ -88,6 +88,7 @@ if (empty($reshook))
// add price by customer
$prodcustprice->fk_soc = $socid;
$prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
$prodcustprice->fk_product = GETPOST('prodid', 'int');
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
@ -162,6 +163,7 @@ if (empty($reshook))
$update_child_soc = GETPOST('updatechildprice');
// update price by customer
$prodcustprice->ref_customer = GETPOST('ref_customer', 'alpha');
$prodcustprice->price = price2num(GETPOST("price"), 'MU');
$prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU');
$prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha');
@ -298,6 +300,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '</td>';
print '</tr>';
// Ref. Customer
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<td><input name="ref_customer" size="12"></td></tr>';
// VAT
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, '', false, 1);
@ -376,6 +382,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print "<td>".$staticprod->getNomUrl(1)."</td>";
print '</tr>';
// Ref. Customer
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<td><input name="ref_customer" size="12" value="' . dol_escape_htmltag($prodcustprice->ref_customer) . '"></td></tr>';
// VAT
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $staticprod->id, $prodcustprice->recuperableonly);
@ -465,6 +475,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Product").'</td>';
print '<td>'.$langs->trans('RefCustomer').'</td>';
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
print '<td class="center">'.$langs->trans("PriceBase").'</td>';
print '<td class="right">'.$langs->trans("VAT").'</td>';
@ -482,6 +493,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$staticprod->fetch($line->fk_product);
print "<td>".$staticprod->getNomUrl(1)."</td>";
print '<td>'.$line->ref_customer.'</td>';
print "<td>".dol_print_date($line->datec, "dayhour")."</td>";
print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";
@ -551,6 +563,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td>';
print '<td>'.$langs->trans("Product").'</td>';
print '<td>'.$langs->trans('RefCustomer').'</td>';
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
print '<td class="center">'.$langs->trans("PriceBase").'</td>';
print '<td class="right">'.$langs->trans("VAT").'</td>';
@ -567,7 +580,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_prod" value="'.$search_prod.'" size="20"></td>';
print '<td class="liste_titre" ><input type="text" class="flat" name="search_label" value="'.$search_label.'" size="20"></td>';
print '<td class="liste_titre" colspan="3">&nbsp;</td>';
print '<td class="liste_titre" colspan="4">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" name="search_price" value="'.$search_price.'" size="10"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" name="search_price_ttc" value="'.$search_price_ttc.'" size="10"></td>';
print '<td class="liste_titre" colspan="3">&nbsp;</td>';
@ -590,6 +603,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print "<td>".$staticprod->getNomUrl(1)."</td>";
print "<td>".$staticprod->label."</td>";
print '<td>'.$line->ref_customer.'</td>';
print "<td>".dol_print_date($line->datec, "dayhour")."</td>";
print '<td class="center">'.$langs->trans($line->price_base_type)."</td>";
@ -627,7 +641,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print "</tr>\n";
}
} else {
$colspan = 9;
$colspan = 10;
if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan += 1;
print '<tr class="oddeven"><td colspan="'.$colspan.'">'.$langs->trans('None').'</td></tr>';
}