diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 00000000000..a176c114cb8 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,189 @@ +# .scrutinizer.yml +imports: + - javascript + - php + +filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + +tools: + # php_analyzer. Doc on https://scrutinizer-ci.com/docs/tools/php/php-analyzer/ + php_analyzer: + enabled: true + extensions: + - php + dependency_paths: { } + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + config: + parameter_reference_check: + enabled: true + checkstyle: + enabled: false + no_trailing_whitespace: true + naming: + enabled: true + local_variable: ^[a-z][a-zA-Z0-9]*$ + abstract_class_name: ^Abstract|Factory$ + utility_class_name: Utils?$ + constant_name: ^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*$ + property_name: ^[a-z][a-zA-Z0-9]*$ + method_name: ^(?:[a-z]|__)[a-zA-Z0-9]*$ + parameter_name: ^[a-z][a-zA-Z0-9]*$ + interface_name: ^[A-Z][a-zA-Z0-9]*Interface$ + type_name: ^[A-Z][a-zA-Z0-9]*$ + exception_name: ^[A-Z][a-zA-Z0-9]*Exception$ + isser_method_name: ^(?:is|has|should|may|supports) + unreachable_code: + enabled: true + check_access_control: + enabled: true + typo_checks: + enabled: true + check_variables: + enabled: true + check_calls: + enabled: true + too_many_arguments: true + missing_argument: true + argument_type_checks: lenient # Allowed Values: "disabled", "lenient", "strict" + suspicious_code: + enabled: true + overriding_parameter: false + overriding_closure_use: true + parameter_closure_use_conflict: true + parameter_multiple_times: true + non_existent_class_in_instanceof_check: true + non_existent_class_in_catch_clause: true + assignment_of_null_return: true + non_commented_switch_fallthrough: true + non_commented_empty_catch_block: true + overriding_private_members: true + use_statement_alias_conflict: true + precedence_in_condition_assignment: true + dead_assignments: + enabled: true + verify_php_doc_comments: + enabled: false + parameters: true + return: true + suggest_more_specific_types: true + ask_for_return_if_not_inferrable: true + ask_for_param_type_annotation: true + loops_must_use_braces: + enabled: true + check_usage_context: + enabled: true + simplify_boolean_return: + enabled: false + phpunit_checks: + enabled: false + reflection_checks: + enabled: true + + # Checks Common Precedence Mistakes + precedence_checks: + enabled: true + assignment_in_condition: true + comparison_of_bit_result: true + basic_semantic_checks: + enabled: true + unused_code: + enabled: true + deprecation_checks: + enabled: true + useless_function_calls: + enabled: true + metrics_lack_of_cohesion_methods: + enabled: true + metrics_coupling: + enabled: true + stable_code: + namespace_prefixes: [] + classes: [] + doctrine_parameter_binding: + enabled: false + doctrine_entity_manager_injection: + enabled: false + symfony_request_injection: + enabled: false + doc_comment_fixes: + enabled: true + reflection_fixes: + enabled: false + use_statement_fixes: + enabled: true + remove_unused: true + # Whether you would like multiple imports in one USE statement to be preserved, e.g. ``use A, B;``. + preserve_multiple: false + # Whether you would like to preserve blank lines between use statements. + preserve_blanklines: false + order_alphabetically: false + # To use specific config for a specific path, use path_configs: (see example on page https://scrutinizer-ci.com/docs/configuration/tool_config_structure) + + # php_depend + php_pdepend: + enabled: false + configuration_file: null + suffixes: + - php + excluded_dirs: { } + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + + # change tracking + php_changetracking: + enabled: false + bug_patterns: + - '\bfix(?:es|ed)?\b' + feature_patterns: + - '\badd(?:s|ed)?\b' + - '\bimplement(?:s|ed)?\b' + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + + # Similar code detection + php_sim: + enabled: false + min_mass: 30 + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + + # Coding-Style / Bug Detection + js_hint: false + + +before_commands: { } +after_commands: { } +artifacts: { } +build_failure_conditions: { } diff --git a/ChangeLog b/ChangeLog index ad210c55c0f..892acc629a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,9 +43,15 @@ For users: - New: Can define custom fields for categories. - New: Prepare generation of SEPA files into module withdrawal. - New: Can filter on status for supplier order. +- New: Add option FACTURE_SENDBYEMAIL_FOR_ALL_STATUS to allow to send invoice by email + whatever is its status. +- New: Add filter date in bank writing list page. +- New: Extrafields can be used as substitution key %EXTRA_XXX% into emails texts for members. - Fix: Project Task numbering customs rule works. - Fix: Add actions events not implemented. -- New: Add filter date in bank writing list page +- Fix: Price min of composition is not supplier price min by quantity +- Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers +- New: Add categories translation - New: Enable option "clone target emailing" TODO diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 25a977692b9..c5b3a6a991a 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -369,6 +369,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/.git*`; $ret=`rm -fr $BUILDROOT/$PROJECT/.project`; $ret=`rm -fr $BUILDROOT/$PROJECT/.settings`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.scrutinizer.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.tx`; $ret=`rm -f $BUILDROOT/$PROJECT/build.xml`; diff --git a/doc/images/dolibarr_screenshot10.png b/doc/images/dolibarr_screenshot10.png deleted file mode 100644 index 125af3135fa..00000000000 Binary files a/doc/images/dolibarr_screenshot10.png and /dev/null differ diff --git a/doc/images/dolibarr_screenshot10_1280x800.png b/doc/images/dolibarr_screenshot10_1280x800.png new file mode 100644 index 00000000000..9a81f4c7f20 Binary files /dev/null and b/doc/images/dolibarr_screenshot10_1280x800.png differ diff --git a/doc/images/dolibarr_screenshot11.png b/doc/images/dolibarr_screenshot11.png deleted file mode 100755 index 26b417f0823..00000000000 Binary files a/doc/images/dolibarr_screenshot11.png and /dev/null differ diff --git a/doc/images/dolibarr_screenshot12.png b/doc/images/dolibarr_screenshot12.png deleted file mode 100755 index a71fb9bcaf6..00000000000 Binary files a/doc/images/dolibarr_screenshot12.png and /dev/null differ diff --git a/doc/images/dolibarr_screenshot5.png b/doc/images/dolibarr_screenshot5.png deleted file mode 100644 index 94e578a06a6..00000000000 Binary files a/doc/images/dolibarr_screenshot5.png and /dev/null differ diff --git a/doc/images/dolibarr_screenshot5_1280x800.png b/doc/images/dolibarr_screenshot5_1280x800.png new file mode 100644 index 00000000000..faa34e9589b Binary files /dev/null and b/doc/images/dolibarr_screenshot5_1280x800.png differ diff --git a/doc/images/dolibarr_screenshot6.png b/doc/images/dolibarr_screenshot6.png deleted file mode 100644 index ce44561aed6..00000000000 Binary files a/doc/images/dolibarr_screenshot6.png and /dev/null differ diff --git a/doc/images/dolibarr_screenshot7.png b/doc/images/dolibarr_screenshot7.png deleted file mode 100644 index f8620ce6d5a..00000000000 Binary files a/doc/images/dolibarr_screenshot7.png and /dev/null differ diff --git a/doc/images/dolibarr_screenshot7_1280x800.png b/doc/images/dolibarr_screenshot7_1280x800.png new file mode 100644 index 00000000000..8690afa6acf Binary files /dev/null and b/doc/images/dolibarr_screenshot7_1280x800.png differ diff --git a/doc/images/dolibarr_screenshot8.png b/doc/images/dolibarr_screenshot8.png deleted file mode 100644 index cb76e9650b7..00000000000 Binary files a/doc/images/dolibarr_screenshot8.png and /dev/null differ diff --git a/doc/images/dolibarr_screenshot8_1280x800.png b/doc/images/dolibarr_screenshot8_1280x800.png new file mode 100644 index 00000000000..ef2cc40e5ab Binary files /dev/null and b/doc/images/dolibarr_screenshot8_1280x800.png differ diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 9f93f0f1bda..c88257b8de3 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -368,7 +368,7 @@ abstract class ActionsAdherentCardCommon require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $login=dol_buildlogin($this->object->lastname, $this->object->firstname); - $generated_password=getRandomPassword(''); + $generated_password=getRandomPassword(false); $password=$generated_password; // Create a form array diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index f82f3005514..67016eae3e2 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -169,7 +169,7 @@ class Adherent extends CommonObject /** - * Make substitution + * Make substitution of tags into text with value of current object. * * @param string $text Text to make substitution to * @return string Value of input text string with substitutions done @@ -230,6 +230,12 @@ class Adherent extends CommonObject '%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town, '%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country, ); + // Add extrafields as substitution key %EXTRA_XXX% + foreach($this->array_options as $key => $val) + { + $keyshort=preg_replace('/^(options|extra)_/','',$key); + $substitutionarray['%EXTRA_'.$keyshort.'%']=$val; + } complete_substitutions_array($substitutionarray, $langs); @@ -819,7 +825,7 @@ class Adherent extends CommonObject if (! $password) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $password=getRandomPassword(''); + $password=getRandomPassword(false); } // Cryptage mot de passe diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 012a3b60bd0..549ca27e079 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -34,6 +34,8 @@ class Cotisation extends CommonObject public $table_element='cotisation'; var $id; + var $ref; + var $datec; var $datem; var $dateh; // Subscription start date diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 90e0abcfd4b..59791b5cad9 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -812,7 +812,7 @@ else if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $generated_password=getRandomPassword(''); + $generated_password=getRandomPassword(false); print ''.$langs->trans("Password").''; print ''; print ''; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index ae4b9eb35dd..4a80df017cb 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -38,7 +38,7 @@ $action=GETPOST('action','alpha'); $update=GETPOST('update','alpha'); $delete=GETPOST('delete'); // Do not use alpha here $debug=GETPOST('debug','int'); -$consts=GETPOST('const'); +$consts=GETPOST('const','array'); $constname=GETPOST('constname','alpha'); $constvalue=GETPOST('constvalue'); $constnote=GETPOST('constnote','alpha'); diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index ea3175d9277..f82551b57a5 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -270,7 +270,7 @@ print '
'; print '
'; print '
'; print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").'   '; -print '
'; +print '
'; // List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) $arrayoflabels=array(); foreach(array_keys($_Avery_Labels) as $codecards) @@ -284,7 +284,7 @@ print '
'; print '
'; print '
'; print $langs->trans("NumberOfStickers").'   '; -print '
'; +print '
'; print ''; print '
'; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index fc250cfe07a..5a30f8bafb6 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -103,11 +103,14 @@ class Categorie extends CommonObject $this->visible = $res['visible']; $this->type = $res['type']; $this->entity = $res['entity']; - + $this->fetch_optionals($this->id,$extralabels); $this->db->free($resql); + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); + return 1; } else @@ -191,7 +194,7 @@ class Categorie extends CommonObject if ($id > 0) { $this->id = $id; - + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('HookModuleNamedao')); @@ -278,7 +281,7 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::update sql=".$sql); if ($this->db->query($sql)) { - + // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('HookCategorydao')); @@ -296,10 +299,10 @@ class Categorie extends CommonObject } } else if ($reshook < 0) $error++; - + $this->db->commit(); - + // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); @@ -337,7 +340,7 @@ class Categorie extends CommonObject if (! $error) { $sql = "UPDATE ".MAIN_DB_PREFIX."categorie"; - $sql.= " SET fk_parent = ".$this->fk_parent; + $sql.= " SET fk_parent = ".$this->fk_parent; $sql.= " WHERE fk_parent = ".$this->id; if (!$this->db->query($sql)) @@ -767,14 +770,21 @@ class Categorie extends CommonObject */ function get_full_arbo($type,$markafterid=0) { + global $langs; + $this->cats = array(); // Init this->motherof that is array(id_son=>id_parent, ...) $this->load_motherof(); + $current_lang = $langs->getDefaultLang(); // Init $this->cats array $sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates + if (! empty($conf->global->MAIN_MULTILANGS)) + $sql.= ", t.label as label_trans, t.description as description_trans"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c"; + if (! empty($conf->global->MAIN_MULTILANGS)) + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; $sql.= " WHERE c.entity IN (".getEntity('category',1).")"; $sql.= " AND c.type = ".$type; @@ -788,8 +798,8 @@ class Categorie extends CommonObject $this->cats[$obj->rowid]['rowid'] = $obj->rowid; $this->cats[$obj->rowid]['id'] = $obj->rowid; $this->cats[$obj->rowid]['fk_parent'] = $obj->fk_parent; - $this->cats[$obj->rowid]['label'] = $obj->label; - $this->cats[$obj->rowid]['description'] = $obj->description; + $this->cats[$obj->rowid]['label'] = ! empty($obj->label_trans) ? $obj->label_trans : $obj->label; + $this->cats[$obj->rowid]['description'] = ! empty($obj->description_trans) ? $obj->description_trans : $obj->description; $i++; } } @@ -1045,63 +1055,6 @@ class Categorie extends CommonObject } - /** - * Affiche le chemin le plus court pour se rendre a un produit - * - * @param int $id Id of category - * @param string $type Type of category - * @return void - * @deprecated function not used ? - */ - function get_primary_way($id, $type="") - { - $primary_way = array("taille" => -1, "chemin" => array()); - $meres = $this->containing($id,$type); - foreach ($meres as $mere) - { - foreach ($mere->get_all_ways() as $way) - { - if(count($way) < $primary_way["taille"] || $primary_way["taille"] < 0) - { - $primary_way["taille"] = count($way); - $primary_way["chemin"] = $way; - } - } - } - return $primary_way["chemin"]; - - } - - /** - * Affiche le chemin le plus court pour se rendre a un produit - * - * @param int $id Id of category - * @param string $sep Separator - * @param string $url Url - * @param string $type Type - * @return void - * @deprecated function not used ? - */ - function print_primary_way($id, $sep= " >> ", $url="", $type="") - { - $primary_way = array(); - $way = $this->get_primary_way($id,$type); - $w = array(); - foreach ($way as $cat) - { - if ($url == '') - { - $w[] = "".$cat->label.""; - } - else - { - $w[] = "".$cat->label.""; - } - } - - return implode($sep, $w); - } - /** * Retourne un tableau contenant la liste des categories meres * @@ -1458,6 +1411,118 @@ class Categorie extends CommonObject $this->imgHeight = $infoImg[1]; // Hauteur de l'image } + /** + * Update ou cree les traductions des infos produits + * + * @return int <0 if KO, >0 if OK + */ + function setMultiLangs() + { + global $langs; + + $langs_available = $langs->get_available_languages(); + $current_lang = $langs->getDefaultLang(); + + foreach ($langs_available as $key => $value) + { + $sql = "SELECT rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."categorie_lang"; + $sql.= " WHERE fk_category=".$this->id; + $sql.= " AND lang='".$key."'"; + + $result = $this->db->query($sql); + + if ($key == $current_lang) + { + if ($this->db->num_rows($result)) // si aucune ligne dans la base + { + $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; + $sql2.= " SET label='".$this->db->escape($this->label)."',"; + $sql2.= " description='".$this->db->escape($this->description)."'"; + $sql2.= " WHERE fk_category=".$this->id." AND lang='".$key."'"; + } + else + { + $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; + $sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->label); + $sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; + } + dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2); + if (! $this->db->query($sql2)) + { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR); + return -1; + } + } + else if (isset($this->multilangs["$key"])) + { + if ($this->db->num_rows($result)) // si aucune ligne dans la base + { + $sql2 = "UPDATE ".MAIN_DB_PREFIX."categorie_lang"; + $sql2.= " SET label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; + $sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; + $sql2.= " WHERE fk_category=".$this->id." AND lang='".$key."'"; + } + else + { + $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; + $sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->multilangs["$key"]["label"]); + $sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; + } + + // on ne sauvegarde pas des champs vides + if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] ) + dol_syslog(get_class($this).'::setMultiLangs sql='.$sql2); + if (! $this->db->query($sql2)) + { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this).'::setMultiLangs error='.$this->error, LOG_ERR); + return -1; + } + } + } + return 1; + } + + /** + * Load array this->multilangs + * + * @return int <0 if KO, >0 if OK + */ + function getMultiLangs() + { + global $langs; + + $current_lang = $langs->getDefaultLang(); + + $sql = "SELECT lang, label, description"; + $sql.= " FROM ".MAIN_DB_PREFIX."categorie_lang"; + $sql.= " WHERE fk_category=".$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->multilangs["$obj->lang"]["label"] = $obj->label; + $this->multilangs["$obj->lang"]["description"] = $obj->description; + } + return 1; + } + else + { + $this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql; + return -1; + } + } /** * Initialise an instance with random values. diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index 64f526bcb3c..12eaa7e98f0 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -31,9 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->load("categories"); -$extrafields = new ExtraFields($db); -$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - // Security check $socid=GETPOST('socid','int'); if (!$user->rights->categorie->lire) accessforbidden(); @@ -64,6 +61,9 @@ if ($catorigin && $type == 0) $idCatOrigin = $catorigin; $object = new Categorie($db); +$extrafields = new ExtraFields($db); +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + /* * Actions */ @@ -244,7 +244,7 @@ if ($user->rights->categorie->creer) print ''.$langs->trans("AddIn").''; print $form->select_all_categories($type, $catorigin); print ''; - + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php new file mode 100644 index 00000000000..a6dadeb0e1c --- /dev/null +++ b/htdocs/categories/traduction.php @@ -0,0 +1,284 @@ + + * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2010-2012 Destailleur Laurent + * + * 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/categories.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + +$langs->load("categories"); +$langs->load("languages"); + +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action=GETPOST('action','alpha'); +$cancel=GETPOST('cancel','alpha'); +$type=GETPOST('type'); + +// Security check +$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); +$fieldtype = (! empty($ref) ? 'ref' : 'rowid'); + +if ($id == "") +{ + dol_print_error('','Missing parameter id'); + exit(); +} + +// Security check +$result = restrictedArea($user, 'categorie', $id, '&category'); + +$object = new Categorie($db); + + +/* + * Actions + */ + +// retour a l'affichage des traduction si annulation +if ($cancel == $langs->trans("Cancel")) +{ + $action = ''; +} + + +// Validation de l'ajout +if ($action == 'vadd' && +$cancel != $langs->trans("Cancel") && +($user->rights->categorie->creer )) +{ + $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"]); + } + else + { + $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; + $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); + } + + // sauvegarde en base + if ( $object->setMultiLangs() > 0 ) + { + $action = ''; + } + else + { + $action = 'add'; + $mesg = '
'.$object->error.'
'; + } +} + +// Validation de l'edition +if ($action == 'vedit' && +$cancel != $langs->trans("Cancel") && +($user->rights->categorie->creer)) +{ + $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]); + } + else + { + $object->multilangs[$key]["label"] = $_POST["libelle-".$key]; + $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); + } + } + + if ( $object->setMultiLangs() > 0 ) + { + $action = ''; + } + else + { + $action = 'edit'; + $mesg = '
'.$object->error.'
'; + } +} + +$result = $object->fetch($id,$ref); + + +/* + * View + */ + +llxHeader("","",$langs->trans("Translation")); + +$form = new Form($db); +$formadmin=new FormAdmin($db); + +if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); +elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); +elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); +elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); +elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); +else $title=$langs->trans("Category"); + +$head = categories_prepare_head($object,$type); +dol_fiche_head($head, 'translation', $title, 0, 'category'); + +if (! empty($mesg)) { + dol_htmloutput_mesg($mesg); +} + +print ''; + +// Reference +print ''; +print ''; +print ''; +print '
'.$langs->trans("Ref").''; +print $object->label; +print '
'; + +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) + { + print "
".$langs->trans('Language_'.$key)." :
"; + 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, 3, 80); + $doleditor->Create(); + print '
'; + } + } + + print '
'; + print '     '; + print '
'; + + print '
'; + +} +else +{ + $cnt_trans = 0; + if (! empty($object->multilangs)) + { + foreach ($object->multilangs as $key => $value) + { + $cnt_trans++; + $s=picto_from_langcode($key); + print "
".($s?$s.' ':'')." ".$langs->trans('Language_'.$key).":
"; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans('Label').''.$object->multilangs[$key]["label"].'
'.$langs->trans('Description').''.$object->multilangs[$key]["description"].'
'.$langs->trans('Note').''.$object->multilangs[$key]["note"].'
'; + } + } + if (! $cnt_trans) print '
'. $langs->trans('NoTranslation'); +} + +print "
\n"; + + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print "\n
\n"; + +if ($action == '') +if ($user->rights->produit->creer || $user->rights->service->creer) +{ + print ''.$langs->trans("Add").''; + print ''.$langs->trans("Update").''; +} + +print "\n
\n"; + + +/* + * Form to add a new translation + */ + +if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service->creer)) +{ + //WYSIWYG Editor + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + + print '
'; + print '
'; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print '
'.$langs->trans('Translation').''; + print $formadmin->select_language('','forcelangprod',0,$object->multilangs); + print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; + $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); + $doleditor->Create(); + print '
'; + + print '
'; + print '     '; + print '
'; + + print '
'; + + print '
'; +} + +llxFooter(); +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index ae05923bcce..9302b53d5bd 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1803,10 +1803,13 @@ if ($action == 'create') { if ($action != 'editline') { $var = true; - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + if ($conf->global->MAIN_FEATURES_LEVEL > 1) + { // Add free or predefined products/services $object->formAddObjectLine(1, $mysoc, $soc); - } else { + } + else + { // Add free products/services $object->formAddFreeProduct(1, $mysoc, $soc); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index fb35d337bac..d38052b684c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -200,7 +200,7 @@ class Propal extends CommonObject $line->remise_percent=$remise_percent; $line->tva_tx=$tva_tx; - $this->products[]=$line; + $this->lines[]=$line; } } @@ -1302,9 +1302,6 @@ class Propal extends CommonObject $soc = new Societe($this->db); $soc->fetch($this->socid); - // Class of company linked to propal - $result=$soc->set_as_client(); - // Define new ref if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref))) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 120d6e8e474..a14ba58e19e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2102,10 +2102,13 @@ if ($action == 'create' && $user->rights->commande->creer) { if ($action != 'editline') { $var = true; - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + if ($conf->global->MAIN_FEATURES_LEVEL > 1) + { // Add free or predefined products/services $object->formAddObjectLine(1, $mysoc, $soc); - } else { + } + else + { // Add free products/services $object->formAddFreeProduct(1, $mysoc, $soc); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d56f41763da..24e01023397 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3307,10 +3307,13 @@ if ($action == 'create') if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') { $var = true; - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + if ($conf->global->MAIN_FEATURES_LEVEL > 1) + { // Add free or predefined products/services $object->formAddObjectLine(1, $mysoc, $soc); - } else { + } + else + { // Add free products/services $object->formAddFreeProduct(1, $mysoc, $soc); @@ -3332,9 +3335,11 @@ if ($action == 'create') dol_fiche_end(); - // Boutons actions - if ($action != 'prerelance' && $action != 'presend' && $action != 'valid' && $action != 'editline') { + // Actions buttons + + if ($action != 'prerelance' && $action != 'presend' && $action != 'valid' && $action != 'editline') + { print '
'; $parameters = array(); @@ -3382,7 +3387,7 @@ if ($action == 'create') } // Send by mail - if (($object->statut == 1 || $object->statut == 2)) { + if (($object->statut == 1 || $object->statut == 2) || ! empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($objectidnext) { print '
' . $langs->trans('SendByMail') . '
'; } else { diff --git a/htdocs/compta/hrm.php b/htdocs/compta/hrm.php index d6b0d345010..b50eade0cf4 100644 --- a/htdocs/compta/hrm.php +++ b/htdocs/compta/hrm.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $langs->load('users'); $langs->load('holidays'); -$langs->load('tripss'); +$langs->load('trips'); // Protection if external user if ($user->societe_id > 0) accessforbidden(); @@ -61,7 +61,7 @@ $holidaystatic=new Holiday($db); llxHeader(array(),$langs->trans('HRMArea')); - +print_fiche_titre($langs->trans("HRMArea")); print '
'; @@ -106,11 +106,11 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) print '
'; - $max=10; $langs->load("boxes"); +// Last trips $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index a367dadeb7d..990a10c2500 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -179,8 +179,8 @@ $dolibarr_main_authentication='dolibarr'; // Parameters used to setup LDAP authentication. // Uncomment them if dolibarr_main_authentication = 'ldap' // -// $dolibarr_main_auth_ldap_host='127.0.0.1'; -// $dolibarr_main_auth_ldap_port='389'; +// $dolibarr_main_auth_ldap_host='127.0.0.1'; // You can define several servers here separated with a comma. +// $dolibarr_main_auth_ldap_port='389'; // Port // $dolibarr_main_auth_ldap_version='3'; // $dolibarr_main_auth_ldap_servertype='openldap'; // openldap, activedirectory or egroupware // $dolibarr_main_auth_ldap_login_attribute='loginfield'; // Ex: uid or samaccountname for active directory diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 0b65d2b2db8..b95f9113180 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -400,7 +400,7 @@ abstract class ActionsContactCardCommon require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $login=dol_buildlogin($this->object->lastname, $this->object->firstname); - $generated_password=getRandomPassword(''); + $generated_password=getRandomPassword(false); $password=$generated_password; // Create a form array diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 7724806f5c2..98874ba4804 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -749,7 +749,7 @@ else $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); print $doleditor->Create(1); print ''; - + // Note Private print ''.$langs->trans("NotePrivate").''; $doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70); @@ -843,7 +843,7 @@ else if (! $ldap_sid) // TODO ldap_sid ? { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $generated_password=getRandomPassword(''); + $generated_password=getRandomPassword(false); } $password=$generated_password; @@ -971,7 +971,7 @@ else print ''.$langs->trans("NotePublic").''; print nl2br($object->note_public); print ''; - + // Note Private print ''.$langs->trans("NotePrivate").''; print nl2br($object->note_private); @@ -1067,9 +1067,9 @@ else print ''.$langs->trans("DisableUser").''; } } - + print "

"; - + print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'',''); print show_actions_todo($conf,$langs,$db,$objsoc,$object); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index cfeab2f7fc8..4c0873d73aa 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -1140,8 +1140,7 @@ else print ''.$langs->trans("PriceUHT").''; print ''.$langs->trans("Qty").''; print ''.$langs->trans("ReductionShort").''; - if ($conf->margin->enabled) - print ''.$langs->trans("BuyingPrice").''; + if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print ''.$langs->trans("BuyingPrice").''; print ' '; print "\n"; @@ -1186,8 +1185,8 @@ else print ' '; } - if ($conf->margin->enabled) - print ''.price($objp->pa_ht).''; + // Margin + if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print ''.price($objp->pa_ht).''; // Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme) print ''; @@ -1292,9 +1291,13 @@ else print ''; print '
'; print ''; + + $colspan=5; + if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) $colspan++; + // Ligne dates prevues print ""; - print ''; + print ''; print $langs->trans("DateStartPlanned").' '; $form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update"); print '
'.$langs->trans("DateEndPlanned").' '; @@ -1644,9 +1647,9 @@ else } print "
"; - print '
'; } + print ''; print ''; diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 13fbe768d5d..ca47f144cdb 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -1,9 +1,9 @@ - * Copyright (C) 2012 Xavier Peyronnet - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2013 Laurent Destailleur +/* Copyright (C) 2012 Nicolas Péré + * Copyright (C) 2012 Xavier Peyronnet + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2013-2014 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 @@ -44,10 +44,10 @@ require_once '../../main.inc.php'; // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); + // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); @@ -59,16 +59,13 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='amarok'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } -// Define image path files +// Define image path files and other constants $fontlist='helvetica,arial,tahoma,verdana'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; -//'/theme/auguria/img/menus/trtitle.png'; $img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $dol_hide_topmenu=$conf->dol_hide_topmenu; @@ -112,8 +109,8 @@ $colorbacklinepair2='255,255,255'; // line pair $colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); $colorbackbody='#f5f5f5'; $colortext='40,40,40'; -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'14'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'14'; +$fontsize='12'; +$fontsizesmaller='11'; $colorback1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorback1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorback1:$user->conf->THEME_ELDY_TOPMENU_BACK1); $colorback2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK2)?$colorback2:$conf->global->THEME_ELDY_TOPMENU_BACK2) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK2)?$colorback2:$user->conf->THEME_ELDY_TOPMENU_BACK2); @@ -575,8 +572,6 @@ div.login_block table { div.login { white-space:nowrap; - /* padding: dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px; */ - /* margin:0px 0px 0px 8px; */ font-weight:bold; float: right; } @@ -591,7 +586,6 @@ div.login { } img.login, img.printer, img.entity { - /* padding: dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px; */ margin:2px 0px 0px 0px; text-decoration:none; color: white; diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 7cfc8e57b2c..e363537ad01 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2011 Regis Houssin * Copyright (C) 2012 Juanjo Menent @@ -38,10 +38,13 @@ session_cache_limiter(FALSE); require_once '../../main.inc.php'; +// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) +if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); + + // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); @@ -53,28 +56,26 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='auguria'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } -// Define image path files +// Define image path files and other constants $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; - +$img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); +$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); +$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; $dol_no_mouse_hover=$conf->dol_no_mouse_hover; $dol_use_jmobile=$conf->dol_use_jmobile; -$img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); -$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); -$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); - $colorbacklineimpairhover='210,214,217'; $colorbacklinepairhover='210,214,217'; +$fontsize='12'; +$fontsizesmaller='11'; // No hover by default, we keep only if we set var THEME_ELDY_USE_HOVER if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf->THEME_ELDY_USE_HOVER)) @@ -96,6 +97,7 @@ print 'colorbacklineimpairhover='.$colorbacklineimpairhover."\n"; print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; print '*/'."\n"; +if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; ?> /* ============================================================================== */ @@ -242,6 +244,7 @@ div.inline-block .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } +.maxwidth200onsmartphone { max-width: 200px; } .linkobject { cursor: pointer; } diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 9e5b56b753b..c67d3f90d85 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2010 Regis Houssin * Copyright (C) 2011 Philippe Grand @@ -43,10 +43,13 @@ session_cache_limiter(FALSE); require_once '../../main.inc.php'; +// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) +if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); + + // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); @@ -58,18 +61,14 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='bureau2crea'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } -// Define image path files +// Define image path files and other constants $fontlist='arial, sans-serif, verdana, helvetica'; -//$fontlist='Verdana,Helvetica,Arial,sans-serif'; - $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; @@ -77,6 +76,10 @@ $dol_no_mouse_hover=$conf->dol_no_mouse_hover; $dol_use_jmobile=$conf->dol_use_jmobile; $colorshadowtitle='000'; +$fontsize='12'; +$fontsizesmaller='11'; + +if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; ?> /* ============================================================================== */ @@ -266,6 +269,7 @@ div.inline-block .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } +.maxwidth200onsmartphone { max-width: 200px; } .linkobject { cursor: pointer; } diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 23e97ed2c6b..ac72ab2f3f5 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2011 Regis Houssin * Copyright (C) 2010-2011 Herve Prot @@ -20,7 +20,7 @@ */ /** - * \file htdocs/theme/eldy/style.css.php + * \file htdocs/theme/cameleo/style.css.php * \brief Fichier de style CSS du theme Cameleo */ @@ -39,27 +39,27 @@ session_cache_limiter(FALSE); require_once '../../main.inc.php'; +// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) +if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); + + // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); // On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1. if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); } -if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL -if (! empty($_GET["theme"])) $conf->theme=$_GET["theme"]; // If theme was forced on URL +if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL +if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on URL $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; +// Define image path files and other constants $fontlist='arial,tahoma,verdana,helvetica'; -//$fontlist='Verdana,Helvetica,Arial,sans-serif'; - $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; @@ -71,6 +71,10 @@ $theme='cameleo'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } $colorshadowtitle='000'; +$fontsize='12'; +$fontsizesmaller='11'; + +if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; ?> /* ============================================================================== */ @@ -241,6 +245,7 @@ div.inline-block .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } +.maxwidth200onsmartphone { max-width: 200px; } .linkobject { cursor: pointer; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e4ff22532cc..a7eb25cc768 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2011 Philippe Grand @@ -45,8 +45,7 @@ if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSI // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); @@ -58,14 +57,12 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='eldy'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } -// Define image path files +// Define image path files and other constants $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; $img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); @@ -108,11 +105,10 @@ $colorbacklineimpairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+roun $colorbacklinepair1='255,255,255'; // line pair $colorbacklinepair2='255,255,255'; // line pair $colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); -//$colorbackbody='#ffffff url('.$img_head.') 0 0 no-repeat;'; $colorbackbody='#fcfcfc'; $colortext='40,40,40'; -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'14'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'14'; +$fontsize='12'; +$fontsizesmaller='11'; // Eldy colors if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) @@ -183,7 +179,7 @@ if ($tmpval <= 360) { $colortextbackvmenu='FFF'; } else { $colortextbackvmenu='444'; } $tmppart=explode(',',$colorbacktitle1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); -if ($tmpval <= 360) { $colortexttitle='FFF'; $colorshadowtitle='000'; } +if ($tmpval <= 360) { $colortexttitle='FFF'; $colorshadowtitle='888'; } else { $colortexttitle='444'; $colorshadowtitle='FFF'; } $tmppart=explode(',',$colorbacktabcard1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); @@ -408,6 +404,7 @@ th .button { .hideonsmartphone { display: none; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone { max-width: 100px; } +.maxwidth200onsmartphone { max-width: 200px; } .linkobject { cursor: pointer; } @@ -604,8 +601,10 @@ li.tmenu, li.tmenusel { text-align: center; vertical-align: bottom; + global->MAIN_MENU_INVERT)) { ?> float: ; height: px; + position:relative; display: block; padding: 0px 0px 2px 0px; @@ -856,7 +855,7 @@ form#login { } div#login_left, div#login_right { display: inline-block; - min-width: 250px; + min-width: 245px; padding-top: 10px; text-align: center; vertical-align: middle; @@ -886,8 +885,6 @@ div.login_block table { } div.login { white-space:nowrap; - /* padding: dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px; */ - /* margin: 0px 0px 0px 8px; */ font-weight: bold; float: right; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3241f6dbc12..2ff681b8fe4 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1356,7 +1356,7 @@ class User extends CommonObject // If new password not provided, we generate one if (! $password) { - $password=getRandomPassword(''); + $password=getRandomPassword(false); } // Crypte avec md5 diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 0ae409ca8fe..ba851ea3840 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -748,7 +748,7 @@ if (($action == 'create') || ($action == 'adduserldap')) if (empty($ldap_sid)) // ldap_sid is for activedirectory { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $generated_password=getRandomPassword(''); + $generated_password=getRandomPassword(false); } $password=$generated_password; diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 87c1c829ee4..dbbde72cb34 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -303,7 +303,7 @@ $server->register( * @param int $id Id of object * @param string $ref Ref of object * @param ref_ext $ref_ext Ref external of object - * @param $lang $lang Force lang + * @param string $lang Lang to force * @return mixed */ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='') @@ -312,6 +312,9 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' dol_syslog("Function: getProductOrService login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); + $langcode=($lang?$lang:(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT)); + $langs->setDefaultLang($langcode); + if ($authentication['entity']) $conf->entity=$authentication['entity']; // Init and check authentication @@ -347,6 +350,10 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' $pdir = get_exdir($product->id,2) . $product->id ."/photos/"; $dir = $dir . '/'. $pdir; + if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"]; + if (! empty($product->multilangs[$langs->defaultlang]["description"])) $product->description = $product->multilangs[$langs->defaultlang]["description"]; + if (! empty($product->multilangs[$langs->defaultlang]["note"])) $product->note = $product->multilangs[$langs->defaultlang]["note"]; + // Create $objectresp = array( 'result'=>array('result_code'=>'OK', 'result_label'=>''), @@ -707,16 +714,20 @@ function getListOfProductsOrServices($authentication,$filterproduct) /** - * getProductsForCategory + * Get list of products for a category * * @param array $authentication Array of authentication information * @param array $id Category id * @param $lang $lang Force lang * @return array Array result - */function getProductsForCategory($authentication,$id,$lang='') + */ +function getProductsForCategory($authentication,$id,$lang='') { global $db,$conf,$langs; + $langcode=($lang?$lang:(empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT)); + $langs->setDefaultLang($langcode); + dol_syslog("Function: getProductsForCategory login=".$authentication['login']." id=".$id); if ($authentication['entity']) $conf->entity=$authentication['entity']; @@ -773,11 +784,11 @@ function getListOfProductsOrServices($authentication,$filterproduct) 'id' => $obj->id, 'ref' => $obj->ref, 'ref_ext' => $obj->ref_ext, - 'label' => $obj->label, - 'description' => $obj->description, + 'label' => ! empty($obj->multilangs[$langs->defaultlang]["label"]) ? $obj->multilangs[$langs->defaultlang]["label"] : $obj->label, + 'description' => ! empty($obj->multilangs[$langs->defaultlang]["description"]) ? $obj->multilangs[$langs->defaultlang]["description"] : $obj->description, 'date_creation' => dol_print_date($obj->date_creation,'dayhourrfc'), 'date_modification' => dol_print_date($obj->date_modification,'dayhourrfc'), - 'note' => $obj->note, + 'note' => ! empty($obj->multilangs[$langs->defaultlang]["note"]) ? $obj->multilangs[$langs->defaultlang]["note"] : $obj->note, 'status_tosell' => $obj->status, 'status_tobuy' => $obj->status_buy, 'type' => $obj->type,
'; /* diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 55e0d1c27b5..9a5ecd3562c 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -60,7 +60,7 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[ $row->table_element_line = $table_element_line; $row->fk_element = $fk_element; $row->id = $element_id; - $result=$row->line_ajaxorder($newrowordertab); + $row->line_ajaxorder($newrowordertab); // Reorder line to have position of chilren lines sharing same counter than parent lines // This should be useless because there is no need to have children sharing same counter that parent. diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index e51e3d3288f..26ecd1247e8 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -64,7 +64,7 @@ class box_factures_fourn extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.nom, s.rowid as socid,"; - $sql.= " f.rowid as facid, f.ref_supplier, f.amount,"; + $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.amount,"; $sql.= " f.paye, f.fk_statut,"; $sql.= ' f.datef as df,'; $sql.= ' f.datec as datec,'; @@ -102,25 +102,29 @@ class box_factures_fourn extends ModeleBoxes 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->ref_supplier, + 'text' => ($objp->ref?$objp->ref:$objp->facid), 'text2'=> $late, 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', + $this->info_box_contents[$i][2] = array('td' => 'align="left"', + 'text' => $objp->ref_supplier, + 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); + + $this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', + $this->info_box_contents[$i][4] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', + $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => dol_print_date($datec,'day')); $fac = new FactureFournisseur($db); $fac->fetch($objp->facid); $alreadypaid=$fac->getSommePaiement(); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type)); $i++; diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index ebe2f897b77..316ee7b086a 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -61,7 +61,7 @@ class box_factures_fourn_imp extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.nom, s.rowid as socid,"; - $sql.= " f.rowid as facid, f.ref_supplier, f.date_lim_reglement as datelimite,"; + $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,"; $sql.= " f.amount, f.datef as df,"; $sql.= " f.paye, f.fk_statut, f.type"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -98,25 +98,29 @@ class box_factures_fourn_imp extends ModeleBoxes 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->ref_supplier, + 'text' => ($objp->ref?$objp->ref:$objp->facid), 'text2'=> $late, 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', + $this->info_box_contents[$i][2] = array('td' => 'align="left"', + 'text' => $objp->ref_supplier, + 'url' => DOL_URL_ROOT."/fourn/facture/fiche.php?facid=".$objp->facid); + + $this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"', 'logo' => 'company', 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', + $this->info_box_contents[$i][4] = array('td' => 'align="left"', 'text' => $objp->nom, 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', + $this->info_box_contents[$i][5] = array('td' => 'align="right"', 'text' => dol_print_date($datelimite,'day')); $fac = new FactureFournisseur($db); $fac->fetch($objp->facid); $alreadypaid=$fac->getSommePaiement(); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type)); $i++; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 5fa752d9619..18b9cfb9b4f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -92,11 +92,11 @@ class CMailFile * @param array $mimetype_list List of MIME type of attached files * @param array $mimefilename_list List of attached file name in message * @param string $addr_cc Email cc - * @param string $addr_bcc Email bcc - * @param int $deliveryreceipt Ask a delivery receipt - * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection - * @param string $errors_to Email errors - * @param string $css Css option + * @param string $addr_bcc Email bcc (Note: This is autocompleted with MAIN_MAIL_AUTOCOPY_TO if defined) + * @param int $deliveryreceipt Ask a delivery receipt + * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown make autodetection (with fast mode, not reliable) + * @param string $errors_to Email errors + * @param string $css Css option */ function __construct($subject,$to,$from,$msg, $filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(), diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index af39da58cf7..1b290222a11 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -62,7 +62,7 @@ abstract class CommonDocGenerator 'myuser_fax'=>$user->office_fax, 'myuser_mobile'=>$user->user_mobile, 'myuser_email'=>$user->email, - 'myuser_logo'=>$logotouse, + 'myuser_logo'=>$user->photo, 'myuser_web'=>'' // url not exist in $user object ); } @@ -139,7 +139,7 @@ abstract class CommonDocGenerator { $object->country=$outputlangs->transnoentitiesnoconv("Country".$object->country_code); } - if (empty($mysoc->state) && ! empty($mysoc->state_code)) + if (empty($object->state) && ! empty($object->state_code)) { $object->state=getState($object->state_code,0); } @@ -418,7 +418,7 @@ abstract class CommonDocGenerator * @param Object $object Object with extrafields (must have $object->array_options filled) * @param array $array_to_fill Substitution array * @param Extrafields $extrafields Extrafields object - * @param array_key $array_key Name of the key for return array + * @param string $array_key Name of the key for return array * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 0314bf34413..5c9d6257fb9 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -253,6 +253,7 @@ abstract class CommonInvoice extends CommonObject } if ($mode == 4) { + $prefix=''; if (! $paye) { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ba4094c2a14..3835f7cb07e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -47,8 +47,8 @@ abstract class CommonObject public $array_options=array(); - public $linkedObjectsIds; - public $linkedObjects; + public $linkedObjectsIds; // Loaded by ->fetchObjectLinked + public $linkedObjects; // Loaded by ->fetchObjectLinked // No constructor as it is an abstract class @@ -83,10 +83,10 @@ abstract class CommonObject if (empty($firstname)) $firstname=$this->firstname; $ret=''; - if ($option && $this->civilite_id) + if ($option && $this->civility_id) { - if ($langs->transnoentitiesnoconv("Civility".$this->civilite_id)!="Civility".$this->civilite_id) $ret.=$langs->transnoentitiesnoconv("Civility".$this->civilite_id).' '; - else $ret.=$this->civilite_id.' '; + if ($langs->transnoentitiesnoconv("Civility".$this->civility_id)!="Civility".$this->civility_id) $ret.=$langs->transnoentitiesnoconv("Civility".$this->civility_id).' '; + else $ret.=$this->civility_id.' '; } $ret.=dolGetFirstLastname($firstname, $lastname, $nameorder); @@ -241,8 +241,8 @@ abstract class CommonObject /** * Copy contact from one element to current * - * @param int $objFrom Source element - * @param int $source Nature of contact ('internal' or 'external') + * @param CommonObject $objFrom Source element + * @param string $source Nature of contact ('internal' or 'external') * @return int >0 if OK, <0 if KO */ function copy_linked_contact($objFrom, $source='internal') @@ -1718,10 +1718,10 @@ abstract class CommonObject * @param string $sourcetype Object source type * @param int $targetid Object target id * @param string $targettype Object target type - * @param string $clause OR, AND clause + * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided * @return void */ - function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') + function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') { global $conf; @@ -2278,7 +2278,7 @@ abstract class CommonObject */ function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='') { - global $_POST; + global $_POST, $conf; $out = ''; @@ -2392,7 +2392,8 @@ abstract class CommonObject /** - * Function to check if an object is used by others + * Function to check if an object is used by others. + * Check is done into this->childtables. There is no check into llx_element_element. * * @param int $id Id of object * @return int <0 if KO, 0 if not used, >0 if already used @@ -2482,7 +2483,7 @@ abstract class CommonObject $i=0; while ($i < $num) { - $obj = $this->db->fetch_object($query); + $obj = $this->db->fetch_object($resql); $pu_ht = $obj->pu_ht; $qty= $obj->qty; @@ -2692,13 +2693,12 @@ abstract class CommonObject /** * Show add free products/services form * TODO Edit templates to use global variables and include them directly in controller call - * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. + * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * - * @param int $dateSelector 1=Show also date range input fields + * @param int $dateSelector 1=Show also date range input fields (start and end date) * @param Societe $seller Object thirdparty who sell * @param Societe $buyer Object thirdparty who buy * @return void - * @deprecated */ function formAddFreeProduct($dateSelector,$seller,$buyer) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e9b2728ad3f..d8dc5a65e66 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -119,6 +119,8 @@ class Conf */ function setValues($db) { + global $conf; + dol_syslog(get_class($this)."::setValues"); /* @@ -223,22 +225,6 @@ class Conf if ($ret) $mc = new ActionsMulticompany($db); } - // Second or others levels object - $this->propal->cloture = new stdClass(); - $this->propal->facturation = new stdClass(); - $this->commande->client = new stdClass(); - $this->commande->fournisseur = new stdClass(); - $this->facture->client = new stdClass(); - $this->facture->fournisseur = new stdClass(); - $this->fournisseur->commande = new stdClass(); - $this->fournisseur->facture = new stdClass(); - $this->contrat->services = new stdClass(); - $this->contrat->services->inactifs = new stdClass(); - $this->contrat->services->expires = new stdClass(); - $this->adherent->cotisation = new stdClass(); - $this->bank->rappro = new stdClass(); - $this->bank->cheque = new stdClass(); - // Clean some variables if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_menu.php"; if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_menu.php"; diff --git a/htdocs/core/class/cookie.class.php b/htdocs/core/class/cookie.class.php index a45aaeb2423..5d3d5352626 100644 --- a/htdocs/core/class/cookie.class.php +++ b/htdocs/core/class/cookie.class.php @@ -34,7 +34,7 @@ class DolCookie var $myExpire; var $myPath; var $myDomain; - var $mySsecure; + var $mySecure; var $cookiearray; var $cookie; @@ -80,7 +80,7 @@ class DolCookie /** * Decrypt the cookie * - * @return void + * @return string */ function decryptCookie() { @@ -144,4 +144,4 @@ class DolCookie } -?> \ No newline at end of file +?> diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index ede7615a65a..78c0add9aab 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -188,7 +188,7 @@ class DiscountAbsolute // Check if we can remove the discount if ($this->fk_facture_source) { - $sql.="SELECT COUNT(rowid) as nb"; + $sql="SELECT COUNT(rowid) as nb"; $sql.=" FROM ".MAIN_DB_PREFIX."societe_remise_except"; $sql.=" WHERE (fk_facture_line IS NOT NULL"; // Not used as absolute simple discount $sql.=" OR fk_facture IS NOT NULL)"; // Not used as credit note and not used as deposit diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 926f5c42b42..768741d9368 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -126,7 +126,7 @@ class dolprintIPP */ function list_jobs($module) { - global $conf,$db; + global $conf, $db, $bc; include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; $ipp = new CupsPrintIPP(); $ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index a980b4bef85..93cd55e31ca 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -207,16 +207,16 @@ class ExtraFields /** * Add description of a new optional attribute * - * @param string $attrname code of attribute - * @param string $label label of attribute - * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float') - * @param int $pos Position of attribute - * @param int $size Size/length of attribute - * @param string $elementtype Element type ('member', 'product', 'company', ...) - * @param int $unique Is field unique or not - * @param int $required Is field required or not - * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) - * @return int <=0 if KO, >0 if OK + * @param string $attrname code of attribute + * @param string $label label of attribute + * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float') + * @param int $pos Position of attribute + * @param int $size Size/length of attribute + * @param string $elementtype Element type ('member', 'product', 'company', ...) + * @param int $unique Is field unique or not + * @param int $required Is field required or not + * @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) + * @return int <=0 if KO, >0 if OK */ private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='') { @@ -581,7 +581,7 @@ class ExtraFields */ function showInputField($key,$value,$moreparam='',$keyprefix='') { - global $conf,$langs; + global $conf,$langs,$db; $label=$this->attribute_label[$key]; $type =$this->attribute_type[$key]; diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 910ad55e0a0..b5483139fb6 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -558,7 +558,8 @@ class FileUpload isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ? $upload['name'] : null), isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ? $upload['size'] : null), isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ? $upload['type'] : null), - isset($upload['error']) ? $upload['error'] : null + isset($upload['error']) ? $upload['error'] : null, + 0 ); } header('Vary: Accept'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0943bce1e87..0c5fe571eda 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3160,7 +3160,7 @@ class Form */ function form_contacts($page, $societe, $selected='', $htmlname='contactidp') { - global $langs; + global $langs, $conf; if ($htmlname != "none") { diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 6d570b70880..cf23a0871a5 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -199,9 +199,9 @@ class FormAdmin /** * Return combo list of available menu families * - * @param string $selected Menu pre-selected - * @param string $htmlname Name of html select - * @param string $dirmenuarray Directories to scan + * @param string $selected Menu pre-selected + * @param string $htmlname Name of html select + * @param string[] $dirmenuarray Directories to scan * @return void */ function select_menu_families($selected, $htmlname, $dirmenuarray) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5317d49c23c..334fb9a5d9e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -257,8 +257,7 @@ class FormFile */ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='') { - global $langs,$conf,$hookmanager; - global $bc; + global $langs,$conf,$hookmanager,$user,$bc; // filedir = $conf->...->dir_ouput."/".get_exdir(id) include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a76877c9994..b2c91087916 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -58,7 +58,8 @@ class FormMail var $withreplytoreadonly; var $withtoreadonly; var $withtoccreadonly; - var $withtopicreadonly; + var $withtocccreadonly; + var $withtopicreadonly; var $withfilereadonly; var $withdeliveryreceipt; var $withcancel; @@ -95,6 +96,7 @@ class FormMail $this->withreplytoreadonly=1; $this->withtoreadonly=0; $this->withtoccreadonly=0; + $this->withtocccreadonly=0; $this->witherrorstoreadonly=0; $this->withtopicreadonly=0; $this->withfilereadonly=0; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 916f2cbcd9a..416ee790282 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -391,7 +391,7 @@ class FormOther $moreinfo=0; if (! empty($conf->global->MAIN_SHOW_LOGIN)) { - $out.=($moreinfo?' - ':' (').$obj->login; + $moreforfilter.=($moreinfo?' - ':' (').$obj_usr->login; $moreinfo++; } if ($showstatus >= 0) @@ -424,16 +424,17 @@ class FormOther /** * Return list of project and tasks * - * @param int $selectedtask Pre-selected task - * @param int $projectid Project id - * @param string $htmlname Name of html select - * @param int $modeproject 1 to restrict on projects owned by user - * @param int $modetask 1 to restrict on tasks associated to user - * @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists - * @param int $useempty 0=Allow empty values + * @param int $selectedtask Pre-selected task + * @param int $projectid Project id + * @param string $htmlname Name of html select + * @param int $modeproject 1 to restrict on projects owned by user + * @param int $modetask 1 to restrict on tasks associated to user + * @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists + * @param int $useempty 0=Allow empty values + * @param int $disablechildoftaskid 1=Disable task that are child of the provided task id * @return void */ - function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0) + function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0) { global $user, $langs; @@ -448,7 +449,7 @@ class FormOther if ($useempty) print ''; $j=0; $level=0; - $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid); + $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid, $disablechildoftaskid); print ''; } else @@ -458,17 +459,18 @@ class FormOther } /** - * Write all lines of a project (if parent = 0) + * Write lines of a project (all lines of a project if parent = 0) * * @param int &$inc Cursor counter - * @param int $parent Id parent - * @param Object $lines Line object + * @param int $parent Id of parent task we want to see + * @param array $lines Array of task lines * @param int $level Level * @param int $selectedtask Id selected task * @param int $selectedproject Id selected project + * @param int $disablechildoftaskid 1=Disable task that are child of the provided task id * @return void */ - private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0) + private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0, $disablechildoftaskid=0) { global $langs, $user, $conf; @@ -481,12 +483,12 @@ class FormOther { $var = !$var; - //var_dump($selectedtask."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); + //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // Break on a new project - if ($parent == 0) + if ($parent == 0) // We are on a task at first level { - if ($lines[$i]->fk_project != $lastprojectid) + if ($lines[$i]->fk_project != $lastprojectid) // Break found on project { if ($i > 0 && $conf->browser->firefox) print ''; print '