From c7e1528594040fc6b615d5e5476c176d3cd2f9eb Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 9 Feb 2015 15:53:19 +0100 Subject: [PATCH 01/17] =?UTF-8?q?[CORE]=20initialisation=20de=20l'int?= =?UTF-8?q?=C3=A9gration=20du=20module=20incoterm=20au=20corp=20de=20dolib?= =?UTF-8?q?arr=20(#incoterm).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/incoterm.php | 89 +++++++++++ htdocs/core/modules/modIncoterm.class.php | 142 ++++++++++++++++++ .../install/mysql/migration/3.7.0-3.8.0.sql | 64 ++++++++ htdocs/langs/fr_FR/incoterm.lang | 6 + 4 files changed, 301 insertions(+) create mode 100644 htdocs/admin/incoterm.php create mode 100644 htdocs/core/modules/modIncoterm.class.php create mode 100644 htdocs/langs/fr_FR/incoterm.lang diff --git a/htdocs/admin/incoterm.php b/htdocs/admin/incoterm.php new file mode 100644 index 00000000000..9daa48b952f --- /dev/null +++ b/htdocs/admin/incoterm.php @@ -0,0 +1,89 @@ +load("admin"); +$langs->load("incoterm"); +$langs->load("errors"); + +if (! $user->admin) accessforbidden(); + +$action = GETPOST('action','alpha'); +$error = false; + +/* + * Actions + */ + if ($action == 'switch_incoterm') + { + $value = dolibarr_get_const($db, 'INCOTERM_ACTIVATE'); + + if (!empty($value)) $res = dolibarr_set_const($db, 'INCOTERM_ACTIVATE', 0); + else $res = dolibarr_set_const($db, 'INCOTERM_ACTIVATE', 1); + + + if (!$res) $error++; + + if (!$error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } + } + +/* + * View + */ +$form=new Form($db); + +llxHeader("",""); + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("IncotermSetup"),$linkback,'setup'); +print '
'; + + +$h = 0; + +$head[$h][0] = DOL_URL_ROOT."/admin/incoterm.php"; +$head[$h][1] = $langs->trans("Setup"); +$h++; + +dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; + +print '
'.$langs->trans("IncotermSetupTitle1").''.$langs->trans("IncotermSetupTitle2").'
'.$langs->trans('IncotermFunctionDesc').''; + +if (!empty($conf->global->INCOTERM_ACTIVATE)) { + print img_picto($langs->trans("Enabled"),'switch_on'); +} else { + print img_picto($langs->trans("Disabled"),'switch_off'); +} + +print '
'; + + + +llxFooter(); +$db->close(); + + + diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php new file mode 100644 index 00000000000..fbdc6b55d31 --- /dev/null +++ b/htdocs/core/modules/modIncoterm.class.php @@ -0,0 +1,142 @@ + + * Copyright (C) 2004-2012 Laurent Destailleur + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \defgroup mymodule Module MyModule + * \brief Example of a module descriptor. + * Such a file must be copied into htdocs/mymodule/core/modules directory. + * \file htdocs/mymodule/core/modules/modMyModule.class.php + * \ingroup mymodule + * \brief Description and activation file for module MyModule + */ +include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; + + +/** + * Description and activation class for module MyModule + */ +class modIncoterm extends DolibarrModules +{ + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + global $langs,$conf; + + $this->db = $db; + + // Id for module (must be unique). + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). + $this->numero = 210009; + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'incoterm'; + + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' + $this->family = "products"; + $this->name = preg_replace('/^mod/i','',get_class($this)); + $this->description = "Gestion des incoterm"; + $this->version = 'dolibarr'; + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) + $this->special = 0; + $this->picto='generic'; + + $this->module_parts = array(); + $this->dirs = array(); + + $this->config_page_url = array('incoterm.php'); + + // Dependencies + $this->depends = array(); // List of modules id that must be enabled if this module is enabled + $this->requiredby = array(); // List of modules id to disable if this one is disabled + $this->phpmin = array(5,0); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module + $this->langfiles = array("incoterm"); + + $this->const = array( + array('INCOTERM_ACTIVATE', 'smallint', 0, 'Description de INCOTERM_ACTIVATE') + ); + + $this->tabs = array(); + + // Dictionnaries + if (! isset($conf->incoterm->enabled)){ + @$conf->incoterm->enabled=0; + } + $this->dictionnaries=array( + 'langs'=>'incoterm', + 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor + 'tablib'=>array("Incoterms"), // Label of tables + 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields + 'tabsqlsort'=>array("rowid ASC"), // Sort order + 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionnary) + 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) + 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) + 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') + 'tabcond'=>array($conf->global->INCOTERM_ACTIVATE,$conf->incoterm->enabled) + ); + + $this->boxes = array(); // List of boxes + $r=0; + + // Permissions + $this->rights = array(); // Permission array used by this module + $r=0; + + // Main menu entries + $this->menus = array(); // List of menus to add + $r=0; + } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function init($options='') + { + $sql = array(); + + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + function remove($options='') + { + $sql = array(); + + return $this->_remove($sql, $options); + } +} + +?> diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 60d0e0660da..360c99af189 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -96,3 +96,67 @@ create table llx_contratdet_extrafields )ENGINE=innodb; ALTER TABLE llx_contratdet_extrafields ADD INDEX idx_contratdet_extrafields (fk_object); + + +-- +-- Module incoterm +-- +ALTER TABLE llx_facture ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_commande ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_propal ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_expedition ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_livraison ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_societe ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_commande_fournisseur ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +CREATE TABLE IF NOT EXISTS llx_c_incoterms ( + rowid integer NOT NULL AUTO_INCREMENT, + code varchar(3) NOT NULL, + libelle varchar(255) NOT NULL, + active boolean NOT NULL, + PRIMARY KEY (rowid) +) ENGINE=InnoDB; + +-- +-- Content of llx_c_incoterms table +-- + +INSERT INTO llx_c_incoterms (rowid, code, libelle, active) VALUES +(1, 'EXW', 'Ex Works, au départ non chargé, non dédouané sortie d''usine (uniquement adapté aux flux domestiques, nationaux)', 1), +(2, 'FCA', 'Free Carrier, marchandises dédouanées et chargées dans le pays de départ, chez le vendeur ou chez le commissionnaire de transport de l''acheteur', 1), +(3, 'FAS', 'Free Alongside Ship, sur le quai du port de départ', 1), +(4, 'FOB', 'Free On Board, chargé sur le bateau, les frais de chargement dans celui-ci étant fonction du liner term indiqué par la compagnie maritime (à la charge du vendeur)', 1), +(5, 'CFR', 'Cost and Freight, chargé dans le bateau, livraison au port de départ, frais payés jusqu''au port d''arrivée, sans assurance pour le transport, non déchargé du navire à destination (les frais de déchargement sont inclus ou non au port d''arrivée)', 1), +(6, 'CIF', 'Cost, Insurance and Freight, chargé sur le bateau, frais jusqu''au port d''arrivée, avec l''assurance marchandise transportée souscrite par le vendeur pour le compte de l''acheteur', 1), +(7, 'CPT', 'Carriage Paid To, livraison au premier transporteur, frais jusqu''au déchargement du mode de transport, sans assurance pour le transport', 1), +(8, 'CIP', 'Carriage and Insurance Paid to, idem CPT, avec assurance marchandise transportée souscrite par le vendeur pour le compte de l''acheteur', 1), +(9, 'DAT', 'Delivered At Terminal, marchandises (déchargées) livrées sur quai, dans un terminal maritime, fluvial, aérien, routier ou ferroviaire désigné (dédouanement import, et post-acheminement payés par l''acheteur)', 1), +(10, 'DAP', 'Delivered At Place, marchandises (non déchargées) mises à disposition de l''acheteur dans le pays d''importation au lieu précisé dans le contrat (déchargement, dédouanement import payé par l''acheteur)', 1), +(11, 'DDP', 'Delivered Duty Paid, marchandises (non déchargées) livrées à destination finale, dédouanement import et taxes à la charge du vendeur ; l''acheteur prend en charge uniquement le déchargement (si exclusion des taxes type TVA, le préciser clairement)', 1); diff --git a/htdocs/langs/fr_FR/incoterm.lang b/htdocs/langs/fr_FR/incoterm.lang new file mode 100644 index 00000000000..e18e37358bb --- /dev/null +++ b/htdocs/langs/fr_FR/incoterm.lang @@ -0,0 +1,6 @@ +Module210009Name=incoterm +Module210009Desc=Ajouts pour incoterm +IncotermSetupTitle1=Fonction +IncotermSetupTitle2=État +IncotermSetup=Configuration du module Incoterm +IncotermFunctionDesc=Activer la fonction Incoterm (Société, Proposition comercial, Commande, Facture, Expédition, Livraison, Commande fournisseur) \ No newline at end of file From 62762f82a9ab98ea8c0e0827009a1ceab6fdb733 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 9 Feb 2015 17:55:43 +0100 Subject: [PATCH 02/17] [CORE] incorporation de l'ajout / modification de l'incoterm sur un tiers (#incoterm --- htdocs/core/class/html.form.class.php | 71 ++++++++++++++++++++++++++ htdocs/societe/class/societe.class.php | 51 +++++++++++++++++- htdocs/societe/soc.php | 54 +++++++++++++++++++- 3 files changed, 173 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 21650cd62f6..90fd1c534ba 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -558,6 +558,77 @@ class Form return $out; } + /** + * Return select list of incoterms + * + * @param string $selected Id or Code of preselected incoterm + * @param string $htmlname Name of html select object + * @param string $htmloption Options html on select object + * @param string $maxlength Max length for labels (0=no limit) + * @return string HTML string with select + */ + function select_incoterms($selected='',$htmlname='incoterm_id',$htmloption='',$maxlength=0) + { + global $conf,$langs; + + $langs->load("dict"); + + $out=''; + $incotermArray=array(); + + $sql = "SELECT rowid, code"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_incoterms"; + $sql.= " WHERE active = 1"; + $sql.= " ORDER BY code ASC"; + + dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $out.= ''; + } + else + { + dol_print_error($this->db); + } + + return $out; + } + /** * Return list of types of lines (product or service) * Example: 0=product, 1=service, 9=other (for external module) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 77673b82ed3..d0cfa7e7f4d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -352,6 +352,11 @@ class Societe extends CommonObject var $array_options; + // Incoterms + var $fk_incoterms; + var $location_incoterms; + var $libelle_incoterms; //Used into tooltip + /** * To contains a clone of this when we need to save old properties of object */ @@ -424,7 +429,7 @@ class Societe extends CommonObject if ($result >= 0) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, entity, datec, fk_user_creat, canvas, status, ref_int, ref_ext, fk_stcomm, import_key)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, entity, datec, fk_user_creat, canvas, status, ref_int, ref_ext, fk_stcomm, fk_incoterms, location_incoterms ,import_key)"; $sql.= " VALUES ('".$this->db->escape($this->name)."', ".$conf->entity.", '".$this->db->idate($now)."'"; $sql.= ", ".(! empty($user->id) ? "'".$user->id."'":"null"); $sql.= ", ".(! empty($this->canvas) ? "'".$this->canvas."'":"null"); @@ -432,6 +437,8 @@ class Societe extends CommonObject $sql.= ", ".(! empty($this->ref_int) ? "'".$this->ref_int."'":"null"); $sql.= ", ".(! empty($this->ref_ext) ? "'".$this->ref_ext."'":"null"); $sql.= ", 0"; + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ", ".(! empty($this->import_key) ? "'".$this->import_key."'":"null").")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -731,6 +738,10 @@ class Societe extends CommonObject $this->webservices_url = $this->webservices_url?clean_url($this->webservices_url,0):''; $this->webservices_key = trim($this->webservices_key); + //Incoterms + $this->fk_incoterms = (int) $this->fk_incoterms; + $this->location_incoterms = trim($this->location_incoterms); + $this->db->begin(); // Check name is required and codes are ok or unique. @@ -814,6 +825,10 @@ class Societe extends CommonObject $sql .= ",webservices_url = ".(! empty($this->webservices_url)?"'".$this->db->escape($this->webservices_url)."'":"null"); $sql .= ",webservices_key = ".(! empty($this->webservices_key)?"'".$this->db->escape($this->webservices_key)."'":"null"); + //Incoterms + $sql.= ", fk_incoterms = ".$this->fk_incoterms; + $sql.= ", location_incoterms = ".(! empty($this->location_incoterms)?"'".$this->db->escape($this->location_incoterms)."'":"null"); + if ($customer) { $sql .= ", code_client = ".(! empty($this->code_client)?"'".$this->db->escape($this->code_client)."'":"null"); @@ -976,13 +991,14 @@ class Societe extends CommonObject $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj'; $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo'; - $sql .= ', s.outstanding_limit, s.import_key, s.canvas'; + $sql .= ', s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms'; $sql .= ', fj.libelle as forme_juridique'; $sql .= ', e.libelle as effectif'; $sql .= ', c.code as country_code, c.label as country'; $sql .= ', d.code_departement as state_code, d.nom as state'; $sql .= ', st.libelle as stcomm'; $sql .= ', te.code as typent_code'; + $sql .= ', i.libelle as libelle_incoterms'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as e ON s.fk_effectif = e.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; @@ -990,6 +1006,7 @@ class Societe extends CommonObject $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as fj ON s.fk_forme_juridique = fj.code'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid'; if ($rowid) $sql .= ' WHERE s.rowid = '.$rowid; if ($ref) $sql .= " WHERE s.nom = '".$this->db->escape($ref)."' AND s.entity IN (".getEntity($this->element, 1).")"; if ($ref_ext) $sql .= " WHERE s.ref_ext = '".$this->db->escape($ref_ext)."' AND s.entity IN (".getEntity($this->element, 1).")"; @@ -1118,6 +1135,11 @@ class Societe extends CommonObject $this->import_key = $obj->import_key; + //Incoterms + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + $result = 1; // Retreive all extrafield for thirdparty @@ -2067,6 +2089,31 @@ class Societe extends CommonObject $bac->fetch(0,$this->id); return $bac->getRibLabel(true); } + + /** + * Return incoterms informations + * + * @return string Bank number + */ + function display_incoterms() + { + $out = ''; + $this->incoterms_libelle = ''; + if (!empty($this->fk_incoterms)) + { + $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $result = $this->db->query($sql); + if ($result) + { + $res = $this->db->fetch_object($result); + $out .= $res->code; + } + } + + $out .= ' - '.$this->location_incoterms; + + return $out; + } /** * Return Array of RIB diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index d0d9c9cbb47..279197b27e1 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -45,6 +45,7 @@ $langs->load("commercial"); $langs->load("bills"); $langs->load("banks"); $langs->load("users"); +if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) $langs->load("incoterm"); if (! empty($conf->notification->enabled)) $langs->load("mails"); $mesg=''; $error=0; $errors=array(); @@ -191,6 +192,12 @@ if (empty($reshook)) $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); + // Incoterms + if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + { + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); + } // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -1074,7 +1081,18 @@ else $form->select_users((! empty($object->commercial_id)?$object->commercial_id:$user->id),'commercial_id',1); // Add current user by default print ''; } - + + // Incoterms + if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + { + print ''; + print ''; + print ''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : '')); + print ''; + print ''; + } + // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -1197,6 +1215,13 @@ else $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); + //Incoterms + if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + { + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha'); + } + //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); @@ -1584,6 +1609,17 @@ else print ''; } + // Incoterms + if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + { + print ''; + print ''; + print ''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : '')); + print ''; + print ''; + } + // Logo print ''; print ''; @@ -1970,6 +2006,22 @@ else print ''; } + // Incoterms + if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + { + print ''; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->societe->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print ''; + print ''; + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print ''; + } + // Other attributes $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook From 792ec17993adf231ed63969dd8d0da76567c2401 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 9 Feb 2015 17:56:06 +0100 Subject: [PATCH 03/17] [CORE] ajout de traductions ( #incoterm). --- htdocs/langs/fr_FR/incoterm.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/fr_FR/incoterm.lang b/htdocs/langs/fr_FR/incoterm.lang index e18e37358bb..9b01dcaa46e 100644 --- a/htdocs/langs/fr_FR/incoterm.lang +++ b/htdocs/langs/fr_FR/incoterm.lang @@ -1,5 +1,6 @@ Module210009Name=incoterm Module210009Desc=Ajouts pour incoterm +IncotermLabel=Incoterms IncotermSetupTitle1=Fonction IncotermSetupTitle2=État IncotermSetup=Configuration du module Incoterm From 23751c75dcb5f7054fcfbb347eaf0a23e4a432e9 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 10 Feb 2015 10:22:38 +0100 Subject: [PATCH 04/17] =?UTF-8?q?[CORE]=20fin=20de=20la=20mise=20en=20plac?= =?UTF-8?q?e=20de=20la=20gestion=20incoterms=20des=20soci=C3=A9t=C3=A9s=20?= =?UTF-8?q?(#incoterm).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/class/html.form.class.php | 28 ++++++++++++++++++++++----- htdocs/societe/soc.php | 23 ++++++++++++++++------ 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 90fd1c534ba..4580df68fe0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -567,7 +567,7 @@ class Form * @param string $maxlength Max length for labels (0=no limit) * @return string HTML string with select */ - function select_incoterms($selected='',$htmlname='incoterm_id',$htmloption='',$maxlength=0) + function select_incoterms($selected='', $location_incoterms='', $page='',$htmlname='incoterm_id',$htmloption='', $forcecombo=0, $events=array()) { global $conf,$langs; @@ -580,12 +580,25 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX."c_incoterms"; $sql.= " WHERE active = 1"; $sql.= " ORDER BY code ASC"; - + dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { - $out.= ''; + $out .= ''; + } + + $out.= ''; + + $out .= ''; + + if (!empty($page)) + { + $out .= ''; + } } else { diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 279197b27e1..5c821a2b86d 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -521,6 +521,12 @@ if (empty($reshook)) $result = $object->set_parent(GETPOST('editparentcompany','int')); } + // Set incoterm + if ($action == 'set_incoterms' && $conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + { + $object->fetch($socid); + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); + } // Actions to send emails $id=$socid; @@ -1088,8 +1094,7 @@ else print ''; print ''; print ''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : '')); - print ''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print ''; } @@ -1615,8 +1620,7 @@ else print ''; print ''; print ''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : '')); - print ''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print ''; } @@ -2013,12 +2017,19 @@ else print '
'; print $langs->trans('IncotermLabel'); print ''; - if ($user->rights->societe->creer) print ''.img_edit().''; + if ($user->rights->societe->creer) print ''.img_edit().''; else print ' '; print '
'; print ''; print ''; - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?socid='.$object->id); + } print ''; } From 1701ecfd89b4ea207d639ebb7b65d9afd181aa51 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 10 Feb 2015 10:23:38 +0100 Subject: [PATCH 05/17] =?UTF-8?q?[CORE]=20fonction=20setIncoterms=20g?= =?UTF-8?q?=C3=A9n=C3=A9rique=20pour=20mettre=20=C3=A0=20jour=20les=20vale?= =?UTF-8?q?urs=20de=20incotermsdes=20diff=C3=A9rentes=20tables=20(#incoter?= =?UTF-8?q?m).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/class/commonobject.class.php | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 79f509225f6..ad87502fe1b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2375,6 +2375,37 @@ abstract class CommonObject return 1; } } + + /** + * Define incoterms values of current object + * + * @param int $id_incoterm Id of incoterm to set or '' to remove + * @param string $location location of incoterm + * @return int <0 if KO, >0 if OK + */ + function setIncoterms($id_incoterm, $location) + { + if ($this->id && $this->table_element) + { + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql.= " SET fk_incoterms = ".($id_incoterm > 0 ? $id_incoterm : "null"); + $sql.= ", location_incoterms = '".($id_incoterm > 0 ? $this->db->escape($location) : "null")."'"; + $sql.= " WHERE rowid = " . $this->id; + dol_syslog(get_class($this).'::setIncoterms', LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + $this->fk_incoterms = $id_incoterm; + $this->location_incoterms = $location; + return 1; + } + else + { + return -1; + } + } + else return -1; + } /** From e27ff07e29ea19f2496dcb3e74e86bdfb0df6c09 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 10 Feb 2015 11:44:14 +0100 Subject: [PATCH 06/17] [CORE] retrait de la page de configuration qui est inutile (#incoterm). --- htdocs/admin/incoterm.php | 89 --------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 htdocs/admin/incoterm.php diff --git a/htdocs/admin/incoterm.php b/htdocs/admin/incoterm.php deleted file mode 100644 index 9daa48b952f..00000000000 --- a/htdocs/admin/incoterm.php +++ /dev/null @@ -1,89 +0,0 @@ -load("admin"); -$langs->load("incoterm"); -$langs->load("errors"); - -if (! $user->admin) accessforbidden(); - -$action = GETPOST('action','alpha'); -$error = false; - -/* - * Actions - */ - if ($action == 'switch_incoterm') - { - $value = dolibarr_get_const($db, 'INCOTERM_ACTIVATE'); - - if (!empty($value)) $res = dolibarr_set_const($db, 'INCOTERM_ACTIVATE', 0); - else $res = dolibarr_set_const($db, 'INCOTERM_ACTIVATE', 1); - - - if (!$res) $error++; - - if (!$error) - { - setEventMessage($langs->trans("SetupSaved")); - } - else - { - setEventMessage($langs->trans("Error"),'errors'); - } - } - -/* - * View - */ -$form=new Form($db); - -llxHeader("",""); - -$linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans("IncotermSetup"),$linkback,'setup'); -print '
'; - - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT."/admin/incoterm.php"; -$head[$h][1] = $langs->trans("Setup"); -$h++; - -dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); - -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; -print ''; - -print ''; - -print '
'.$langs->trans("IncotermSetupTitle1").''.$langs->trans("IncotermSetupTitle2").'
'.$langs->trans('IncotermFunctionDesc').''; - -if (!empty($conf->global->INCOTERM_ACTIVATE)) { - print img_picto($langs->trans("Enabled"),'switch_on'); -} else { - print img_picto($langs->trans("Disabled"),'switch_off'); -} - -print '
'; - - - -llxFooter(); -$db->close(); - - - From 791bd7e9d90d313337b527ad4effb5d08d969d49 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 10 Feb 2015 11:45:23 +0100 Subject: [PATCH 07/17] [CORE] retrait la page de configuration et des tests sur la variable d'activation du module qui est inutile (#incoterm). --- htdocs/core/modules/modIncoterm.class.php | 4 ++-- htdocs/societe/class/societe.class.php | 24 ----------------------- htdocs/societe/soc.php | 14 ++++++------- 3 files changed, 9 insertions(+), 33 deletions(-) diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php index fbdc6b55d31..1d4f869b853 100644 --- a/htdocs/core/modules/modIncoterm.class.php +++ b/htdocs/core/modules/modIncoterm.class.php @@ -64,7 +64,7 @@ class modIncoterm extends DolibarrModules $this->module_parts = array(); $this->dirs = array(); - $this->config_page_url = array('incoterm.php'); + $this->config_page_url = array(); // Dependencies $this->depends = array(); // List of modules id that must be enabled if this module is enabled @@ -93,7 +93,7 @@ class modIncoterm extends DolibarrModules 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array($conf->global->INCOTERM_ACTIVATE,$conf->incoterm->enabled) + 'tabcond'=>array($conf->incoterm->enabled) ); $this->boxes = array(); // List of boxes diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d0cfa7e7f4d..dc411af3877 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2090,30 +2090,6 @@ class Societe extends CommonObject return $bac->getRibLabel(true); } - /** - * Return incoterms informations - * - * @return string Bank number - */ - function display_incoterms() - { - $out = ''; - $this->incoterms_libelle = ''; - if (!empty($this->fk_incoterms)) - { - $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; - $result = $this->db->query($sql); - if ($result) - { - $res = $this->db->fetch_object($result); - $out .= $res->code; - } - } - - $out .= ' - '.$this->location_incoterms; - - return $out; - } /** * Return Array of RIB diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 5c821a2b86d..c9a3e796979 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -45,7 +45,7 @@ $langs->load("commercial"); $langs->load("bills"); $langs->load("banks"); $langs->load("users"); -if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) $langs->load("incoterm"); +if ($conf->incoterm->enabled) $langs->load("incoterm"); if (! empty($conf->notification->enabled)) $langs->load("mails"); $mesg=''; $error=0; $errors=array(); @@ -193,7 +193,7 @@ if (empty($reshook)) $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); // Incoterms - if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + if ($conf->incoterm->enabled) { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -522,7 +522,7 @@ if (empty($reshook)) } // Set incoterm - if ($action == 'set_incoterms' && $conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + if ($action == 'set_incoterms' && $conf->incoterm->enabled) { $object->fetch($socid); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); @@ -1089,7 +1089,7 @@ else } // Incoterms - if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + if ($conf->incoterm->enabled) { print ''; print ''; @@ -1221,7 +1221,7 @@ else $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); //Incoterms - if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + if ($conf->incoterm->enabled) { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha'); @@ -1615,7 +1615,7 @@ else } // Incoterms - if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + if ($conf->incoterm->enabled) { print ''; print ''; @@ -2011,7 +2011,7 @@ else } // Incoterms - if ($conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + if ($conf->incoterm->enabled) { print ''; print '"; + // Incoterms + if ($conf->incoterm->enabled) + { + print ''; + print ''; + print ''; + } + // Project if (! empty($conf->projet->enabled) && $socid > 0) { @@ -1948,6 +1969,29 @@ if ($action == 'create') print ''; } + // Incoterms + if ($conf->incoterm->enabled) + { + print ''; + print ''; + } + // Other attributes $cols = 3; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; @@ -1964,7 +2008,7 @@ if ($action == 'create') print ''; } print ''; - + // Amount VAT print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 8fae698ba94..b05a9c2a8b5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -121,6 +121,11 @@ class Propal extends CommonObject var $nbtodolate; var $specimen; + + //Incorterms + var $fk_incoterms; + var $location_incoterms; + var $libelle_incoterms; //Used into tooltip /** @@ -745,6 +750,8 @@ class Propal extends CommonObject $sql.= ", fk_availability"; $sql.= ", fk_input_reason"; $sql.= ", fk_projet"; + $sql.= ", fk_incoterms"; + $sql.= ", location_incoterms"; $sql.= ", entity"; $sql.= ") "; $sql.= " VALUES ("; @@ -772,6 +779,8 @@ class Propal extends CommonObject $sql.= ", ".$this->availability_id; $sql.= ", ".$this->demand_reason_id; $sql.= ", ".($this->fk_project?$this->fk_project:"null"); + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ", ".$conf->entity; $sql.= ")"; @@ -1088,6 +1097,8 @@ class Propal extends CommonObject $sql.= ", p.fk_mode_reglement"; $sql.= ', p.fk_account'; $sql.= ", p.fk_shipping_method"; + $sql.= ", p.fk_incoterms, p.location_incoterms"; + $sql.= ", i.libelle as libelle_incoterms"; $sql.= ", c.label as statut_label"; $sql.= ", ca.code as availability_code, ca.label as availability"; $sql.= ", dr.code as demand_reason_code, dr.label as demand_reason"; @@ -1098,6 +1109,7 @@ class Propal extends CommonObject $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid'; $sql.= " WHERE p.fk_statut = c.id"; $sql.= " AND p.entity = ".$conf->entity; if ($ref) $sql.= " AND p.ref='".$ref."'"; @@ -1165,6 +1177,11 @@ class Propal extends CommonObject $this->user_valid_id = $obj->fk_user_valid; $this->user_close_id = $obj->fk_user_cloture; + //Incoterms + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + if ($obj->fk_statut == 0) { $this->brouillon = 1; From 560d836943c1bbf7f07724058bfe4bfc5b5ea173 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 10 Feb 2015 12:21:29 +0100 Subject: [PATCH 10/17] [CORE] corrections mineurs sur des tests (#incoterm). --- htdocs/comm/propal.php | 10 +++++----- htdocs/societe/soc.php | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index d6b130749ed..f044af50980 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -53,7 +53,7 @@ $langs->load('orders'); $langs->load('products'); $langs->load("deliveries"); $langs->load('sendings'); -if ($conf->incoterm->enabled) $langs->load('incoterm'); +if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (! empty($conf->margin->enabled)) $langs->load('margins'); @@ -243,7 +243,7 @@ if (empty($reshook)) } // Set incoterm - elseif ($action == 'set_incoterms' && $conf->incoterm->enabled) + elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) { $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); } @@ -1400,7 +1400,7 @@ if ($action == 'create') print ""; // Incoterms - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { print ''; print ''; @@ -1970,13 +1970,13 @@ if ($action == 'create') } // Incoterms - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index c9a3e796979..07ba407731c 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -45,7 +45,7 @@ $langs->load("commercial"); $langs->load("bills"); $langs->load("banks"); $langs->load("users"); -if ($conf->incoterm->enabled) $langs->load("incoterm"); +if (!empty($conf->incoterm->enabled)) $langs->load("incoterm"); if (! empty($conf->notification->enabled)) $langs->load("mails"); $mesg=''; $error=0; $errors=array(); @@ -193,7 +193,7 @@ if (empty($reshook)) $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); // Incoterms - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -522,7 +522,7 @@ if (empty($reshook)) } // Set incoterm - if ($action == 'set_incoterms' && $conf->incoterm->enabled) + if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) { $object->fetch($socid); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); @@ -1089,7 +1089,7 @@ else } // Incoterms - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { print ''; print ''; @@ -1221,7 +1221,7 @@ else $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); //Incoterms - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha'); @@ -1615,7 +1615,7 @@ else } // Incoterms - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { print ''; print ''; @@ -2011,7 +2011,7 @@ else } // Incoterms - if ($conf->incoterm->enabled) + if (!empty($conf->incoterm->enabled)) { print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 1459dac849e..8cb304daf27 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -58,6 +58,7 @@ $langs->load('compta'); $langs->load('products'); $langs->load('banks'); $langs->load('main'); +if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (! empty($conf->margin->enabled)) $langs->load('margins'); @@ -318,6 +319,12 @@ if (empty($reshook)) dol_print_error($db, $object->error); } + // Set incoterm + elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) + { + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); + } + // bank account else if ($action == 'setbankaccount' && $user->rights->facture->creer) { @@ -674,6 +681,8 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->remise_absolue = $_POST['remise_absolue']; $object->remise_percent = $_POST['remise_percent']; + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); // Proprietes particulieres a facture de remplacement $object->fk_facture_source = $_POST['fac_replacement']; @@ -718,6 +727,8 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->remise_absolue = $_POST['remise_absolue']; $object->remise_percent = $_POST['remise_percent']; + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); // Proprietes particulieres a facture avoir $object->fk_facture_source = $_POST['fac_avoir']; @@ -846,6 +857,8 @@ if (empty($reshook)) $object->amount = $_POST['amount']; $object->remise_absolue = $_POST['remise_absolue']; $object->remise_percent = $_POST['remise_percent']; + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); if (GETPOST('type') == Facture::TYPE_SITUATION) { @@ -2262,6 +2275,16 @@ if ($action == 'create') print ''; } + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + print ''; + } + // Other attributes $parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by @@ -3361,6 +3384,29 @@ if ($action == 'create') print ''; print ''; } + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + } // Other attributes $cols = 5; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5c645783cc1..3dd4076188b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -123,6 +123,11 @@ class Facture extends CommonInvoice var $specimen; var $fac_rec; + + //Incoterms + var $fk_incoterms; + var $location_incoterms; + var $libelle_incoterms; //Used into tooltip /** * @var int Situation cycle reference number @@ -237,6 +242,8 @@ class Facture extends CommonInvoice $this->mode_reglement_id = $_facrec->mode_reglement_id; $this->remise_absolue = $_facrec->remise_absolue; $this->remise_percent = $_facrec->remise_percent; + $this->fk_incoterms = $_facrec->fk_incoterms; + $this->location_incoterms= $_facrec->location_incoterms; // Clean parametres if (! $this->type) $this->type = self::TYPE_STANDARD; @@ -271,6 +278,7 @@ class Facture extends CommonInvoice $sql.= ", fk_facture_source, fk_user_author, fk_projet"; $sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf"; $sql.= ", situation_cycle_ref, situation_counter, situation_final"; + $sql.= ", fk_incoterms, location_incoterms"; $sql.= ")"; $sql.= " VALUES ("; $sql.= "'(PROV)'"; @@ -296,6 +304,8 @@ class Facture extends CommonInvoice $sql.= ", ".($this->situation_cycle_ref?"'".$this->db->escape($this->situation_cycle_ref)."'":"null"); $sql.= ", ".($this->situation_counter?"'".$this->db->escape($this->situation_counter)."'":"null"); $sql.= ", ".($this->situation_final?$this->situation_final:0); + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.=")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -913,9 +923,12 @@ class Facture extends CommonInvoice $sql.= ', f.fk_account'; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; + $sql.= ', f.fk_incoterms, f.location_incoterms'; + $sql.= ", i.libelle as libelle_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid'; $sql.= ' WHERE f.entity = '.$conf->entity; if ($rowid) $sql.= " AND f.rowid=".$rowid; if ($ref) $sql.= " AND f.facnumber='".$this->db->escape($ref)."'"; @@ -975,6 +988,11 @@ class Facture extends CommonInvoice $this->situation_final = $obj->situation_final; $this->extraparams = (array) json_decode($obj->extraparams, true); + //Incoterms + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + if ($this->statut == 0) $this->brouillon = 1; // Retreive all extrafield for invoice diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7e7b3cf6e3b..c9e3609eafa 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -51,6 +51,7 @@ $langs->load('orders'); $langs->load('stocks'); $langs->load('other'); $langs->load('propal'); +if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (! empty($conf->productbatch->enabled)) $langs->load('productbatch'); $origin = GETPOST('origin','alpha')?GETPOST('origin','alpha'):'expedition'; // Example: commande, propal @@ -104,6 +105,12 @@ if (($action == 'create') || ($action == 'add')) } } +// Set incoterm +if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) +{ + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); +} + $parameters=array(); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -143,6 +150,8 @@ if (empty($reshook)) $object->ref_int = GETPOST('ref_int','alpha'); $object->note_private = GETPOST('note_private'); $object->note_public = GETPOST('note_public'); + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $num=count($objectsrc->lines); $totalqty=0; @@ -571,6 +580,16 @@ if ($action == 'create') print ''; print "\n"; + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + print ''; + } + // Other attributes $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook @@ -1159,6 +1178,29 @@ else if ($id || $ref) print $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number); print ''; + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + } + // Other attributes $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 67426510da2..03f4868dbbf 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -90,6 +90,10 @@ class Expedition extends CommonObject var $listmeths; // List of carriers + //Incorterms + var $fk_incoterms; + var $location_incoterms; + var $libelle_incoterms; //Used into tooltip /** * Constructor @@ -214,6 +218,7 @@ class Expedition extends CommonObject $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", model_pdf"; + $sql.= ", fk_incoterms, location_incoterms"; $sql.= ") VALUES ("; $sql.= "'(PROV)'"; $sql.= ", ".$conf->entity; @@ -236,6 +241,8 @@ class Expedition extends CommonObject $sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null"); + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -414,8 +421,11 @@ class Expedition extends CommonObject $sql.= ", e.fk_shipping_method, e.tracking_number"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= ", e.note_private, e.note_public"; + $sql.= ', e.fk_incoterms, e.location_incoterms'; + $sql.= ', i.libelle as libelle_incoterms'; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->element."'"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid'; $sql.= " WHERE e.entity = ".$conf->entity; if ($id) $sql.= " AND e.rowid=".$id; if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'"; @@ -468,6 +478,11 @@ class Expedition extends CommonObject $this->trueSize = $obj->size."x".$obj->width."x".$obj->height; $this->size_units = $obj->size_units; + //Incoterms + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + $this->db->free($result); if ($this->statut == 0) $this->brouillon = 1; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7f2237859ea..19819e55387 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -86,6 +86,11 @@ class CommandeFournisseur extends CommonOrder var $user_valid_id; var $user_approve_id; + //Incorterms + var $fk_incoterms; + var $location_incoterms; + var $libelle_incoterms; //Used into tooltip + var $extraparams=array(); @@ -137,10 +142,13 @@ class CommandeFournisseur extends CommonOrder $sql.= " cm.libelle as methode_commande,"; $sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,"; $sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle"; + $sql.= ', c.fk_incoterms, c.location_incoterms'; + $sql.= ', i.libelle as libelle_incoterms'; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON (c.fk_mode_reglement = p.id)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; $sql.= " WHERE c.entity = ".$conf->entity; if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; else $sql.= " AND c.rowid=".$id; @@ -196,6 +204,11 @@ class CommandeFournisseur extends CommonOrder $this->note_public = $obj->note_public; $this->modelpdf = $obj->model_pdf; + //Incoterms + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->db->free($resql); @@ -906,6 +919,7 @@ class CommandeFournisseur extends CommonOrder $sql.= ", fk_mode_reglement"; $sql.= ", fk_cond_reglement"; $sql.= ", fk_account"; + $sql.= ", fk_incoterms, location_incoterms"; $sql.= ") "; $sql.= " VALUES ("; $sql.= "''"; @@ -923,6 +937,8 @@ class CommandeFournisseur extends CommonOrder $sql.= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'null'); $sql.= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'null'); $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -2203,7 +2219,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->date_start = $this->db->jdate($objp->date_start); $this->date_end = $this->db->jdate($objp->date_end); - + $this->db->free($result); return 1; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 71e5c320dfa..4260f23a343 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -93,6 +93,11 @@ class FactureFournisseur extends CommonInvoice var $fournisseur; // deprecated var $thirdparty; // To store thirdparty + //Incorterms + var $fk_incoterms; + var $location_incoterms; + var $libelle_incoterms; //Used into tooltip + var $extraparams=array(); /** @@ -186,6 +191,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", note_public"; $sql.= ", fk_user_author"; $sql.= ", date_lim_reglement"; + $sql.= ", fk_incoterms, location_incoterms"; $sql.= ")"; $sql.= " VALUES ("; $sql.= "'(PROV)'"; @@ -203,6 +209,8 @@ class FactureFournisseur extends CommonInvoice $sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", ".$user->id.","; $sql.= $this->date_echeance!=''?"'".$this->db->idate($this->date_echeance)."'":"null"; + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -369,11 +377,14 @@ class FactureFournisseur extends CommonInvoice $sql.= " t.extraparams,"; $sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle,"; $sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle,"; - $sql.= ' s.nom as socnom, s.rowid as socid'; + $sql.= ' s.nom as socnom, s.rowid as socid,'; + $sql.= ' t.fk_incoterms, t.location_incoterms,'; + $sql.= " i.libelle as libelle_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON (t.fk_cond_reglement = cr.rowid)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON (t.fk_mode_reglement = p.id)"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE t.rowid=".$id; if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; @@ -433,6 +444,11 @@ class FactureFournisseur extends CommonInvoice $this->modelpdf = $obj->model_pdf; $this->import_key = $obj->import_key; + //Incoterms + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->socid = $obj->socid; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index fe22a154251..b4857d4f9c3 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -55,6 +55,7 @@ $langs->load('propal'); $langs->load('deliveries'); $langs->load('products'); $langs->load('stocks'); +if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); $id = GETPOST('id','int'); $ref = GETPOST('ref','alpha'); @@ -135,6 +136,12 @@ if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } +// Set incoterm +if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) +{ + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); +} + // bank account if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) { @@ -844,6 +851,8 @@ if ($action == 'add' && $user->rights->fournisseur->commande->creer) $object->fk_account = GETPOST('fk_account', 'int'); $object->note_private = GETPOST('note_private'); $object->note_public = GETPOST('note_public'); + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -1284,6 +1293,16 @@ if ($action=="create") print ''; } + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + print ''; + } + print ''; print ''; print ''; } - + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + } + // Other attributes $cols = 3; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 325a9e5d591..290585ac080 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -52,6 +52,7 @@ $langs->load('suppliers'); $langs->load('companies'); $langs->load('products'); $langs->load('banks'); +if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $action = GETPOST("action"); @@ -224,6 +225,12 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } +// Set incoterm +elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) +{ + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); +} + // bank account else if ($action == 'setbankaccount' && $user->rights->fournisseur->facture->creer) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); @@ -328,6 +335,8 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); // Auto calculation of date due if not filled by user if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement(); @@ -1404,6 +1413,16 @@ if ($action == 'create') $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:'-1'), $projectid, 'projectid', 0); print ''; } + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + print ''; + } // Bank Account print ''; } + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + } + // Other attributes $cols = 4; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 360c99af189..385268b1ad7 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -101,7 +101,12 @@ ALTER TABLE llx_contratdet_extrafields ADD INDEX idx_contratdet_extrafields (fk_ -- -- Module incoterm -- -ALTER TABLE llx_facture ADD COLUMN ( +ALTER TABLE llx_societe ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_propal ADD COLUMN ( fk_incoterms integer, location_incoterms varchar(255) ); @@ -111,7 +116,17 @@ ALTER TABLE llx_commande ADD COLUMN ( location_incoterms varchar(255) ); -ALTER TABLE llx_propal ADD COLUMN ( +ALTER TABLE llx_commande_fournisseur ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_facture ADD COLUMN ( + fk_incoterms integer, + location_incoterms varchar(255) +); + +ALTER TABLE llx_facture_fourn ADD COLUMN ( fk_incoterms integer, location_incoterms varchar(255) ); @@ -126,16 +141,6 @@ ALTER TABLE llx_livraison ADD COLUMN ( location_incoterms varchar(255) ); -ALTER TABLE llx_societe ADD COLUMN ( - fk_incoterms integer, - location_incoterms varchar(255) -); - -ALTER TABLE llx_commande_fournisseur ADD COLUMN ( - fk_incoterms integer, - location_incoterms varchar(255) -); - CREATE TABLE IF NOT EXISTS llx_c_incoterms ( rowid integer NOT NULL AUTO_INCREMENT, code varchar(3) NOT NULL, diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 4ab76afe239..e50fb9c8ea8 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -43,6 +43,7 @@ $langs->load("sendings"); $langs->load("bills"); $langs->load('deliveries'); $langs->load('orders'); +if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); $action=GETPOST('action', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); @@ -80,7 +81,8 @@ if ($action == 'add') $object->date_livraison = time(); $object->note = $_POST["note"]; $object->commande_id = $_POST["commande_id"]; - + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + if (!$conf->expedition_bon->enabled && ! empty($conf->stock->enabled)) { $expedition->entrepot_id = $_POST["entrepot_id"]; @@ -173,6 +175,12 @@ if ($action == 'setdate_livraison' && $user->rights->expedition->livraison->cree } } +// Set incoterm +elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) +{ + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); +} + /* * Build document */ @@ -579,6 +587,29 @@ else print ''; print ''; + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + } + // Note Public print ''; print '
'; From 2a1a5e74c61eb1288ec74507f56b235b4756b11e Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 10 Feb 2015 11:46:09 +0100 Subject: [PATCH 08/17] =?UTF-8?q?[CORE]=20mise=20=C3=A0=20jour=20de=20l'ob?= =?UTF-8?q?jet=20pour=20l'info=20bulle=20apr=C3=A8s=20modification=20de=20?= =?UTF-8?q?l'incoterm=20(#incoterm).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/class/commonobject.class.php | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ad87502fe1b..5f2a3db5fae 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2376,6 +2376,32 @@ abstract class CommonObject } } + + /** + * Return incoterms informations + * + * @return string Bank number + */ + function display_incoterms() + { + $out = ''; + $this->incoterms_libelle = ''; + if (!empty($this->fk_incoterms)) + { + $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $result = $this->db->query($sql); + if ($result) + { + $res = $this->db->fetch_object($result); + $out .= $res->code; + } + } + + $out .= ' - '.$this->location_incoterms; + + return $out; + } + /** * Define incoterms values of current object * @@ -2397,6 +2423,14 @@ abstract class CommonObject { $this->fk_incoterms = $id_incoterm; $this->location_incoterms = $location; + + $sql = 'SELECT libelle FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; + $res = $this->db->query($sql); + if ($res) + { + $obj = $this->db->fetch_object($res); + $this->libelle_incoterms = $obj->libelle; + } return 1; } else From 36304234d2b166179ebf1cb608453977d7cd222a Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 10 Feb 2015 11:46:35 +0100 Subject: [PATCH 09/17] =?UTF-8?q?[CORE]=20ajout=20de=20l'incoterm=20sur=20?= =?UTF-8?q?les=20pages=20propal=20et=20=C3=A0=20l'objet=20(#incoterm).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/propal.php | 46 ++++++++++++++++++++++- htdocs/comm/propal/class/propal.class.php | 17 +++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 302b49fbdb7..d6b130749ed 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -53,6 +53,7 @@ $langs->load('orders'); $langs->load('products'); $langs->load("deliveries"); $langs->load('sendings'); +if ($conf->incoterm->enabled) $langs->load('incoterm'); if (! empty($conf->margin->enabled)) $langs->load('margins'); @@ -240,6 +241,12 @@ if (empty($reshook)) { $object->set_ref_client($user, $_POST['ref_client']); } + + // Set incoterm + elseif ($action == 'set_incoterms' && $conf->incoterm->enabled) + { + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); + } // Create proposal else if ($action == 'add' && $user->rights->propal->creer) @@ -296,6 +303,8 @@ if (empty($reshook)) $object->author = $user->id; // deprecated $object->note = GETPOST('note'); $object->statut = 0; + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $id = $object->create_from($user); } else { @@ -319,6 +328,8 @@ if (empty($reshook)) $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated $object->note = GETPOST('note'); + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->origin = GETPOST('origin'); $object->origin_id = GETPOST('originid'); @@ -1388,6 +1399,16 @@ if ($action == 'create') print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF)); print "
'; + print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:'')); + print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->societe->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print '
'; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'; print '
'; print $langs->trans('IncotermLabel'); print ''; - if ($user->rights->societe->creer) print ''.img_edit().''; + if ($user->rights->commande->creer) print ''.img_edit().''; else print ' '; print '
'; print '
'; print ''; } + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + print ''; + } + // Other attributes $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by @@ -1996,7 +2015,30 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; print ''; } - + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + } + // Other attributes $cols = 3; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 27c320b3326..192755e00f2 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -110,6 +110,10 @@ class Commande extends CommonOrder var $nbtodo; var $nbtodolate; + //Incorterms + var $fk_incoterms; + var $location_incoterms; + var $libelle_incoterms; //Used into tooltip /** * Constructor @@ -677,6 +681,7 @@ class Commande extends CommonOrder $sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address"; $sql.= ", fk_shipping_method"; $sql.= ", remise_absolue, remise_percent"; + $sql.= ", fk_incoterms, location_incoterms"; $sql.= ", entity"; $sql.= ")"; $sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id; @@ -699,6 +704,8 @@ class Commande extends CommonOrder $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL'); $sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL'); $sql.= ", ".($this->remise_percent>0?$this->remise_percent:0); + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ", ".$conf->entity; $sql.= ")"; @@ -1386,6 +1393,8 @@ class Commande extends CommonOrder $sql.= ', c.fk_shipping_method'; $sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams'; + $sql.= ', c.fk_incoterms, c.location_incoterms'; + $sql.= ", i.libelle as libelle_incoterms"; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', ca.code as availability_code'; @@ -1395,6 +1404,7 @@ class Commande extends CommonOrder $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; $sql.= " WHERE c.entity = ".$conf->entity; if ($id) $sql.= " AND c.rowid=".$id; if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'"; @@ -1450,6 +1460,11 @@ class Commande extends CommonOrder $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; $this->fk_delivery_address = $obj->fk_delivery_address; + //Incoterms + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->lines = array(); From 81130634d3c761a91a5fd77dea137561233fd102 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 23 Feb 2015 09:16:14 +0100 Subject: [PATCH 12/17] =?UTF-8?q?[CORE]=20int=C3=A9gration=20de=20incoterm?= =?UTF-8?q?=20sur=20les=20diff=C3=A9rentes=20class=20(#incoterm).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/propal.php | 2 +- htdocs/compta/facture.php | 46 +++++++++++++++++++ htdocs/compta/facture/class/facture.class.php | 18 ++++++++ htdocs/expedition/card.php | 42 +++++++++++++++++ htdocs/expedition/class/expedition.class.php | 15 ++++++ .../class/fournisseur.commande.class.php | 18 +++++++- .../fourn/class/fournisseur.facture.class.php | 18 +++++++- htdocs/fourn/commande/card.php | 44 +++++++++++++++++- htdocs/fourn/facture/card.php | 42 +++++++++++++++++ .../install/mysql/migration/3.7.0-3.8.0.sql | 29 +++++++----- htdocs/livraison/card.php | 33 ++++++++++++- htdocs/livraison/class/livraison.class.php | 18 ++++++++ 12 files changed, 308 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index f044af50980..57ac3a8bbcd 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1976,7 +1976,7 @@ if ($action == 'create') print '
'; From 24a970a10939cf6dbb8b58ec481d5db201491c33 Mon Sep 17 00:00:00 2001 From: phf Date: Tue, 10 Feb 2015 12:22:07 +0100 Subject: [PATCH 11/17] =?UTF-8?q?[CORE]=20ajout=20de=20la=20gestion=20inco?= =?UTF-8?q?term=20sur=20les=20pages=20commande=20et=20=C3=A0=20l'objet=20(?= =?UTF-8?q?#incoterm).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/commande/card.php | 46 ++++++++++++++++++++++-- htdocs/commande/class/commande.class.php | 15 ++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index cbc6141ac1b..d1f8b49e606 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -55,6 +55,7 @@ $langs->load('propal'); $langs->load('deliveries'); $langs->load('sendings'); $langs->load('products'); +if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (! empty($conf->margin->enabled)) $langs->load('margins'); @@ -237,7 +238,9 @@ if (empty($reshook)) $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address'); $object->contactid = GETPOST('contactid'); - + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); + // If creation from another object of another module (Example: origin=propal, originid=1) if (! empty($origin) && ! empty($originid)) { // Parse element/subelement (ex: project_task) @@ -499,6 +502,12 @@ if (empty($reshook)) } } + // Set incoterm + elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) + { + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); + } + // bank account else if ($action == 'setbankaccount' && $user->rights->commande->creer) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); @@ -1437,6 +1446,16 @@ if ($action == 'create' && $user->rights->commande->creer) { print '
'; + print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->commande->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print '
'; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
'; print $langs->trans('IncotermLabel'); print ''; - if ($user->rights->commande->creer) print ''.img_edit().''; + if ($user->rights->propal->creer) print ''.img_edit().''; else print ' '; print '
'; print '
'; + print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->facture->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print '
'; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
'; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); + print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->expedition->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print '
'; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
'; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); + print '
'.$langs->trans('NotePublic').''; $doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); @@ -1624,7 +1643,30 @@ elseif (! empty($object->id)) print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->fournisseur->commande->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print '
'; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
'; + print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + print '
'.$langs->trans('BankAccount').''; @@ -1950,6 +1969,29 @@ else print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->fournisseur->facture->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print '
'; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->expedition->livraison->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print '
'; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
'.$langs->trans("NotePublic").''; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index e12781d5228..f1e9e3d6ca6 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -60,6 +60,10 @@ class Livraison extends CommonObject var $date_valid; var $model_pdf; + //Incorterms + var $fk_incoterms; + var $location_incoterms; + var $libelle_incoterms; //Used into tooltip /** * Constructor @@ -115,6 +119,7 @@ class Livraison extends CommonObject $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", model_pdf"; + $sql.= ", fk_incoterms, location_incoterms"; $sql.= ") VALUES ("; $sql.= "'(PROV)'"; $sql.= ", ".$conf->entity; @@ -127,6 +132,8 @@ class Livraison extends CommonObject $sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null"); + $sql.= ", ".(int) $this->fk_incoterms; + $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ")"; dol_syslog("Livraison::create", LOG_DEBUG); @@ -265,8 +272,11 @@ class Livraison extends CommonObject $sql.=" l.total_ht, l.fk_statut, l.fk_user_valid, l.note_private, l.note_public"; $sql.= ", l.date_delivery, l.fk_address, l.model_pdf"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; + $sql.= ', l.fk_incoterms, l.location_incoterms'; + $sql.= ", i.libelle as libelle_incoterms"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->element."'"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON l.fk_incoterms = i.rowid'; $sql.= " WHERE l.rowid = ".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -295,6 +305,10 @@ class Livraison extends CommonObject $this->origin = $obj->origin; // May be 'shipping' $this->origin_id = $obj->origin_id; // May be id of shipping + //Incoterms + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; $this->db->free($result); if ($this->statut == 0) $this->brouillon = 1; @@ -514,6 +528,10 @@ class Livraison extends CommonObject $this->fk_delivery_address = $expedition->fk_delivery_address; $this->socid = $expedition->socid; $this->ref_customer = $expedition->ref_customer; + + //Incoterms + $this->fk_incoterms = $expedition->fk_incoterms; + $this->location_incoterms = $expedition->location_incoterms; return $this->create($user); } From c45979499949cee7cff50b74c01b3684017f6ade Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 23 Feb 2015 10:36:44 +0100 Subject: [PATCH 13/17] =?UTF-8?q?[CORE]=20gestion=20de=20l'affichage=20de?= =?UTF-8?q?=20l'incoterm=20sur=20les=20diff=C3=A9rents=20PDF=20de=20base?= =?UTF-8?q?=20(#incoterm).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/propal.php | 2 +- htdocs/core/class/commonobject.class.php | 22 +++++++++++++++- .../commande/doc/pdf_einstein.modules.php | 25 ++++++++++++++++++- .../expedition/doc/pdf_rouget.modules.php | 25 ++++++++++++++++++- .../modules/facture/doc/pdf_crabe.modules.php | 25 ++++++++++++++++++- .../livraison/doc/pdf_typhon.modules.php | 25 ++++++++++++++++++- .../modules/propale/doc/pdf_azur.modules.php | 25 ++++++++++++++++++- .../pdf/pdf_canelle.modules.php | 25 ++++++++++++++++++- .../pdf/pdf_muscadet.modules.php | 25 ++++++++++++++++++- 9 files changed, 190 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 57ac3a8bbcd..6132c69c5bb 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -998,7 +998,7 @@ if (empty($reshook)) if (GETPOST('model')) { $object->setDocModel($user, GETPOST('model')); } - + // Define output language $outputlangs = $langs; if (! empty($conf->global->MAIN_MULTILANGS)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5f2a3db5fae..8490a5bbe4e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2380,7 +2380,7 @@ abstract class CommonObject /** * Return incoterms informations * - * @return string Bank number + * @return string incoterms info */ function display_incoterms() { @@ -2402,6 +2402,26 @@ abstract class CommonObject return $out; } + /** + * Return incoterms informations for pdf display + * + * @return string incoterms info + */ + function getIncotermsForPDF() + { + $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int)$this->fk_incoterms; + $resql = $this->db->query($sql); + if ($resql) + { + $res = $this->db->fetch_object($resql); + return 'Incoterm : '.$res->code.' - '.$this->location_incoterms; + } + else + { + return false; + } + } + /** * Define incoterms values of current object * diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 510a1bd88a1..f48632a89ce 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -264,6 +264,29 @@ class pdf_einstein extends ModelePDFCommandes $tab_height = 130; $tab_height_newpage = 150; + // Incoterm + $height_incoterms = 0; + if ($conf->incoterm->enabled) + { + $desc_incoterms = $object->getIncotermsForPDF(); + if ($desc_incoterms) + { + $tab_top = 88; + + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $nexY = $pdf->GetY(); + $height_incoterms=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + + $tab_top = $nexY+6; + $height_incoterms += 4; + } + } + // Affiche notes $notetoshow=empty($object->note_public)?'':$object->note_public; if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) @@ -279,7 +302,7 @@ class pdf_einstein extends ModelePDFCommandes } if ($notetoshow) { - $tab_top = 88; + $tab_top = 88 + $height_incoterms; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 9c5dada3a72..6982fc0c6cc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -191,9 +191,32 @@ class pdf_rouget extends ModelePdfExpedition $tab_height = 130; $tab_height_newpage = 150; + // Incoterm + $height_incoterms = 0; + if ($conf->incoterm->enabled) + { + $desc_incoterms = $object->getIncotermsForPDF(); + if ($desc_incoterms) + { + $tab_top = 88; + + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $nexY = $pdf->GetY(); + $height_incoterms=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + + $tab_top = $nexY+6; + $height_incoterms += 4; + } + } + if (! empty($object->note_public) || ! empty($object->tracking_number)) { - $tab_top = 88; + $tab_top = 88 + $height_incoterms; $tab_top_alt = $tab_top; $pdf->SetFont('','B', $default_font_size - 2); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 06c3df85f4d..62d72ee49d2 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -318,6 +318,29 @@ class pdf_crabe extends ModelePDFFactures $tab_height = 130; $tab_height_newpage = 150; + // Incoterm + $height_incoterms = 0; + if ($conf->incoterm->enabled) + { + $desc_incoterms = $object->getIncotermsForPDF(); + if ($desc_incoterms) + { + $tab_top = 88; + + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $nexY = $pdf->GetY(); + $height_incoterms=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + + $tab_top = $nexY+6; + $height_incoterms += 4; + } + } + // Affiche notes $notetoshow=empty($object->note_public)?'':$object->note_public; if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) @@ -333,7 +356,7 @@ class pdf_crabe extends ModelePDFFactures } if ($notetoshow) { - $tab_top = 88; + $tab_top = 88 + $height_incoterms; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index e3e9be99411..e2dc1f2376e 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -269,10 +269,33 @@ class pdf_typhon extends ModelePDFDeliveryOrder $tab_height = 130; $tab_height_newpage = 150; + // Incoterm + $height_incoterms = 0; + if ($conf->incoterm->enabled) + { + $desc_incoterms = $object->getIncotermsForPDF(); + if ($desc_incoterms) + { + $tab_top = 88; + + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $nexY = $pdf->GetY(); + $height_incoterms=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + + $tab_top = $nexY+6; + $height_incoterms += 4; + } + } + // Affiche notes if (! empty($object->note_public)) { - $tab_top = 88; + $tab_top = 88 + $height_incoterms; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 35953b8521f..b3ff4710f1b 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -288,6 +288,29 @@ class pdf_azur extends ModelePDFPropales $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); $tab_height = 130; $tab_height_newpage = 150; + + // Incoterm + $height_incoterms = 0; + if ($conf->incoterm->enabled) + { + $desc_incoterms = $object->getIncotermsForPDF(); + if ($desc_incoterms) + { + $tab_top = 88; + + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $nexY = $pdf->GetY(); + $height_incoterms=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + + $tab_top = $nexY+6; + $height_incoterms += 4; + } + } // Affiche notes $notetoshow=empty($object->note_public)?'':$object->note_public; @@ -304,7 +327,7 @@ class pdf_azur extends ModelePDFPropales } if ($notetoshow) { - $tab_top = 88; + $tab_top = 88 + $height_incoterms; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index d100a45b828..78d7f42fab2 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -261,10 +261,33 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tab_height = 130; $tab_height_newpage = 150; + // Incoterm + $height_incoterms = 0; + if ($conf->incoterm->enabled) + { + $desc_incoterms = $object->getIncotermsForPDF(); + if ($desc_incoterms) + { + $tab_top = 88; + + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $nexY = $pdf->GetY(); + $height_incoterms=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + + $tab_top = $nexY+6; + $height_incoterms += 4; + } + } + // Affiche notes if (! empty($object->note_public)) { - $tab_top = 88; + $tab_top = 88 + $height_incoterms; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index b26b540e5b1..e75475b1dca 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -269,10 +269,33 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tab_height = 130; $tab_height_newpage = 150; + // Incoterm + $height_incoterms = 0; + if ($conf->incoterm->enabled) + { + $desc_incoterms = $object->getIncotermsForPDF(); + if ($desc_incoterms) + { + $tab_top = 88; + + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1); + $nexY = $pdf->GetY(); + $height_incoterms=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); + + $tab_top = $nexY+6; + $height_incoterms += 4; + } + } + // Affiche notes if (! empty($object->note_public)) { - $tab_top = 88; + $tab_top = 88 + $height_incoterms; $pdf->SetFont('','', $default_font_size - 1); $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); From 52441914dee1fc47a879a5147a0f8f0e9b439d18 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 23 Feb 2015 10:42:34 +0100 Subject: [PATCH 14/17] =?UTF-8?q?Vas=20avec=20le=20merge=20pr=C3=A9c=C3=A9?= =?UTF-8?q?dent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/commande/class/commande.class.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 189911c0e77..2246ceaa690 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -106,10 +106,6 @@ class Commande extends CommonOrder var $lines = array(); - // Pour board - var $nbtodo; - var $nbtodolate; - //Incorterms var $fk_incoterms; var $location_incoterms; From 11a0624e393fddc1575022bc911acefa18b73f97 Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 23 Feb 2015 11:19:00 +0100 Subject: [PATCH 15/17] [CORE] FIX Travis phpcs (#incoterm). --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 13 ++++++++----- htdocs/core/modules/modIncoterm.class.php | 2 -- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5830c1d4041..28361a58c02 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2418,7 +2418,7 @@ abstract class CommonObject */ function getIncotermsForPDF() { - $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int)$this->fk_incoterms; + $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b4334814385..6473d8ea210 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -561,11 +561,14 @@ class Form /** * Return select list of incoterms * - * @param string $selected Id or Code of preselected incoterm - * @param string $htmlname Name of html select object - * @param string $htmloption Options html on select object - * @param string $maxlength Max length for labels (0=no limit) - * @return string HTML string with select + * @param string $selected Id or Code of preselected incoterm + * @param string $location_incoterms Value of input location + * @param string $page Defined the form action + * @param string $htmlname Name of html select object + * @param string $htmloption Options html on select object + * @param int $forcecombo Force to use combo box + * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @return string HTML string with select and input */ function select_incoterms($selected='', $location_incoterms='', $page='',$htmlname='incoterm_id',$htmloption='', $forcecombo=0, $events=array()) { diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php index 1d4f869b853..4501e0f174c 100644 --- a/htdocs/core/modules/modIncoterm.class.php +++ b/htdocs/core/modules/modIncoterm.class.php @@ -138,5 +138,3 @@ class modIncoterm extends DolibarrModules return $this->_remove($sql, $options); } } - -?> From 9eed66d9981d1fa840074e255a691b84829e2cae Mon Sep 17 00:00:00 2001 From: phf Date: Mon, 23 Feb 2015 11:46:39 +0100 Subject: [PATCH 16/17] [CORE] FIX : Travis phptest (#incoterm). --- htdocs/compta/facture/class/facture.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2bfb0b6f4eb..fd5494ad4cd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3238,6 +3238,8 @@ class Facture extends CommonInvoice $this->note_public='This is a comment (public)'; $this->note_private='This is a comment (private)'; $this->note='This is a comment (private)'; + $this->fk_incoterms=0; + $this->location_incoterms=''; if (empty($option) || $option != 'nolines') { From 5c36db06f60483772b7568b0c0182225d7728dce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Mar 2015 23:04:37 +0100 Subject: [PATCH 17/17] Add missing files --- htdocs/install/mysql/data/llx_c_incoterms.sql | 41 +++++++++++++++++++ .../mysql/tables/llx_c_incoterms.key.sql | 19 +++++++++ .../install/mysql/tables/llx_c_incoterms.sql | 25 +++++++++++ 3 files changed, 85 insertions(+) create mode 100644 htdocs/install/mysql/data/llx_c_incoterms.sql create mode 100644 htdocs/install/mysql/tables/llx_c_incoterms.key.sql create mode 100644 htdocs/install/mysql/tables/llx_c_incoterms.sql diff --git a/htdocs/install/mysql/data/llx_c_incoterms.sql b/htdocs/install/mysql/data/llx_c_incoterms.sql new file mode 100644 index 00000000000..ad9b09f09fc --- /dev/null +++ b/htdocs/install/mysql/data/llx_c_incoterms.sql @@ -0,0 +1,41 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2009 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- + +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l'install et tous les sigles '--' sont supprimés. +-- + + +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('EXW', 'Ex Works, au départ non chargé, non dédouané sortie d''usine (uniquement adapté aux flux domestiques, nationaux)', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('FCA', 'Free Carrier, marchandises dédouanées et chargées dans le pays de départ, chez le vendeur ou chez le commissionnaire de transport de l''acheteur', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('FAS', 'Free Alongside Ship, sur le quai du port de départ', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('FOB', 'Free On Board, chargé sur le bateau, les frais de chargement dans celui-ci étant fonction du liner term indiqué par la compagnie maritime (à la charge du vendeur)', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('CFR', 'Cost and Freight, chargé dans le bateau, livraison au port de départ, frais payés jusqu''au port d''arrivée, sans assurance pour le transport, non déchargé du navire à destination (les frais de déchargement sont inclus ou non au port d''arrivée)', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('CIF', 'Cost, Insurance and Freight, chargé sur le bateau, frais jusqu''au port d''arrivée, avec l''assurance marchandise transportée souscrite par le vendeur pour le compte de l''acheteur', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('CPT', 'Carriage Paid To, livraison au premier transporteur, frais jusqu''au déchargement du mode de transport, sans assurance pour le transport', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('CIP', 'Carriage and Insurance Paid to, idem CPT, avec assurance marchandise transportée souscrite par le vendeur pour le compte de l''acheteur', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('DAT', 'Delivered At Terminal, marchandises (déchargées) livrées sur quai, dans un terminal maritime, fluvial, aérien, routier ou ferroviaire désigné (dédouanement import, et post-acheminement payés par l''acheteur)', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('DAP', 'Delivered At Place, marchandises (non déchargées) mises à disposition de l''acheteur dans le pays d''importation au lieu précisé dans le contrat (déchargement, dédouanement import payé par l''acheteur)', 1); +INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('DDP', 'Delivered Duty Paid, marchandises (non déchargées) livrées à destination finale, dédouanement import et taxes à la charge du vendeur ; l''acheteur prend en charge uniquement le déchargement (si exclusion des taxes type TVA, le préciser clairement)', 1); + diff --git a/htdocs/install/mysql/tables/llx_c_incoterms.key.sql b/htdocs/install/mysql/tables/llx_c_incoterms.key.sql new file mode 100644 index 00000000000..65614a90c4d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_incoterms.key.sql @@ -0,0 +1,19 @@ +-- ======================================================================== +-- Copyright (C) 2009 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +ALTER TABLE llx_c_incoterms ADD UNIQUE INDEX uk_c_incoterms (code); diff --git a/htdocs/install/mysql/tables/llx_c_incoterms.sql b/htdocs/install/mysql/tables/llx_c_incoterms.sql new file mode 100644 index 00000000000..c960f0fab2f --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_incoterms.sql @@ -0,0 +1,25 @@ +-- ======================================================================== +-- Copyright (C) 2015 Laurent Destailleur +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +CREATE TABLE llx_c_incoterms ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + code varchar(3) NOT NULL, + libelle varchar(255) NOT NULL, + active tinyint DEFAULT 1 NOT NULL +) ENGINE=innodb; +