diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 00000000000..016129c7629 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,85 @@ +# .scrutinizer.yml +imports: + - javascript + - php + +filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + +tools: + # Similar code detection + php_sim: + enabled: true + min_mass: 16 + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + + # php_depend + php_pdepend: + enabled: true + configuration_file: null + suffixes: + - php + excluded_dirs: { } + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + + # php_analyzer + php_analyzer: + enabled: true + extensions: + - php + dependency_paths: { } + filter: + excluded_paths: + - 'build/*' + - 'dev/*' + - 'doc/*' + - 'test/*' + - 'htdocs/includes/*' + paths: { } + path_configs: { } + + # change tracking + php_changetracking: + enabled: true + 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: { } + + # Coding-Style / Bug Detection + js_hint: true + + +before_commands: { } +after_commands: { } +artifacts: { } +build_failure_conditions: { } diff --git a/ChangeLog b/ChangeLog index 0b70cbe719f..c81af41cfa2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -50,6 +50,8 @@ For users: - Fix: Project Task numbering customs rule works. - Fix: Add actions events not implemented. - 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 TODO - New: Predefined product and free product use same form. @@ -73,6 +75,9 @@ For developers: - New: Normalize code for barcode generation to match other modules. - New: Uniformize code for contacts forms. - New: Add some hooks for financial reports. +- New: A module can add its own ECM view. +- New: A module can disable a standard ECM view. +- New: Add multilang support into product webservice. WARNING: Following change may create regression for some external modules, but was necessary to make Dolibarr better: @@ -91,6 +96,10 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f ***** ChangeLog for 3.5.3 compared to 3.5.2 ***** Fix: Error on field accountancy code for export profile of invoices. +Fix: [ bug #1351 ] VIES verification link broken. +Fix: [ bug #1352 ] Removing a shipping does not remove the delivery. +Fix: Option MAIN_INVERT_SENDER_RECIPIENT broken with typhon template. + ***** ChangeLog for 3.5.2 compared to 3.5.1 ***** Fix: Can't add user for a task. 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_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/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index fc250cfe07a..37d8a6c04f8 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -107,6 +107,9 @@ class Categorie extends CommonObject $this->fetch_optionals($this->id,$extralabels); $this->db->free($resql); + + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); return 1; } @@ -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++; } } @@ -1458,6 +1468,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/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/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/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 004153e2fdc..b32c5d4cb75 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 @@ -1718,7 +1718,7 @@ 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') @@ -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 diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index a79cb494bd4..d8dc5a65e66 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -225,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/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 3ac6ce0eba1..416ee790282 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -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 '