From 9cf67c4d5f63a2434238809ac5f6af64cc49cb4a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 30 Aug 2018 01:13:06 +0200 Subject: [PATCH 01/23] fix multicompany in public ticket page --- htdocs/public/ticket/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index bb0499f43e6..0c68302278b 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -25,6 +25,12 @@ if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_numeric($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php'; From e512f1082fe0a46f1d4cacf2aa946d5c3bc6b0d0 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 30 Aug 2018 02:33:22 +0200 Subject: [PATCH 02/23] Fix multicompany we can need to use multicompany with evry modulepart ex. newpayment.php, ticket, onlinesign... --- htdocs/viewimage.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 45cbcd1c6a5..dbe76ae49c4 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -56,11 +56,12 @@ if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias')) if (! defined("NOLOGIN")) define("NOLOGIN",1); if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",1); // We accept to go on this page from external web site. if (! defined("NOIPCHECK")) define("NOIPCHECK",1); // Do not check IP defined into conf $dolibarr_main_restrict_ip - // For multicompany - $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); - if (is_numeric($entity)) define("DOLENTITY", $entity); } +// For multicompany +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_numeric($entity)) define("DOLENTITY", $entity); + /** * Header empty * From d2859276b57530842cb4e3946a25cfaaee41ceae Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 30 Aug 2018 02:35:42 +0200 Subject: [PATCH 03/23] add logo with multicompany this fix push entity to viewimage.php --- htdocs/public/payment/newpayment.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 45aeb0d1321..55882e3d4f9 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -682,12 +682,12 @@ else if (! empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall=$conf->global-> $urllogo=''; if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('thumbs/'.$logosmall); $width=150; } elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode($logo); $width=150; } // Output html code for logo From fc804d8eebb03151772f7c60d21757835160ccee Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 30 Aug 2018 02:37:11 +0200 Subject: [PATCH 04/23] Fix image if multicompany + no login in onlinesign --- htdocs/public/onlinesign/newonlinesign.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 7571f466c46..9535ae16583 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -180,11 +180,11 @@ else if (! empty($conf->global->ONLINE_SIGN_LOGO)) $logosmall=$conf->global->ONL $urllogo=''; if (! empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('thumbs/'.$logosmall); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('thumbs/'.$logosmall); } elseif (! empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode($logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode($logo); $width=96; } // Output html code for logo From 7a6df60cb0b2c3bc202e01a8035e033b3cd5b598 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 30 Aug 2018 02:38:50 +0200 Subject: [PATCH 05/23] header/footer uniformization in ticket public page --- htdocs/public/ticket/index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index bb0499f43e6..68c88459222 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'other', 'ticket', 'errors')); @@ -64,5 +65,8 @@ if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { } // End of page -llxFooter(); +htmlPrintOnlinePaymentFooter($mysoc,$langs,1,$suffix,$object); + +llxFooter('', 'public'); + $db->close(); From de73f1545fca54ab7efbc8eef21fcd870702c357 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 30 Aug 2018 02:42:14 +0200 Subject: [PATCH 06/23] fix multicompany and footer - fix viewimage and multicompany + no login - delete ticket footer for common payment.lib.php footer --- htdocs/core/lib/ticket.lib.php | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 6ae66803c39..19e8cb3002f 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -160,9 +160,9 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ $urllogo = DOL_URL_ROOT . '/theme/login_logo.png'; if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) { - $urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&modulepart=companylogo&file=' . urlencode('thumbs/' . $mysoc->logo_small); + $urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file=' . urlencode('thumbs/' . $mysoc->logo_small); } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) { - $urllogo = DOL_URL_ROOT . '/viewimage.php?cache=1&modulepart=companylogo&file=' . urlencode($mysoc->logo); + $urllogo = DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file=' . urlencode($mysoc->logo); $width = 128; } elseif (is_readable(DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.png')) { $urllogo = DOL_URL_ROOT . '/theme/dolibarr_logo.png'; @@ -175,20 +175,3 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; } - -/** - * Show footer for new member - * - * @return void - */ -function llxFooterTicket() -{ - print '
'; - - printCommonFooter('public'); - - dol_htmloutput_events(); - - print "\n"; - print "\n"; -} From 302179c73995a0278d906b9d6f8db1d23e01b836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Aug 2018 08:10:51 +0200 Subject: [PATCH 07/23] Create index.html --- htdocs/stripe/class/index.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 htdocs/stripe/class/index.html diff --git a/htdocs/stripe/class/index.html b/htdocs/stripe/class/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/stripe/class/index.html @@ -0,0 +1 @@ + From 8af6c170ff4d261a4e13601d360ce6d84c3fc135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 30 Aug 2018 12:19:54 +0200 Subject: [PATCH 08/23] restore build badge for develop --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5feec47e56f..b68e8b65558 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DOLIBARR ERP & CRM -![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/8.0.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) +![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…). From 49729c311836e3edc79b926115b846fec52fd3bc Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 30 Aug 2018 13:54:10 +0200 Subject: [PATCH 09/23] Add shipping_method label --- htdocs/expedition/class/expedition.class.php | 21 +++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index a4bcfeb2281..f56689cd461 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -476,10 +476,12 @@ class Expedition extends CommonObject $sql.= ", e.note_private, e.note_public"; $sql.= ', e.fk_incoterms, e.location_incoterms'; $sql.= ', i.libelle as libelle_incoterms'; + $sql.= ', s.libelle as shipping_method'; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_shipment_mode as s ON e.fk_shipping_method = s.rowid'; $sql.= " WHERE e.entity IN (".getEntity('expedition').")"; if ($id) $sql.= " AND e.rowid=".$id; if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'"; @@ -497,9 +499,9 @@ class Expedition extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; $this->socid = $obj->socid; - $this->ref_customer = $obj->ref_customer; - $this->ref_ext = $obj->ref_ext; - $this->ref_int = $obj->ref_int; + $this->ref_customer = $obj->ref_customer; + $this->ref_ext = $obj->ref_ext; + $this->ref_int = $obj->ref_int; $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; $this->date_creation = $this->db->jdate($obj->date_creation); @@ -509,12 +511,13 @@ class Expedition extends CommonObject $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->fk_delivery_address = $obj->fk_address; $this->modelpdf = $obj->model_pdf; - $this->shipping_method_id = $obj->fk_shipping_method; + $this->shipping_method_id = $obj->fk_shipping_method; + $this->shipping_method = $obj->shipping_method; $this->tracking_number = $obj->tracking_number; $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility $this->origin_id = $obj->origin_id; $this->billed = $obj->billed; - $this->fk_project = $obj->fk_projet; + $this->fk_project = $obj->fk_projet; $this->trueWeight = $obj->weight; $this->weight_units = $obj->weight_units; @@ -530,13 +533,13 @@ class Expedition extends CommonObject $this->note_private = $obj->note_private; // A denormalized value - $this->trueSize = $obj->size."x".$obj->width."x".$obj->height; + $this->trueSize = $obj->size."x".$obj->width."x".$obj->height; $this->size_units = $obj->size_units; //Incoterms - $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; $this->db->free($result); From d70e548f94f90ac8ba3c1bf38ac6f28d1068de2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Thu, 30 Aug 2018 18:12:02 +0200 Subject: [PATCH 10/23] Fix: undefined rights_class on modules When a module has the permission variable rights_class undefined, on unactivate the module are deleted all rows in cronjobs and menu tables with module=''. --- htdocs/core/modules/DolibarrModules.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index c810405d42b..3d29a827a9f 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2018 Josep Lluís Amador * * 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 @@ -1328,7 +1329,7 @@ class DolibarrModules // Can not be abstract, because we need to insta // Search if cron entry already present $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; - $sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'"; + $sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'"; if ($class) $sql.= " AND classesname = '".$this->db->escape($class)."'"; if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'"; if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'"; @@ -1354,7 +1355,7 @@ class DolibarrModules // Can not be abstract, because we need to insta if(is_int($status)){ $sql.= ' status,'; } $sql.= " entity, test)"; $sql.= " VALUES ("; - $sql.= "'".$this->db->escape($this->rights_class)."', "; + $sql.= "'".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."', "; $sql.= "'".$this->db->idate($now)."', "; $sql.= ($datestart ? "'".$this->db->idate($datestart)."'" : "NULL").", "; $sql.= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", "; @@ -1417,7 +1418,7 @@ class DolibarrModules // Can not be abstract, because we need to insta if (is_array($this->cronjobs)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob"; - $sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'"; + $sql.= " WHERE module_name = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'"; $sql.= " AND entity = ".$conf->entity; dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG); @@ -1795,7 +1796,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $err=0; $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def"; - $sql.= " WHERE module = '".$this->db->escape($this->rights_class)."'"; + $sql.= " WHERE module = '".$this->db->escape(empty($this->rights_class)?strtolower($this->name):$this->rights_class)."'"; $sql.= " AND entity = ".$conf->entity; dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG); if (! $this->db->query($sql)) @@ -1833,7 +1834,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $menu->menu_handler='all'; //$menu->module=strtolower($this->name); TODO When right_class will be same than module name - $menu->module=$this->rights_class; + $menu->module=empty($this->rights_class)?strtolower($this->name):$this->rights_class; if (! $this->menu[$key]['fk_menu']) { @@ -1929,7 +1930,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $err=0; //$module=strtolower($this->name); TODO When right_class will be same than module name - $module=$this->rights_class; + $module=empty($this->rights_class)?strtolower($this->name):$this->rights_class; $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql.= " WHERE module = '".$this->db->escape($module)."'"; From ebcf43ec7342cbe1b51ca377f47c9c3b773c5722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 21:39:23 +0200 Subject: [PATCH 11/23] function Comment Missing --- dev/setup/codesniffer/ruleset.xml | 4 +- .../admin/dolistore/class/dolistore.class.php | 45 +++++++++++++++++-- htdocs/admin/receiptprinter.php | 7 ++- htdocs/core/lib/functions.lib.php | 22 ++++----- htdocs/core/lib/functions2.lib.php | 8 ++++ htdocs/dav/dav.class.php | 13 ++++-- .../class/propalmergepdfproduct.class.php | 3 ++ .../product/inventory/lib/inventory.lib.php | 37 ++++++++++----- .../variants/class/ProductAttribute.class.php | 5 +++ .../class/ProductAttributeValue.class.php | 9 +++- .../class/ProductCombination.class.php | 7 ++- .../ProductCombination2ValuePair.class.php | 13 ++++-- 12 files changed, 134 insertions(+), 39 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index bbe101112d0..fd00d7e68e8 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -238,9 +238,9 @@ - + diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 660886c835d..85be894bae0 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -25,9 +25,18 @@ include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class */ class Dolistore { - // params - public $start; // beginning of pagination - public $end; // end of pagination + /** + * beginning of pagination + * @var int + */ + + public $start; + /** + * end of pagination + * @var int + */ + public $end; + public $per_page; // pagination: display per page public $categorie; // the current categorie public $search; // the search keywords @@ -282,16 +291,33 @@ class Dolistore return $html; } + /** + * get previous link + * + * @param string $text symbol previous + * @return string html previous link + */ function get_previous_link($text = '<<') { return ''.$text.''; } + /** + * get next link + * + * @param string $text symbol next + * @return string html next link + */ function get_next_link($text = '>>') { return ''.$text.''; } + /** + * get previous url + * + * @return string previous url + */ function get_previous_url() { $param_array = array(); @@ -309,6 +335,11 @@ class Dolistore return $this->url."&".$param; } + /** + * get next url + * + * @return string next url + */ function get_next_url() { $param_array = array(); @@ -326,6 +357,13 @@ class Dolistore return $this->url."&".$param; } + /** + * version compare + * + * @param string $v1 version 1 + * @param string $v2 version 2 + * @return int result of compare + */ function version_compare($v1, $v2) { $v1 = explode('.', $v1); @@ -355,4 +393,3 @@ class Dolistore return $ret; } } - diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index b250bf28a87..9205d49deae 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -52,6 +52,12 @@ if (!$mode) $mode='config'; // used in library escpos maybe useful if php doesn't support gzdecode if (!function_exists('gzdecode')) { + /** + * Gzdecode + * + * @param string $data data to deflate + * @return string data deflated + */ function gzdecode($data) { return gzinflate(substr($data,10,-8)); @@ -450,4 +456,3 @@ if ($mode == 'template' && $user->admin) // End of page llxFooter(); $db->close(); - diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8a06a0d7764..4d0b866cf90 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -607,19 +607,19 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu } -/** - * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. - * This prefix is valid in a web context only and is unique for instance and avoid conflict - * between multi-instances, even when having two instances with one root dir or two instances - * in virtual servers. - * - * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) - * @return string A calculated prefix - */ if (! function_exists('dol_getprefix')) { - function dol_getprefix($mode='') - { + /** + * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. + * This prefix is valid in a web context only and is unique for instance and avoid conflict + * between multi-instances, even when having two instances with one root dir or two instances + * in virtual servers. + * + * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) + * @return string A calculated prefix + */ + function dol_getprefix($mode='') + { global $conf; // If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 4553fec4641..783e6a0cb35 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1167,6 +1167,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m return $numFinal; } +/** + * Get string between + * + * @param string $string String to test + * @param int $start Value for start + * @param int $end Value for end + * @return string Return part of string + */ function get_string_between($string, $start, $end) { $string = " ".$string; diff --git a/htdocs/dav/dav.class.php b/htdocs/dav/dav.class.php index 9e5121112d0..15152529418 100644 --- a/htdocs/dav/dav.class.php +++ b/htdocs/dav/dav.class.php @@ -34,11 +34,18 @@ class CdavLib private $langs; + /** + * Constructor + * + * @param User $user user + * @param DoliDB $db Database handler + * @param Translation $langs translation + */ function __construct($user, $db, $langs) { - $this->user = $user; - $this->db = $db; - $this->langs = $langs; + $this->user = $user; + $this->db = $db; + $this->langs = $langs; } /** diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 23282586d22..21a38626fb0 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -657,6 +657,9 @@ class PropalmergepdfproductLine var $tms=''; var $import_key; + /** + * Constructor + */ function __construct() { return 1; diff --git a/htdocs/product/inventory/lib/inventory.lib.php b/htdocs/product/inventory/lib/inventory.lib.php index aa8c9c9677d..d6230e4f3e7 100644 --- a/htdocs/product/inventory/lib/inventory.lib.php +++ b/htdocs/product/inventory/lib/inventory.lib.php @@ -25,7 +25,7 @@ /** * Define head array for tabs of inventory tools setup pages * - * @return Array of head + * @return array Array of head */ function inventoryAdminPrepareHead() { @@ -40,7 +40,7 @@ function inventoryAdminPrepareHead() $head[$h][1] = $langs->trans("Parameters"); $head[$h][2] = 'settings'; $h++; - + // Show more tabs from modules // Entries must be declared in modules descriptor with line @@ -55,10 +55,19 @@ function inventoryAdminPrepareHead() return $head; } +/** + * Define head array for tabs of inventory tools setup pages + * + * @param Inventory $inventory Object inventory + * @param string $title parameter + * @param string $get parameter + * + * @return array Array of head + */ function inventoryPrepareHead(&$inventory, $title='Inventory', $get='') { global $langs; - + return array( array(dol_buildpath('/product/inventory/card.php?id='.$inventory->id.$get, 1), $langs->trans($title),'inventory') ); @@ -66,26 +75,33 @@ function inventoryPrepareHead(&$inventory, $title='Inventory', $get='') +/** + * Define head array for tabs of inventory tools setup pages + * + * @param Inventory $inventory Object inventory + * + * @return string html of products + */ function inventorySelectProducts(&$inventory) { global $conf,$db,$langs; - + $except_product_id = array(); - + foreach ($inventory->Inventorydet as $Inventorydet) { $except_product_id[] = $Inventorydet->fk_product; } - + ob_start(); $form = new Form($db); $form->select_produits(-1, 'fk_product'); - + $TChildWarehouses = array($inventory->fk_warehouse); $e = new Entrepot($db); $e->fetch($inventory->fk_warehouse); if(method_exists($e, 'get_children_warehouses')) $e->get_children_warehouses($e->id, $TChildWarehouses); - + $Tab = array(); $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'entrepot WHERE rowid IN('.implode(', ', $TChildWarehouses).')'; @@ -96,9 +112,8 @@ function inventorySelectProducts(&$inventory) } print '   '; print $langs->trans('Warehouse').' : '.$form::selectarray('fk_warehouse', $Tab); - + $select_html = ob_get_clean(); - + return $select_html; } - diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 0fa25cdba6e..bdaaff20988 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -53,6 +53,11 @@ class ProductAttribute */ public $rang; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ public function __construct(DoliDB $db) { global $conf; diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 9b455851507..2988fd9715e 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -52,8 +52,13 @@ class ProductAttributeValue */ public $value; - public function __construct(DoliDB $db) - { + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) + { global $conf; $this->db = $db; diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 92bba2f70f8..58eb2178da4 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -70,7 +70,12 @@ class ProductCombination */ public $entity; - public function __construct(DoliDB $db) + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) { global $conf; diff --git a/htdocs/variants/class/ProductCombination2ValuePair.class.php b/htdocs/variants/class/ProductCombination2ValuePair.class.php index 874cedb101a..7332670f684 100644 --- a/htdocs/variants/class/ProductCombination2ValuePair.class.php +++ b/htdocs/variants/class/ProductCombination2ValuePair.class.php @@ -52,10 +52,15 @@ class ProductCombination2ValuePair */ public $fk_prod_attr_val; - public function __construct(DoliDB $db) - { - $this->db = $db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + } /** * Translates this class to a human-readable string From b513cf57d0f8963d7990ca5487e70498e7c94ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 21:44:54 +0200 Subject: [PATCH 12/23] function Comment Missing --- test/phpunit/RestAPIUserTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php index 40153f2cffd..5fdf4e92f74 100644 --- a/test/phpunit/RestAPIUserTest.php +++ b/test/phpunit/RestAPIUserTest.php @@ -173,6 +173,11 @@ class RestAPIUserTest extends PHPUnit_Framework_TestCase $this->assertEquals(1, $object['statut']); } + /** + * testRestCreateUser + * + * @return void + */ public function testRestCreateUser() { From a676f4f64f5b535ac6b0b4215ec9af0633112756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 21:54:40 +0200 Subject: [PATCH 13/23] function Comment Missing --- .../class/expensereport_ik.class.php | 15 +++++++++++---- htdocs/projet/class/projectstats.class.php | 7 ++++++- htdocs/ticket/class/ticket.class.php | 7 ++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 609ba42c5f5..425851cb6e4 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -33,12 +33,12 @@ class ExpenseReportIk extends CoreObject * @var string ID to identify managed object */ public $element='expenseik'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='expensereport_ik'; - + public $fk_element='fk_expense_ik'; /** @@ -128,8 +128,15 @@ class ExpenseReportIk extends CoreObject return $categories; } - public static function getRangeByUser(User $userauthor, $fk_c_exp_tax_cat) - { + /** + * Return an array of ranges for a user + * + * @param User $userauthor user author id + * @param int $fk_c_exp_tax_cat category + * @return boolean|array + */ + public static function getRangeByUser(User $userauthor, $fk_c_exp_tax_cat) + { $default_range = (int) $userauthor->default_range; // if not defined, then 0 $ranges = self::getRangesByCategory($fk_c_exp_tax_cat); diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 22793fd844e..472fb26eaf0 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -29,7 +29,12 @@ class ProjectStats extends Stats public $socid; public $year; - function __construct($db) + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) { global $conf, $user; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index c1833e97d59..9aeb6b2e58a 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1025,7 +1025,12 @@ class Ticket extends CommonObject $this->tms = ''; } - + /** + * print selected status + * + * @param string $selected selected status + * @return void + */ public function printSelectStatus($selected = "") { print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = ''); From df6eccc5dda5ba89ec8cc3ec18f38eaae919532f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:01:13 +0200 Subject: [PATCH 14/23] function Comment Missing --- htdocs/core/lib/invoice.lib.php | 6 ++++++ htdocs/core/lib/security2.lib.php | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 451ac0731ef..94eb4527b74 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -169,6 +169,12 @@ function invoice_admin_prepare_head() } +/** + * Return array head with list of tabs to view object informations. + * + * @param Facture $object Invoice object + * @return array head array with tabs + */ function invoice_rec_prepare_head($object) { global $db, $langs, $conf; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index b6a348ea91d..8dacd4c5516 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -118,18 +118,18 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod } -/** - * Show Dolibarr default login page. - * Part of this code is also duplicated into main.inc.php::top_htmlhead - * - * @param Translate $langs Lang object (must be initialized by a new). - * @param Conf $conf Conf object - * @param Societe $mysoc Company object - * @return void - */ if (! function_exists('dol_loginfunction')) { - function dol_loginfunction($langs,$conf,$mysoc) + /** + * Show Dolibarr default login page. + * Part of this code is also duplicated into main.inc.php::top_htmlhead + * + * @param Translate $langs Lang object (must be initialized by a new). + * @param Conf $conf Conf object + * @param Societe $mysoc Company object + * @return void + */ + function dol_loginfunction($langs,$conf,$mysoc) { global $dolibarr_main_demo,$db; global $smartphone,$hookmanager; @@ -510,4 +510,3 @@ function getRandomPassword($generic=false) return $generated_password; } - From 5d27318e3bceefdf0e19a5df4cfa361aff2bee0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:03:12 +0200 Subject: [PATCH 15/23] function Comment Missing --- htdocs/core/lib/asset.lib.php | 7 ++++++- htdocs/core/lib/security2.lib.php | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/asset.lib.php b/htdocs/core/lib/asset.lib.php index 5953c8b9420..0345fe31394 100644 --- a/htdocs/core/lib/asset.lib.php +++ b/htdocs/core/lib/asset.lib.php @@ -24,7 +24,7 @@ /** * Prepare admin pages header * - * @return array + * @return array head array with tabs */ function AssetsAdminPrepareHead() { @@ -65,6 +65,11 @@ function AssetsAdminPrepareHead() return $head; } +/** + * Prepare admin pages header + * + * @return array head array with tabs + */ function AssetsPrepareHead() { global $langs, $conf; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 8dacd4c5516..a23661f2f02 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -103,12 +103,12 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod } else { - dol_syslog("Authentification ko - failed to load file '".$authfile."'",LOG_ERR); + dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR); sleep(1); $langs->load('main'); $langs->load('other'); $langs->load('errors'); - $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode",$mode); + $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode); } } } From 4c0b083f45c14cc88a84c39f97d4f64a9c14233e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:11:52 +0200 Subject: [PATCH 16/23] function Comment Missing --- htdocs/loan/class/loanschedule.class.php | 67 +++++++++++++----------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 326f5df2e9b..e2fd9937e78 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -190,37 +190,35 @@ class LoanSchedule extends CommonObject dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); + if ($resql) { + if ($this->db->num_rows($resql)) { + $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; - $this->fk_loan = $obj->fk_loan; - $this->datec = $this->db->jdate($obj->datec); - $this->tms = $this->db->jdate($obj->tms); - $this->datep = $this->db->jdate($obj->datep); - $this->amount_capital = $obj->amount_capital; - $this->amount_insurance = $obj->amount_insurance; - $this->amount_interest = $obj->amount_interest; - $this->fk_typepayment = $obj->fk_typepayment; - $this->num_payment = $obj->num_payment; - $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; - $this->fk_bank = $obj->fk_bank; - $this->fk_user_creat = $obj->fk_user_creat; - $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_loan = $obj->fk_loan; + $this->datec = $this->db->jdate($obj->datec); + $this->tms = $this->db->jdate($obj->tms); + $this->datep = $this->db->jdate($obj->datep); + $this->amount_capital = $obj->amount_capital; + $this->amount_insurance = $obj->amount_insurance; + $this->amount_interest = $obj->amount_interest; + $this->fk_typepayment = $obj->fk_typepayment; + $this->num_payment = $obj->num_payment; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; + $this->fk_bank = $obj->fk_bank; + $this->fk_user_creat = $obj->fk_user_creat; + $this->fk_user_modif = $obj->fk_user_modif; - $this->type_code = $obj->type_code; - $this->type_libelle = $obj->type_libelle; + $this->type_code = $obj->type_code; + $this->type_libelle = $obj->type_libelle; - $this->bank_account = $obj->fk_account; - $this->bank_line = $obj->fk_bank; - } - $this->db->free($resql); + $this->bank_account = $obj->fk_account; + $this->bank_line = $obj->fk_bank; + } + $this->db->free($resql); return 1; } @@ -374,13 +372,20 @@ class LoanSchedule extends CommonObject } } - function calc_mens($capital,$rate,$nbterm) + /** + * Calculate mensuality + * + * @param double $capital Capital + * @param double $rate rate + * @param int $nbterm nb term + * @return double mensuality + */ + function calc_mens($capital, $rate, $nbterm) { $result=''; - if (!empty($capital)&&!empty($rate)&&!empty($nbterm)) - { - $result=($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1))); + if (!empty($capital) && !empty($rate) && !empty($nbterm)) { + $result = ($capital*($rate/12))/(1-pow((1+($rate/12)),($nbterm*-1))); } return $result; From e47059fa3646b4cc8c4d3eee80826718f3b3df5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:14:09 +0200 Subject: [PATCH 17/23] function Comment Missing --- htdocs/core/lib/resource.lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index bf586b83f88..9ec993b08a6 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -87,6 +87,11 @@ function resource_prepare_head($object) return $head; } +/** + * Prepare head for admin tabs + * + * @return array Array of head entries + */ function resource_admin_prepare_head() { From b015d05f07afb5537c19ab2e99bb335ace6439ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:25:11 +0200 Subject: [PATCH 18/23] function Comment Missing --- htdocs/core/lib/fichinter.lib.php | 6 ++ test/phpunit/BonPrelevementTest.php | 14 ++++- test/phpunit/functional/InstallTest.php | 75 +++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 8d5cd9c8495..e55aaeb7516 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -163,6 +163,12 @@ function fichinter_admin_prepare_head() return $head; } +/** + * Prepare array with list of tabs + * + * @param Object $object Object related to tabs + * @return array Array of tabs to show + */ function fichinter_rec_prepare_head($object) { global $langs, $conf; //, $user; diff --git a/test/phpunit/BonPrelevementTest.php b/test/phpunit/BonPrelevementTest.php index 0124b25e6c6..a6ea54b8460 100644 --- a/test/phpunit/BonPrelevementTest.php +++ b/test/phpunit/BonPrelevementTest.php @@ -74,14 +74,24 @@ class BonPrelevementTest extends PHPUnit_Framework_TestCase print "\n"; } - // Static methods - public static function setUpBeforeClass() + /** + * setUpBeforeClass + * + * @return void + */ + public static function setUpBeforeClass() { global $conf,$user,$langs,$db; $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. print __METHOD__."\n"; } + + /** + * tearDownAfterClass + * + * @return void + */ public static function tearDownAfterClass() { global $conf,$user,$langs,$db; diff --git a/test/phpunit/functional/InstallTest.php b/test/phpunit/functional/InstallTest.php index 534d1d602c0..f444d08eec0 100644 --- a/test/phpunit/functional/InstallTest.php +++ b/test/phpunit/functional/InstallTest.php @@ -42,6 +42,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase ) ); + /** + * setUpBeforeClass + * + * @return void + */ public static function setUpBeforeClass() { // Make sure we backup and remove the configuration file to force new install. @@ -54,12 +59,22 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase self::shareSession(true); } + /** + * dropTestDatabase + * + * @return void + */ protected static function dropTestDatabase() { $mysqli = new mysqli(self::$db_host, self::$db_admin_user, self::$db_admin_pass); $mysqli->query("DROP DATABASE " . self::$db_name); } + /** + * tearDownAfterClass + * + * @return void + */ public static function tearDownAfterClass() { // Remove the generated configuration and restore the backed up file. @@ -70,6 +85,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase self::dropTestDatabase(); } + /** + * setUp + * + * @return void + */ public function setUp() { // Populating the database can take quite long. @@ -77,17 +97,32 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase $this->setBrowserUrl(self::$url); } + /** + * testInstallRedirect + * + * @return void + */ public function testInstallRedirect() { $this->url('/'); $this->assertContains('/install/index.php', $this->url()); } + /** + * testInstallPageTitle + * + * @return void + */ public function testInstallPageTitle() { $this->assertContains('Dolibarr', $this->title()); } + /** + * testInstallProcess + * + * @return void + */ public function testInstallProcess() { // FIXME: the button itself should have an ID @@ -95,6 +130,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase $this->assertContains('/install/check.php', $this->url()); } + /** + * testCheckPage + * + * @return void + */ public function testCheckPage() { $unavailable_choices = $this->byId('navail_choices'); @@ -109,6 +149,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase $this->assertContains('/install/fileconf.php', $this->url()); } + /** + * testForm + * + * @return void + */ public function testForm() { $this->assertFalse($this->byClassName('hideroot')->displayed()); @@ -153,12 +198,22 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase $this->byId('db_pass_root')->value(''); } + /** + * testFormSubmit + * + * @return void + */ public function testFormSubmit() { $this->byName('forminstall')->submit(); $this->assertContains('/install/step1.php', $this->url()); } + /** + * testStep1 + * + * @return void + */ public function testStep1() { $this->assertFalse($this->byId('pleasewait')->displayed()); @@ -170,6 +225,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase $this->assertContains('/install/step2.php', $this->url()); } + /** + * testStep2 + * + * @return void + */ public function testStep2() { $this->byName('forminstall')->submit(); @@ -178,6 +238,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase // There is no step 3 + /** + * testStep4 + * + * @return void + */ public function testStep4() { // FIXME: should have an ID @@ -191,6 +256,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase $this->assertContains('/install/step5.php', $this->url()); } + /** + * testStep5 + * + * @return void + */ public function testStep5() { // FIXME: this button should have an ID @@ -198,6 +268,11 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase $this->assertContains('/admin/index.php', $this->url()); } + /** + * testFirstLogin + * + * @return void + */ public function testFirstLogin() { $this->assertEquals('login', $this->byTag('form')->attribute('id')); From c2e49c82f8c8ba0f3fbce0ba3d22610f9a4e434b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:34:02 +0200 Subject: [PATCH 19/23] function Comment Missing --- .../core/modules/dons/html_cerfafr.modules.php | 14 +++++++++++--- htdocs/user/class/user.class.php | 18 +++++++++--------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index c9d2b4984ad..d4b2f1ed265 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -38,7 +38,7 @@ class html_cerfafr extends ModeleDon /** * Constructor * - * @param DoliDb $db Database handler + * @param DoliDb $db Database handler */ function __construct($db) { @@ -167,7 +167,7 @@ class html_cerfafr extends ModeleDon $form = str_replace('__DATE__',dol_print_date($don->date,'day',false,$outputlangs),$form); //$form = str_replace('__IP__',$user->ip,$form); // TODO $user->ip not exist $form = str_replace('__AMOUNT__', price($don->amount), $form); - $form = str_replace('__AMOUNTLETTERS__',chiffre_en_lettre($don->amount),$form); + $form = str_replace('__AMOUNTLETTERS__',amountToLetters($don->amount),$form); $form = str_replace('__CURRENCY__',$outputlangs->transnoentitiesnoconv("Currency".$currency),$form); $form = str_replace('__CURRENCYCODE__',$conf->currency,$form); $form = str_replace('__MAIN_INFO_SOCIETE_NOM__',$mysoc->name,$form); @@ -278,7 +278,15 @@ class html_cerfafr extends ModeleDon } } -function chiffre_en_lettre($montant, $devise1='', $devise2='') +/** + * numbers to letters + * + * @param mixed $montant amount + * @param mixed $devise1 devise 1 ex: euro + * @param mixed $devise2 devise 2 ex: centimes + * @return string amount in letters + */ +function amountToLetters($montant, $devise1='', $devise2='') { if(empty($devise1)) $dev1='euros'; else $dev1=$devise1; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 40c6a6b9f19..58c056765dd 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -44,12 +44,12 @@ class User extends CommonObject * @var string ID to identify managed object */ public $element='user'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='user'; - + public $fk_element='fk_user'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -146,14 +146,14 @@ class User extends CommonObject public $default_c_exp_tax_cat; public $default_range; - public $fields=array( - 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'), - 'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - ); + public $fields = array( + 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'), + 'firstname'=>array('type'=>'varchar(50)', 'label'=>'Name','enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + ); /** - * Constructor de la classe + * Constructor of the class * * @param DoliDb $db Database handler */ @@ -1541,7 +1541,7 @@ class User extends CommonObject $adh->zip=$this->zip; $adh->state_id=$this->state_id; $adh->country_id=$this->country_id; - + $adh->email=$this->email; $adh->skype=$this->skype; $adh->phone=$this->office_phone; From 02b74afe5ff35e7cff4a4f0f3f010b605a2122fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:41:51 +0200 Subject: [PATCH 20/23] function Comment Missing --- htdocs/api/class/api_login.class.php | 5 +++++ htdocs/projet/class/taskstats.class.php | 5 +++++ scripts/cron/cron_run_jobs.php | 8 +++++++- test/phpunit/WebservicesInvoicesTest.php | 10 ++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 797cd2429d5..60ccf3a4231 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -26,6 +26,11 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; class Login { + /** + * Constructor of the class + * + * @param DoliDb $db Database handler + */ function __construct() { global $db; diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index 20a3a67d1d3..84633944250 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -29,6 +29,11 @@ class TaskStats extends Stats public $socid; public $year; + /** + * Constructor of the class + * + * @param DoliDb $db Database handler + */ function __construct($db) { global $conf, $user; diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 88960766a68..b97b8c5b20c 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -239,6 +239,13 @@ exit(0); +/** + * script cron usage + * + * @param string $path path + * @param string $script_file filename + * @return void + */ function usage($path,$script_file) { global $conf; @@ -252,4 +259,3 @@ function usage($path,$script_file) print "For example, to run pending tasks every 5mn, you can add this line:\n"; print "*/5 * * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n"; } - diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 6f7ca3610cd..bfa7c8ff0c8 100644 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -91,6 +91,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase print "\n"; } + /** + * setUpBeforeClass + * + * @return void + */ public static function setUpBeforeClass() { global $conf,$user,$langs,$db; @@ -131,6 +136,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase print __METHOD__."\n"; } + /** + * tearDownAfterClass + * + * @return void + */ public static function tearDownAfterClass() { global $conf,$user,$langs,$db; From 3b2e7732c24722aa58b2d24468a5e0091c22a6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 22:49:11 +0200 Subject: [PATCH 21/23] function Comment Missing --- htdocs/api/class/api_login.class.php | 2 -- .../modules/user/doc/doc_generic_user_odt.modules.php | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 60ccf3a4231..86d1cfff87c 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -28,8 +28,6 @@ class Login /** * Constructor of the class - * - * @param DoliDb $db Database handler */ function __construct() { diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 9e05292fb5a..285a213cd9b 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -422,6 +422,14 @@ class doc_generic_user_odt extends ModelePDFUser return -1; } + /** + * get substitution array for object + * + * @param User $object user + * @param Translation $outputlangs translation object + * @param string $array_key key for array + * @return array array of substitutions + */ function get_substitutionarray_object($object,$outputlangs,$array_key='object') { $array_other=array(); From 945eede4a565cd5a76c4465cbde5b11c58323848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 31 Aug 2018 23:12:55 +0200 Subject: [PATCH 22/23] doxygen fixs --- htdocs/adherents/admin/website.php | 2 +- htdocs/admin/dolistore/ajax/image.php | 5 ++--- htdocs/admin/oauthlogintokens.php | 2 +- htdocs/admin/ticket_extrafields.php | 6 +++--- htdocs/asset/card.php | 2 +- htdocs/asset/document.php | 2 +- htdocs/asset/info.php | 2 +- htdocs/asset/list.php | 2 +- htdocs/asset/note.php | 2 +- 9 files changed, 12 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 31d9c43afbb..be519b0be30 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/adherents/admin/public.php + * \file htdocs/adherents/admin/website.php * \ingroup member * \brief File of main public page for member module * \author Laurent Destailleur diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index 043d24e8376..c1bb4e997dc 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -20,9 +20,9 @@ if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1); /** - * \file htdocs/admin/dolistore/ajax.php + * \file htdocs/admin/dolistore/ajax/image.php * \ingroup admin - * \brief Page des informations dolistore + * \brief Page des informations dolistore */ require "../../../main.inc.php"; @@ -56,4 +56,3 @@ try { else if ($trace[0]['args'][0] == 401) die('Bad auth key'); else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); } - diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index e2219ad4813..5bfda4f2c9c 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/admin/oauthlogintoken.php + * \file htdocs/admin/oauthlogintokens.php * \ingroup oauth * \brief Setup page to configure oauth access to login information */ diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index 07ace9fea0c..6fa70808ec8 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -16,9 +16,9 @@ */ /** - * \file ticket/admin/ticket_extrafields.php - * \ingroup ticket - * \brief Page to setup extra fields of ticket + * \file admin/ticket_extrafields.php + * \ingroup ticket + * \brief Page to setup extra fields of ticket */ require '../main.inc.php'; diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 50e09831bff..3a03dc21060 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -17,7 +17,7 @@ */ /** - * \file card.php + * \file htdocs/asset/card.php * \ingroup asset * \brief Page to create/edit/view asset */ diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 92efa8918ee..784f65aa220 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -17,7 +17,7 @@ */ /** - * \file document.php + * \file htdocs/asset/document.php * \ingroup asset * \brief Tab for documents linked to Assets */ diff --git a/htdocs/asset/info.php b/htdocs/asset/info.php index e8820ee5cfa..9cc9495c1b9 100644 --- a/htdocs/asset/info.php +++ b/htdocs/asset/info.php @@ -16,7 +16,7 @@ */ /** - * \file info.php + * \file htdocs/asset/info.php * \ingroup asset * \brief Page to show an asset information */ diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index bcc2329f870..7e59ad4647f 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -18,7 +18,7 @@ */ /** - * \file list.php + * \file htdocs/asset/list.php * \ingroup asset * \brief List page for asset */ diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index 775b3e8747e..e95e62aeaa4 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -17,7 +17,7 @@ */ /** - * \file note.php + * \file htdocs/asset/note.php * \ingroup asset * \brief Card with notes on Asset */ From 9454f897efe12cd0e561d71a62a7ad7ec585229f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 1 Sep 2018 09:40:50 +0200 Subject: [PATCH 23/23] doxygen fix --- htdocs/comm/propal/class/propal.class.php | 3 +-- htdocs/core/class/fiscalyear.class.php | 8 ++++---- htdocs/core/lib/asset.lib.php | 2 +- htdocs/core/modules/modVariants.class.php | 4 +--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 955ee29845e..92ac850282e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1574,7 +1574,7 @@ class Propal extends CommonObject $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; $sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,'; $sql.= ' d.fk_unit,'; - $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobach as product_batch,'; + $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_batch,'; $sql.= ' p.weight, p.weight_units, p.volume, p.volume_units,'; $sql.= ' d.date_start, d.date_end,'; $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; @@ -4238,4 +4238,3 @@ class PropaleLigne extends CommonObjectLine } } - diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 8e6f389200b..1235dfb7729 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/core/class/fiscalyear.php + * \file htdocs/core/class/fiscalyear.class.php * \ingroup fiscal year * \brief File of class to manage fiscal years */ @@ -32,12 +32,12 @@ class Fiscalyear extends CommonObject * @var string ID to identify managed object */ public $element='fiscalyear'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='accounting_fiscalyear'; - + public $table_element_line = ''; public $fk_element = ''; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -48,7 +48,7 @@ class Fiscalyear extends CommonObject * @var string proper name for given parameter */ public $label; - + var $date_start; var $date_end; var $datec; diff --git a/htdocs/core/lib/asset.lib.php b/htdocs/core/lib/asset.lib.php index 0345fe31394..7a4fd80158c 100644 --- a/htdocs/core/lib/asset.lib.php +++ b/htdocs/core/lib/asset.lib.php @@ -16,7 +16,7 @@ */ /** - * \file core/lib/assets.lib.php + * \file htdocs/core/lib/asset.lib.php * \ingroup asset * \brief Library files with common functions for Assets */ diff --git a/htdocs/core/modules/modVariants.class.php b/htdocs/core/modules/modVariants.class.php index 19c50d8843e..faac67da78c 100644 --- a/htdocs/core/modules/modVariants.class.php +++ b/htdocs/core/modules/modVariants.class.php @@ -22,9 +22,8 @@ /** * \defgroup produit Module product variants * \brief Module to manage product combinations based on product attributes - * \file htdocs/core/modules/modAttributes.class.php + * \file htdocs/core/modules/modVariants.class.php * \ingroup produit - * \brief File to describe module to manage catalog of predefined products */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; @@ -110,4 +109,3 @@ class modVariants extends DolibarrModules $this->rights = array(); // Permission array used by this module } } -