From c8bfd2c7c25ed51ce2bc7894c9b62c9d13531df5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 13:37:34 +0200 Subject: [PATCH 01/13] NEW translation for member type usefull for sync with API and multilanguage front end or application --- htdocs/core/lib/member.lib.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 27df67aedac..3628c9cdc51 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -127,6 +127,15 @@ function member_type_prepare_head(AdherentType $object) $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; + + // Multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) + { + $head[$h][0] = DOL_URL_ROOT."/adherents/traduction.php?rowid=".$object->id; + $head[$h][1] = $langs->trans("Translation"); + $head[$h][2] = 'translation'; + $h++; + } if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) From cff6da34df676f08e99d9fa0f750ec0a7411c80d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 13:53:06 +0200 Subject: [PATCH 02/13] Create traduction.php --- htdocs/adherents/traduction.php | 323 ++++++++++++++++++++++++++++++++ 1 file changed, 323 insertions(+) create mode 100644 htdocs/adherents/traduction.php diff --git a/htdocs/adherents/traduction.php b/htdocs/adherents/traduction.php new file mode 100644 index 00000000000..23ed3775735 --- /dev/null +++ b/htdocs/adherents/traduction.php @@ -0,0 +1,323 @@ + + * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2010-2012 Destailleur Laurent + * Copyright (C) 2014 Henry Florian + * + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/product/traduction.php + * \ingroup product + * \brief Page de traduction des produits + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array('members', 'languages')); + +$id = GETPOST('rowid', 'int'); +$action=GETPOST('action', 'alpha'); +$cancel=GETPOST('cancel', 'alpha'); + +// Security check +$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); +$fieldtype = (! empty($ref) ? 'ref' : 'rowid'); +if ($user->societe_id) $socid=$user->societe_id; +// Security check +$result=restrictedArea($user, 'adherent', $id, 'adherent_type'); + + +/* + * Actions + */ + +// retour a l'affichage des traduction si annulation +if ($cancel == $langs->trans("Cancel")) +{ + $action = ''; +} + +if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) +{ + $object = new AdherentType($db); + $object->fetch($id); + $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user); +} + +// Add translation +if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) +{ + $object = new AdherentType($db); + $object->fetch($id); + $current_lang = $langs->getDefaultLang(); + + // update de l'objet + if ( $_POST["forcelangprod"] == $current_lang ) + { + $object->label = $_POST["libelle"]; + $object->description = dol_htmlcleanlastbr($_POST["desc"]); + $object->other = dol_htmlcleanlastbr($_POST["other"]); + } + else + { + $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; + $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); + $object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]); + } + + // sauvegarde en base + if ( $object->setMultiLangs($user) > 0 ) + { + $action = ''; + } + else + { + $action = 'add'; + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +// Edit translation +if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) +{ + $object = new AdherentType($db); + $object->fetch($id); + $current_lang = $langs->getDefaultLang(); + + foreach ($object->multilangs as $key => $value) // enregistrement des nouvelles valeurs dans l'objet + { + if ( $key == $current_lang ) + { + $object->label = $_POST["libelle-".$key]; + $object->description = dol_htmlcleanlastbr($_POST["desc-".$key]); + $object->other = dol_htmlcleanlastbr($_POST["other-".$key]); + } + else + { + $object->multilangs[$key]["label"] = $_POST["libelle-".$key]; + $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); + $object->multilangs[$key]["other"] = dol_htmlcleanlastbr($_POST["other-".$key]); + } + } + + if ( $object->setMultiLangs($user) > 0 ) + { + $action = ''; + } + else + { + $action = 'edit'; + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +// Delete translation +if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer) +{ + $object = new AdherentType($db); + $object->fetch($id); + $langtodelete=GETPOST('langdel', 'alpha'); + + + if ( $object->delMultiLangs($langtodelete, $user) > 0 ) + { + $action = ''; + } + else + { + $action = 'edit'; + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +$object = new AdherentType($db); +$result = $object->fetch($id); + + +/* + * View + */ + +$title = $langs->trans('MemberTypeCard'); +$helpurl = ''; +$shortlabel = dol_trunc($object->label, 16); + +$title = $langs->trans('MemberType')." ". $shortlabel ." - ".$langs->trans('Translation'); +$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; + +llxHeader('', $title, $helpurl); + +$form = new Form($db); +$formadmin=new FormAdmin($db); + +$head = member_type_prepare_head($object); +$titre=$langs->trans("MemberType".$object->type); + +// Calculate $cnt_trans +$cnt_trans = 0; +if (! empty($object->multilangs)) +{ + foreach ($object->multilangs as $key => $value) + { + $cnt_trans++; + } +} + + +dol_fiche_head($head, 'translation', $titre, 0, 'group'); + +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'rowid', $linkback); + +dol_fiche_end(); + + + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print "\n
\n"; + +if ($action == '') +{ + if ($user->rights->produit->creer || $user->rights->service->creer) + { + print ''.$langs->trans("Add").''; + if ($cnt_trans > 0) print ''.$langs->trans("Update").''; + } +} + +print "\n
\n"; + + + +if ($action == 'edit') +{ + //WYSIWYG Editor + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + + print '
'; + print ''; + print ''; + print ''; + + if (! empty($object->multilangs)) + { + foreach ($object->multilangs as $key => $value) + { + $s=picto_from_langcode($key); + print "
".($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"')."
"; + + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; + $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%'); + $doleditor->Create(); + print '
'; + } + } + + print '
'; + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; +} +elseif ($action != 'add') +{ + if (! empty($object->multilangs)) + { + foreach ($object->multilangs as $key => $value) + { + $s=picto_from_langcode($key); + print ($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"').''; + + print '
'; + print '
'; + print ''; + print ''; + print ''; + print '
'.$langs->trans('Label').''.$object->multilangs[$key]["label"].'
'.$langs->trans('Description').''.$object->multilangs[$key]["description"].'
'; + print '
'; + } + } + if (! $cnt_trans && $action != 'add') print '
'. $langs->trans('NoTranslation').'
'; +} + + + +/* + * Form to add a new translation + */ + +if ($action == 'add' && $user->rights->adherent->configurer) +{ + //WYSIWYG Editor + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + + print '
'; + print '
'; + print ''; + print ''; + print ''; + + dol_fiche_head(); + + print ''; + print ''; + print ''; + print ''; + + print '
'.$langs->trans('Language').''; + print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); + print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; + $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%'); + $doleditor->Create(); + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; + + print '
'; +} + +// End of page +llxFooter(); +$db->close(); From c01ab4ab53cbfd81284aced4aae976f27f36e82f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 13:53:34 +0200 Subject: [PATCH 03/13] Update adherent_type.class.php --- .../adherents/class/adherent_type.class.php | 206 +++++++++++++++++- 1 file changed, 203 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 9591a24fa78..1ed576a362d 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -88,6 +88,8 @@ class AdherentType extends CommonObject /** @var array Array of members */ public $members=array(); + + public $multilangs=array(); /** @@ -101,6 +103,185 @@ class AdherentType extends CommonObject $this->statut = 1; } + /** + * Load array this->multilangs + * + * @return int <0 if KO, >0 if OK + */ + public function getMultiLangs() + { + global $langs; + + $current_lang = $langs->getDefaultLang(); + + $sql = "SELECT lang, label, description, email"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang"; + $sql.= " WHERE fk_type=".$this->id; + + $result = $this->db->query($sql); + if ($result) { + while ($obj = $this->db->fetch_object($result)) + { + //print 'lang='.$obj->lang.' current='.$current_lang.'
'; + if ($obj->lang == $current_lang) // si on a les traduct. dans la langue courante on les charge en infos principales. + { + $this->label = $obj->label; + $this->description = $obj->description; + $this->email = $obj->email; + } + $this->multilangs["$obj->lang"]["label"] = $obj->label; + $this->multilangs["$obj->lang"]["description"] = $obj->description; + $this->multilangs["$obj->lang"]["email"] = $obj->email; + } + return 1; + } + else + { + $this->error="Error: ".$this->db->lasterror()." - ".$sql; + return -1; + } + } + + /** + * Update or add a translation for a product + * + * @param User $user Object user making update + * @return int <0 if KO, >0 if OK + */ + public function setMultiLangs($user) + { + global $conf, $langs; + + $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2); + $current_lang = $langs->getDefaultLang(); + + foreach ($langs_available as $key => $value) + { + if ($key == $current_lang) { + $sql = "SELECT rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang"; + $sql.= " WHERE fk_type=".$this->id; + $sql.= " AND lang='".$key."'"; + + $result = $this->db->query($sql); + + if ($this->db->num_rows($result)) // if there is already a description line for this language + { + $sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang"; + $sql2.= " SET "; + $sql2.= " label='".$this->db->escape($this->label)."',"; + $sql2.= " description='".$this->db->escape($this->description)."'"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", email='".$this->db->escape($this->other)."'"; + } + $sql2.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; + } + else + { + $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.=", email"; + } + $sql2.= ")"; + $sql2.= " VALUES(".$this->id.",'".$this->db->escape($key)."','". $this->db->escape($this->label)."',"; + $sql2.= " '".$this->db->escape($this->description)."'"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", '".$this->db->escape($this->other)."'"; + } + $sql2.= ")"; + } + dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key); + if (! $this->db->query($sql2)) { + $this->error=$this->db->lasterror(); + return -1; + } + } + elseif (isset($this->multilangs[$key])) { + $sql = "SELECT rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang"; + $sql.= " WHERE fk_type=".$this->id; + $sql.= " AND lang='".$key."'"; + + $result = $this->db->query($sql); + + if ($this->db->num_rows($result)) // if there is already a description line for this language + { + $sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang"; + $sql2.= " SET "; + $sql2.= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; + $sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", email='".$this->db->escape($this->multilangs["$key"]["other"])."'"; + } + $sql2.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; + } + else + { + $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.=", email"; + } + $sql2.= ")"; + $sql2.= " VALUES(".$this->id.",'".$this->db->escape($key)."','". $this->db->escape($this->multilangs["$key"]["label"])."',"; + $sql2.= " '".$this->db->escape($this->multilangs["$key"]["description"])."'"; + if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", '".$this->db->escape($this->multilangs["$key"]["other"])."'"; + } + $sql2.= ")"; + } + + // We do not save if main fields are empty + if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"]) { + if (! $this->db->query($sql2)) { + $this->error=$this->db->lasterror(); + return -1; + } + } + } + else + { + // language is not current language and we didn't provide a multilang description for this language + } + } + + // Call trigger + $result = $this->call_trigger('MEMBER_TYPE_SET_MULTILANGS', $user); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -1; + } + // End call triggers + + return 1; + } + + /** + * Delete a language for this product + * + * @param string $langtodelete Language code to delete + * @param User $user Object user making delete + * + * @return int <0 if KO, >0 if OK + */ + public function delMultiLangs($langtodelete, $user) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type_lang"; + $sql.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($langtodelete)."'"; + + dol_syslog(get_class($this).'::delMultiLangs', LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + // Call trigger + $result = $this->call_trigger('ADHERENT_TYPE_DEL_MULTILANGS', $user); + if ($result < 0) { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR); + return -1; + } + // End call triggers + return 1; + } + else + { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR); + return -1; + } + } /** * Fonction qui permet de creer le status de l'adherent @@ -111,7 +292,7 @@ class AdherentType extends CommonObject */ public function create($user, $notrigger = 0) { - global $conf; + global $langs, $conf; $error=0; @@ -180,7 +361,7 @@ class AdherentType extends CommonObject */ public function update($user, $notrigger = 0) { - global $conf, $hookmanager; + global $langs, $conf, $hookmanager; $error=0; @@ -202,6 +383,17 @@ class AdherentType extends CommonObject $result = $this->db->query($sql); if ($result) { + + $this->description = $this->db->escape($this->note); + + // Multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) { + if ($this->setMultiLangs($user) < 0) { + $this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql; + return -2; + } + } + $action='update'; // Actions on extra fields @@ -283,6 +475,8 @@ class AdherentType extends CommonObject */ public function fetch($rowid) { + global $langs, $conf; + $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".(int) $rowid; @@ -299,12 +493,18 @@ class AdherentType extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->label = $obj->label; - $this->morphy = $obj->morphy; + $this->morphy = $obj->morphy; $this->statut = $obj->statut; $this->subscription = $obj->subscription; $this->mail_valid = $obj->mail_valid; $this->note = $obj->note; $this->vote = $obj->vote; + + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) { + $this->getMultiLangs(); + } + } return 1; From a295d57e0c79cd40523fb8d565590352065e43c6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 13:54:17 +0200 Subject: [PATCH 04/13] Update adherent_type.class.php --- htdocs/adherents/class/adherent_type.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 1ed576a362d..4e90390c223 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -493,7 +493,7 @@ class AdherentType extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->label = $obj->label; - $this->morphy = $obj->morphy; + $this->morphy = $obj->morphy; $this->statut = $obj->statut; $this->subscription = $obj->subscription; $this->mail_valid = $obj->mail_valid; From 8d8ded324d2b0eb5fade1cb5360c5d40d9593f00 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 17 Sep 2019 11:56:16 +0000 Subject: [PATCH 05/13] Fixing style errors. --- htdocs/adherents/class/adherent_type.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 4e90390c223..cd8a69e0f7d 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -504,7 +504,6 @@ class AdherentType extends CommonObject if (! empty($conf->global->MAIN_MULTILANGS)) { $this->getMultiLangs(); } - } return 1; From 50be1a634c9eed41e92be80e803fbe3db1f0254a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 14:02:19 +0200 Subject: [PATCH 06/13] Create llx_adherent_type_lang.php --- .../mysql/tables/llx_adherent_type_lang.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_adherent_type_lang.php diff --git a/htdocs/install/mysql/tables/llx_adherent_type_lang.php b/htdocs/install/mysql/tables/llx_adherent_type_lang.php new file mode 100644 index 00000000000..5f1ceee1f49 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_adherent_type_lang.php @@ -0,0 +1,30 @@ +-- ============================================================================ +-- Copyright (C) 2002-2003 Rodolphe Quiedeville +-- Copyright (C) 2005-2010 Regis Houssin +-- 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 . +-- +-- ============================================================================ + +create table llx_adherent_type_lang +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_type integer DEFAULT 0 NOT NULL, + lang varchar(5) DEFAULT 0 NOT NULL, + label varchar(255) NOT NULL, + description text, + email text, + import_key varchar(14) DEFAULT NULL +)ENGINE=innodb; From afb055c8a668882d7ae8e73925d677f3a89a9766 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 14:03:09 +0200 Subject: [PATCH 07/13] Create llx_adherent_type_lang.sql --- .../mysql/tables/llx_adherent_type_lang.sql | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_adherent_type_lang.sql diff --git a/htdocs/install/mysql/tables/llx_adherent_type_lang.sql b/htdocs/install/mysql/tables/llx_adherent_type_lang.sql new file mode 100644 index 00000000000..cbccac26020 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_adherent_type_lang.sql @@ -0,0 +1,30 @@ +-- ============================================================================ +-- Copyright (C) 2002-2003 Rodolphe Quiedeville +-- Copyright (C) 2005-2010 Regis Houssin +-- 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 . +-- +-- ============================================================================ + +create table llx_product_lang +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_product integer DEFAULT 0 NOT NULL, + lang varchar(5) DEFAULT 0 NOT NULL, + label varchar(255) NOT NULL, + description text, + note text, + import_key varchar(14) DEFAULT NULL +)ENGINE=innodb; From 430ffae8adc0d0ed870f2a72dfccef9572276619 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 14:03:22 +0200 Subject: [PATCH 08/13] Delete llx_adherent_type_lang.php --- .../mysql/tables/llx_adherent_type_lang.php | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 htdocs/install/mysql/tables/llx_adherent_type_lang.php diff --git a/htdocs/install/mysql/tables/llx_adherent_type_lang.php b/htdocs/install/mysql/tables/llx_adherent_type_lang.php deleted file mode 100644 index 5f1ceee1f49..00000000000 --- a/htdocs/install/mysql/tables/llx_adherent_type_lang.php +++ /dev/null @@ -1,30 +0,0 @@ --- ============================================================================ --- Copyright (C) 2002-2003 Rodolphe Quiedeville --- Copyright (C) 2005-2010 Regis Houssin --- 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 . --- --- ============================================================================ - -create table llx_adherent_type_lang -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_type integer DEFAULT 0 NOT NULL, - lang varchar(5) DEFAULT 0 NOT NULL, - label varchar(255) NOT NULL, - description text, - email text, - import_key varchar(14) DEFAULT NULL -)ENGINE=innodb; From 4c59f6bffaad3f6c79a94430e8308f628a8092cf Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 14:03:55 +0200 Subject: [PATCH 09/13] Update llx_adherent_type_lang.sql --- htdocs/install/mysql/tables/llx_adherent_type_lang.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_adherent_type_lang.sql b/htdocs/install/mysql/tables/llx_adherent_type_lang.sql index cbccac26020..179a9418790 100644 --- a/htdocs/install/mysql/tables/llx_adherent_type_lang.sql +++ b/htdocs/install/mysql/tables/llx_adherent_type_lang.sql @@ -18,13 +18,13 @@ -- -- ============================================================================ -create table llx_product_lang +create table llx_adherent_type_lang ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_product integer DEFAULT 0 NOT NULL, + fk_type integer DEFAULT 0 NOT NULL, lang varchar(5) DEFAULT 0 NOT NULL, label varchar(255) NOT NULL, description text, - note text, + email text, import_key varchar(14) DEFAULT NULL )ENGINE=innodb; From b969de46bc0934029f0050309e69c963e605a602 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 17 Sep 2019 14:05:39 +0200 Subject: [PATCH 10/13] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 92dcdce1128..4ad51248700 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -164,4 +164,13 @@ INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, m INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-REPUBLICDAY', 0, 117, '', 0, 1, 26, 1); INSERT INTO llx_c_hrm_public_holiday (code, entity, fk_country, dayrule, year, month, day, active) VALUES('IN-GANDI', 0, 117, '', 0, 10, 2, 1); - +create table llx_adherent_type_lang +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_type integer DEFAULT 0 NOT NULL, + lang varchar(5) DEFAULT 0 NOT NULL, + label varchar(255) NOT NULL, + description text, + email text, + import_key varchar(14) DEFAULT NULL +)ENGINE=innodb; From decbdaa5af44b322a6b911816daee9723393ebe8 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 7 Oct 2019 13:35:40 +0200 Subject: [PATCH 11/13] Rename traduction.php to type_translation.php --- htdocs/adherents/{traduction.php => type_translation.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename htdocs/adherents/{traduction.php => type_translation.php} (100%) diff --git a/htdocs/adherents/traduction.php b/htdocs/adherents/type_translation.php similarity index 100% rename from htdocs/adherents/traduction.php rename to htdocs/adherents/type_translation.php From ff992d996c5cdd705a854bd97394642467088b4d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 7 Oct 2019 13:37:35 +0200 Subject: [PATCH 12/13] Update type_translation.php --- htdocs/adherents/type_translation.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 23ed3775735..5122bebcecf 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -20,7 +20,7 @@ */ /** - * \file htdocs/product/traduction.php + * \file htdocs/adherents/type_translation.php * \ingroup product * \brief Page de traduction des produits */ @@ -205,8 +205,8 @@ if ($action == '') { if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''.$langs->trans("Add").''; - if ($cnt_trans > 0) print ''.$langs->trans("Update").''; + print ''.$langs->trans("Add").''; + if ($cnt_trans > 0) print ''.$langs->trans("Update").''; } } From 9aa7226d393269c66e016e4e953b270f2d6c8d6b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 7 Oct 2019 13:38:05 +0200 Subject: [PATCH 13/13] Update member.lib.php --- htdocs/core/lib/member.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 191c9d538c1..93146738f66 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -131,7 +131,7 @@ function member_type_prepare_head(AdherentType $object) // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) { - $head[$h][0] = DOL_URL_ROOT."/adherents/traduction.php?rowid=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/adherents/type_translation.php?rowid=".$object->id; $head[$h][1] = $langs->trans("Translation"); $head[$h][2] = 'translation'; $h++;