diff --git a/ChangeLog b/ChangeLog index 18f9fbe2dcb..3c9576e7544 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ NEW: Module DebugBar is available as a stable module. WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* The PHP extension php-intl is not mandatory but should be installed to have new features working correctly. * Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules. * API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules. * Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.; @@ -24,7 +25,10 @@ Following changes may create regressions for some external modules, but were nec * All methods set_draft() were renamed into setDraft(). * Removed deprecated function function test_sql_and_script_inject that was replaced with testSqlAndScriptInject. * Method load_measuring_units were renamed into selectMeasuringUnits and select_measuring_units was deprecated. -* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION +* Hidden option CHANGE_ORDER_CONCAT_DESCRIPTION were renamed into MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION. +* Method dolEscapeXML was moved from functions.lib.php into function2.lib.php (not used enough to be loaded by default). +* Removed deprecated use of string in dol_print_date(). Only date allowed. + ***** ChangeLog for 9.0.1 compared to 9.0.0 ***** diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index d8861154f9e..5bad55fd4d2 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -8,6 +8,15 @@ ALL: Check "@CHANGE" +PrestaShopWebservice: +--------------------- +Replace + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); +With + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date'); + + + CKEDITOR (4.6.2): ----------------- * In ckeditor/ckeditor/contents.css diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index d8fff2265e9..30099b40be4 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -8,9 +8,11 @@ documents htdocs/custom htdocs/includes + htdocs/install/doctemplates/websites htdocs/conf.php */nltechno* */htdocs/includes + */htdocs/includes diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 53e824219c5..c8a855c0d8a 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -142,12 +142,12 @@ class AccountancySystem $result = $this->rowid; } else { $result = - 2; - $this->error = "AccountancySystem::Create Erreur $result"; + $this->error = "AccountancySystem::Create Error $result"; dol_syslog($this->error, LOG_ERR); } } else { $result = - 1; - $this->error = "AccountancySystem::Create Erreur $result"; + $this->error = "AccountancySystem::Create Error $result"; dol_syslog($this->error, LOG_ERR); } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 65085caf42a..b87e6aa527e 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -56,7 +56,7 @@ class AdherentType extends CommonObject /** * @var string * @deprecated Use label - * @see label + * @see $label */ public $libelle; diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 6948bce1e25..e5b93c4bfd1 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -86,7 +86,8 @@ class Members extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $typeid ID of the type of member - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. + * Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))" * @return array Array of member objects * * @throws RestException diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index d88d775e0c1..2de98e1b96a 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -113,7 +113,7 @@ if ($id > 0) print '
'; print '
'; - print ''; + print '
'; $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 1ab783474b8..894706576b5 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2019 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 @@ -36,7 +36,8 @@ $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $arrayofparameters=array( - 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), + 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), + 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) ); @@ -84,7 +85,11 @@ if ($action == 'edit') print ' - - + '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

'.$product->description_short->language[$this->lang - 1].' + diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 62f5443d693..9e0acb0ff62 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -100,8 +100,8 @@ print '
'.$moreinfo; if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled { $langs->load("errors"); - $warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"'); - print '
'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'
'; + $warnpicto=img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"'); + print '
'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'
'; } print '
'; print '
'; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index c735362d87f..d06f5d393d9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -888,7 +888,8 @@ if ($mode == 'marketplace') { // $options is array with filter criterias //var_dump($options); - $dolistore->getRemoteData($options); + $dolistore->getRemoteCategories(); + $dolistore->getRemoteProducts($options); print ''.$langs->trans('DOLISTOREdescriptionLong').'

'; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6c9074226dc..df7054ca162 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -279,7 +279,7 @@ class DolibarrApi /** * Function to forge a SQL criteria * - * @param array $matches Array of found string by regex search + * @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL" * @return string Forged criteria. Example: "t.field like 'abc%'" */ protected static function _forge_criteria_callback($matches) diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 3359d5539b5..61be1ad51d6 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -117,7 +117,7 @@ if ($object->id) print '
'; print '
'; - print '
'; print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print ''; - if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') + if ($key == 'DAV_ALLOW_PRIVATE_DIR') + { + print $langs->trans("AlwaysActive"); + } + elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') { print $form->selectyesno($key, $conf->global->$key, 1); } @@ -114,7 +119,11 @@ else print '
'; print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print ''; - if ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') + if ($key == 'DAV_ALLOW_PRIVATE_DIR') + { + print $langs->trans("AlwaysActive"); + } + elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR') { print yn($conf->global->$key); } diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index f4ed611ac03..a12d1cc3ed4 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -46,7 +46,7 @@ class PrestaShopWebservice /** @var array compatible versions of PrestaShop Webservice */ const PSCOMPATIBLEVERSIONMIN = '1.4.0.0'; - const PSCOMPATIBLEVERSIONMAX = '1.6.99.99'; + const PSCOMPATIBLEVERSIONMAX = '1.7.99.99'; /** @@ -128,6 +128,7 @@ class PrestaShopWebservice CURLOPT_HTTPHEADER => array( 'Expect:' ) ); + dol_syslog("curl_init url=".$url); $session = curl_init($url); $curl_options = array(); @@ -142,6 +143,7 @@ class PrestaShopWebservice if (!isset($curl_options[$defkey])) $curl_options[$defkey] = $curl_params[$defkey]; + dol_syslog("curl curl_options = ".var_export($curl_options, true)); curl_setopt_array($session, $curl_options); $response = curl_exec($session); @@ -309,7 +311,9 @@ class PrestaShopWebservice if (isset($options['id'])) $url .= '/'.$options['id']; - $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + // @CHANGE LDR + //$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'date'); foreach ($params as $p) foreach ($options as $k => $o) if (strpos($k, $p) !== false) @@ -388,6 +392,49 @@ class PrestaShopWebservice self::checkStatusCode($request['status_code']);// check the response validity return self::parseXML($request['response']); } + + /** + * Delete (DELETE) a resource. + * Unique parameter must take :

+ * 'resource' => Resource name
+ * 'id' => ID or array which contains IDs of a resource(s) you want to delete

+ * + * delete(array('resource' => 'orders', 'id' => 1)); + * // Following code will not be executed if an exception is thrown. + * echo 'Successfully deleted.'; + * } + * catch (PrestaShopWebserviceException $ex) + * { + * echo 'Error : '.$ex->getMessage(); + * } + * ?> + * + * + * @param array $options Array representing resource to delete. + * @return boolean True + */ + public function delete($options) + { + if (isset($options['url'])) + $url = $options['url']; + elseif (isset($options['resource']) && isset($options['id'])) + if (is_array($options['id'])) + $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; + else + $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; + if (isset($options['id_shop'])) + $url .= '&id_shop='.$options['id_shop']; + if (isset($options['id_group_shop'])) + $url .= '&id_group_shop='.$options['id_group_shop']; + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); + self::checkStatusCode($request['status_code']);// check the response validity + return true; + } } /** diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 619af090805..421cef19af5 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -44,7 +44,6 @@ class Dolistore // setups public $url; // the url of this page public $shop_url; // the url of the shop - public $vat_rate; // the vat rate used in the shop (prices are provided without vat) public $lang; // the integer representing the lang in the store public $debug_api; // usefull if no dialog @@ -60,12 +59,11 @@ class Dolistore $this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace'; $this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product='; - $this->vat_rate = 1.2; // 20% de TVA $this->debug_api = $debug; $langtmp = explode('_', $langs->defaultlang); $lang = $langtmp[0]; - $lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1 + $lang_array = array('en'=>1, 'fr'=>2, 'es'=>3, 'it'=>4, 'de'=>5); // Into table ps_lang of Prestashop - 1 if (! in_array($lang, array_keys($lang_array))) $lang = 'en'; $this->lang = $lang_array[$lang]; } @@ -74,12 +72,50 @@ class Dolistore * Load data from remote Dolistore market place. * This fills ->categories * - * @param array $options Options * @return void */ - public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) + public function getRemoteCategories() { - global $conf, $langs; + global $conf; + + try { + $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api); + dol_syslog("Call API with MAIN_MODULE_DOLISTORE_API_SRV = ".$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); + // $conf->global->MAIN_MODULE_DOLISTORE_API_KEY is for the login of basic auth. There is no password as it is public data. + + // Here we set the option array for the Webservice : we want categories resources + $opt = array(); + $opt['resource'] = 'categories'; + $opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]'; + $opt['sort'] = 'id_asc'; + + // Call + dol_syslog("Call API with opt = ".var_export($opt, true)); + $xml = $this->api->get($opt); + $this->categories = $xml->categories->children(); + } catch (PrestaShopWebserviceException $e) { + // Here we are dealing with errors + $trace = $e->getTrace(); + if ($trace[0]['args'][0] == 404) die('Bad ID'); + elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); + else + { + print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'
'; + print $e->getMessage(); + } + } + } + + /** + * Load data from remote Dolistore market place. + * This fills ->products + * + * @param array $options Options. If 'categorie' is defined, we filter products on this category id + * @return void + */ + public function getRemoteProducts($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0, 'search' => '')) + { + global $conf; $this->start = $options['start']; $this->end = $options['end']; @@ -103,25 +139,26 @@ class Dolistore // make a search to limit the id returned. if ($this->search != '') { - $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; + $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; // It seems for search, key start with // Call - //var_dump($this->api); - - dol_syslog("Call API with opt = ".var_export($opt, true)); dol_syslog("Call API with opt2 = ".var_export($opt2, true)); - $xml = $this->api->get($opt2); + $products = array(); foreach ($xml->products->children() as $product) { $products[] = (int) $product['id']; } $opt['filter[id]'] = '['.implode('|', $products).']'; - } elseif ($this->categorie != 0) { + } elseif ($this->categorie != 0) { // We filter on category, so we first get list of product id in this category + // $opt2['url'] is set by default to $this->url.'/api/'.$options['resource']; $opt2['resource'] = 'categories'; $opt2['id'] = $this->categorie; + // Call + dol_syslog("Call API with opt2 = ".var_export($opt2, true)); $xml = $this->api->get($opt2); + $products = array(); foreach ($xml->category->associations->products->children() as $product) { $products[] = (int) $product->id; @@ -134,22 +171,10 @@ class Dolistore $opt['limit'] = "$this->start,$this->end"; // $opt['filter[id]'] contais list of product id that are result of search - // Call API to get the detail dol_syslog("Call API with opt = ".var_export($opt, true)); - dol_syslog("Call API with opt2 = ".var_export($opt2, true)); $xml = $this->api->get($opt); $this->products = $xml->products->children(); - - - // Here we set the option array for the Webservice : we want categories resources - $opt = array(); - $opt['resource'] = 'categories'; - $opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]'; - $opt['sort'] = 'id_asc'; - // Call - $xml = $this->api->get($opt); - $this->categories = $xml->categories->children(); } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors $trace = $e->getTrace(); @@ -186,15 +211,15 @@ class Dolistore $cat = $this->categories[$i]; if ($cat->is_root_category == 1 && $parent == 0) { $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.'

    '; + .'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'"' + .'>'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; $html .= self::get_categories($cat->id); $html .= "
  • \n"; } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau $select = ($cat->id == $this->categorie) ? ' selected' : ''; $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.''; + .' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang - 1])).'" ' + .'>'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; $html .= self::get_categories($cat->id); $html .= "
  • \n"; } else { @@ -242,7 +267,7 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; - $images = ''. + $images = ''. ''; } else { $images = ''; @@ -250,7 +275,7 @@ class Dolistore // free or pay ? if ($product->price > 0) { - $price = '

    '.price(round((float) $product->price * $this->vat_rate, 2)).' €

    '; + $price = '

    '.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'

    '; $download_link = ''; } else { $price = '

    '.$langs->trans('Free').'

    '; @@ -283,10 +308,10 @@ class Dolistore //output template $html .= '
    '.$newapp.$images.'

    '.$product->name->language[$this->lang] +

    '.$product->name->language[$this->lang - 1] .'
    '.$version.'

    - '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

    '.$product->description_short->language[$this->lang].'
    '.$price.' '.$download_link.'
    '; + print '
    '; // Number of files print ''; diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 20f9fccfb01..b54a2e21b57 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -66,7 +66,7 @@ function bomAdminPrepareHead() /** * Prepare array of tabs for BillOfMaterials * - * @param BillOfMaterials $object BillOfMaterials + * @param BOM $object BillOfMaterials * @return array Array of tabs */ function bomPrepareHead($object) diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index f565e86aa1b..07d514b95f1 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -281,7 +281,7 @@ class Facturation * Getter for id * * @param int $aId Id - * @return id + * @return int Id */ public function id($aId = null) { @@ -542,8 +542,8 @@ class Facturation /** * Get payment date * - * @param date $aPaiementLe Date - * @return date Date + * @param integer $aPaiementLe Date + * @return integer Date */ public function paiementLe($aPaiementLe = null) { diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php index 32c60af9fdf..b0f1f5253c2 100644 --- a/htdocs/collab/index.php +++ b/htdocs/collab/index.php @@ -33,10 +33,7 @@ $langs->loadLangs(array("admin","other","website")); if (! $user->admin) accessforbidden(); -if (! ((GETPOST('testmenuhider', 'int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) -{ - $conf->dol_hide_leftmenu = 1; // Force hide of left menu. -} +$conf->dol_hide_leftmenu = 1; // Force hide of left menu. $error=0; $website=GETPOST('website', 'alpha'); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 18d7edd1f03..4c464db4693 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -155,7 +155,7 @@ if ($object->id > 0) print '
    '; print '
    '; - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '; + print '
    '; // Files infos print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 07b7a907150..b6e4010600c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1075,7 +1075,7 @@ class Commande extends CommonOrder */ public function createFromClone($socid = 0) { - global $user,$hookmanager; + global $conf, $user,$hookmanager; $error=0; @@ -1085,69 +1085,88 @@ class Commande extends CommonOrder foreach($this->lines as $line) $line->fetch_optionals(); - // Load source object - $objFrom = clone $this; + // Load source object + $objFrom = clone $this; - // Change socid if needed - if (! empty($socid) && $socid != $this->socid) + // Change socid if needed + if (! empty($socid) && $socid != $this->socid) + { + $objsoc = new Societe($this->db); + + if ($objsoc->fetch($socid)>0) { - $objsoc = new Societe($this->db); - - if ($objsoc->fetch($socid)>0) - { - $this->socid = $objsoc->id; - $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); - $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); - $this->fk_project = 0; - $this->fk_delivery_address = 0; - } - - // TODO Change product price if multi-prices + $this->socid = $objsoc->id; + $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $this->fk_project = 0; + $this->fk_delivery_address = 0; } - $this->id=0; - $this->ref = ''; - $this->statut=self::STATUS_DRAFT; + // TODO Change product price if multi-prices + } - // Clear fields - $this->user_author_id = $user->id; - $this->user_valid = ''; - $this->date = dol_now(); - $this->date_commande = dol_now(); - $this->date_creation = ''; - $this->date_validation = ''; - $this->ref_client = ''; + $this->id=0; + $this->ref = ''; + $this->statut=self::STATUS_DRAFT; - // Create clone - $this->context['createfromclone'] = 'createfromclone'; - $result=$this->create($user); - if ($result < 0) $error++; + // Clear fields + $this->user_author_id = $user->id; + $this->user_valid = ''; + $this->date = dol_now(); + $this->date_commande = dol_now(); + $this->date_creation = ''; + $this->date_validation = ''; + if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = ''; - if (! $error) + // Create clone + $this->context['createfromclone'] = 'createfromclone'; + $result=$this->create($user); + if ($result < 0) $error++; + + if (! $error) + { + // copy internal contacts + if ($this->copy_linked_contact($objFrom, 'internal') < 0) { - // Hook of thirdparty module - if (is_object($hookmanager)) - { - $parameters=array('objFrom'=>$objFrom); - $action=''; - $reshook=$hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) $error++; - } + $error++; } + } - unset($this->context['createfromclone']); + if (! $error) + { + // copy external contacts if same company + if ($this->socid == $objFrom->socid) + { + if ($this->copy_linked_contact($objFrom, 'external') < 0) + $error++; + } + } - // End - if (! $error) + if (! $error) + { + // Hook of thirdparty module + if (is_object($hookmanager)) { - $this->db->commit(); - return $this->id; - } - else - { - $this->db->rollback(); - return -1; + $parameters=array('objFrom'=>$objFrom); + $action=''; + $reshook=$hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; } + } + + unset($this->context['createfromclone']); + + // End + if (! $error) + { + $this->db->commit(); + return $this->id; + } + else + { + $this->db->rollback(); + return -1; + } } @@ -1367,7 +1386,7 @@ class Commande extends CommonOrder // Check parameters if ($type < 0) return -1; - + if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); $this->error=$langs->trans('ErrorStartDateGreaterEnd'); @@ -2947,7 +2966,7 @@ class Commande extends CommonOrder if (empty($txlocaltax2)) $txlocaltax2=0; if (empty($remise_percent)) $remise_percent=0; if (empty($special_code) || $special_code == 3) $special_code=0; - + if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); $this->error=$langs->trans('ErrorStartDateGreaterEnd'); @@ -2962,7 +2981,7 @@ class Commande extends CommonOrder $txtva=price2num($txtva); $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); - + $this->db->begin(); // Calcul du total TTC et de la TVA pour la ligne a partir de diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 9c706bda200..37cbc70cd40 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '; + print '
    '; print ''; print ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f42289c1c4b..3fddf55924f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -497,12 +497,12 @@ if ($resql) print ''; print ''; } diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 06fc4752d31..5b887f0bd8e 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) { print '
    '; print '
    '; - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; if (! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - print $form->selectyesno('valdate_invoices', 0, 1, 1); + print $form->selectyesno('validate_invoices', 0, 1, 1); print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; } else { - print $form->selectyesno('valdate_invoices', 0, 1); + print $form->selectyesno('validate_invoices', 0, 1); } if (! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print '     '.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").''; else print '     '.$langs->trans("OptionToSetOrderBilledNotEnabled").''; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 518918f62c2..f6633f279d5 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -639,11 +639,12 @@ else print '
    '.$langs->trans("AccountancyJournal").''; - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($object->fk_accountancy_journal); - - print $accountingjournal->getNomUrl(0, 1, 1, '', 1); + if ($object->fk_accountancy_journal > 0) { + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($object->fk_accountancy_journal); + print $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } print '
    '; + print '
    '; print ''; print ''; print "
    ' . $langs->trans("NbOfAttachedFiles") . '' . count($filearray) . '
    ' . $langs->trans("TotalSizeOfAttachedFiles") . '' .dol_print_size($totalsize, 1, 1).'
    \n"; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 8cc396f3bc1..9dd7f6c405b 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -407,18 +407,17 @@ foreach ($accounts as $key=>$type) $found++; - $obj = new Account($db); - $obj->fetch($key); + $result = $objecttmp->fetch($key); - $solde = $obj->solde(1); + $solde = $objecttmp->solde(1); - if (! empty($lastcurrencycode) && $lastcurrencycode != $obj->currency_code) + if (! empty($lastcurrencycode) && $lastcurrencycode != $objecttmp->currency_code) { $lastcurrencycode='various'; // We found several different currencies } if ($lastcurrencycode != 'various') { - $lastcurrencycode=$obj->currency_code; + $lastcurrencycode=$objecttmp->currency_code; } print ''; @@ -426,14 +425,14 @@ foreach ($accounts as $key=>$type) // Ref if (! empty($arrayfields['b.ref']['checked'])) { - print ''.$obj->getNomUrl(1).''; + print ''.$objecttmp->getNomUrl(1).''; if (! $i) $totalarray['nbfield']++; } // Label if (! empty($arrayfields['b.label']['checked'])) { - print ''.$obj->label.''; + print ''.$objecttmp->label.''; if (! $i) $totalarray['nbfield']++; } @@ -441,7 +440,7 @@ foreach ($accounts as $key=>$type) if (! empty($arrayfields['accountype']['checked'])) { print ''; - print $obj->type_lib[$obj->type]; + print $objecttmp->type_lib[$objecttmp->type]; print ''; if (! $i) $totalarray['nbfield']++; } @@ -449,7 +448,7 @@ foreach ($accounts as $key=>$type) // Number if (! empty($arrayfields['b.number']['checked'])) { - print ''.$obj->number.''; + print ''.$objecttmp->number.''; if (! $i) $totalarray['nbfield']++; } @@ -460,12 +459,12 @@ foreach ($accounts as $key=>$type) if (! empty($conf->accounting->enabled)) { $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $obj->account_number, 1); + $accountingaccount->fetch('', $objecttmp->account_number, 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1); } else { - print $obj->account_number; + print $objecttmp->account_number; } print ''; if (! $i) $totalarray['nbfield']++; @@ -478,7 +477,7 @@ foreach ($accounts as $key=>$type) if (! empty($conf->accounting->enabled)) { $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($obj->fk_accountancy_journal); + $accountingjournal->fetch($objecttmp->fk_accountancy_journal); print $accountingjournal->getNomUrl(0, 1, 1, '', 1); } else @@ -493,7 +492,7 @@ foreach ($accounts as $key=>$type) if (! empty($arrayfields['b.currency_code']['checked'])) { print ''; - print $obj->currency_code; + print $objecttmp->currency_code; print ''; if (! $i) $totalarray['nbfield']++; } @@ -502,11 +501,11 @@ foreach ($accounts as $key=>$type) if (! empty($arrayfields['toreconcile']['checked'])) { print ''; - if ($obj->rappro) + if ($objecttmp->rappro) { - $result=$obj->load_board($user, $obj->id); + $result=$objecttmp->load_board($user, $objecttmp->id); if ($result<0) { - setEventMessages($obj->error, $obj->errors, 'errors'); + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); } else { print $result->nbtodo; if ($result->nbtodolate) print '   ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; @@ -520,14 +519,14 @@ foreach ($accounts as $key=>$type) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook print $hookmanager->resPrint; // Date creation if (! empty($arrayfields['b.datec']['checked'])) { print ''; - print dol_print_date($obj->date_creation, 'dayhour'); + print dol_print_date($objecttmp->date_creation, 'dayhour'); print ''; if (! $i) $totalarray['nbfield']++; } @@ -535,7 +534,7 @@ foreach ($accounts as $key=>$type) if (! empty($arrayfields['b.tms']['checked'])) { print ''; - print dol_print_date($obj->date_update, 'dayhour'); + print dol_print_date($objecttmp->date_update, 'dayhour'); print ''; if (! $i) $totalarray['nbfield']++; } @@ -543,7 +542,7 @@ foreach ($accounts as $key=>$type) // Status if (! empty($arrayfields['b.clos']['checked'])) { - print ''.$obj->getLibStatut(5).''; + print ''.$objecttmp->getLibStatut(5).''; if (! $i) $totalarray['nbfield']++; } @@ -551,7 +550,7 @@ foreach ($accounts as $key=>$type) if (! empty($arrayfields['balance']['checked'])) { print ''; - print ''.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).''; + print ''.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).''; print ''; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield']; @@ -563,15 +562,15 @@ foreach ($accounts as $key=>$type) if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; - if (in_array($obj->rowid, $arrayofselected)) $selected=1; - print ''; + if (in_array($objecttmp->id, $arrayofselected)) $selected=1; + print ''; } print ''; if (! $i) $totalarray['nbfield']++; print ''; - $total[$obj->currency_code] += $solde; + $total[$objecttmp->currency_code] += $solde; $i++; } diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 58cb526d566..36e8546a897 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -131,7 +131,7 @@ if ($object->id) $totalsize+=$file['size']; } - print ''; + print '
    '; print ''; print ''; diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index c94a527d575..8cba95e283b 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -100,7 +100,7 @@ if ($object->id) } - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
    '; + print '
    '; $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2f4116e938f..e8da06ee2ca 100755 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4280,7 +4280,7 @@ elseif ($id > 0 || ! empty($ref)) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); else print $langs->trans('AlreadyPaid'); - print ' :'; + print ' :'; $resteapayeraffiche = $resteapayer; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; @@ -4359,14 +4359,13 @@ elseif ($id > 0 || ! empty($ref)) // Billed print ''; - // Remainder to pay print ''; - print ''; + print ''; print ''; } else // Credit note @@ -4387,7 +4386,7 @@ elseif ($id > 0 || ! empty($ref)) if ($resteapayeraffiche > 0) print ' ('.$langs->trans('ExcessPaid').')'; print ' :'; - print ''; + print ''; print ''; // Sold credit note diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 15d985db6bf..2e299740290 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1199,9 +1199,10 @@ class Facture extends CommonInvoice * @param int $notooltip 1=Disable tooltip * @param int $addlinktonotes 1=Add link to notes * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param string $target Target of link ('', '_self', '_blank', '_parent', '_backoffice', ...) * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '') { global $langs, $conf, $user, $form; @@ -1254,7 +1255,7 @@ class Facture extends CommonInvoice if ($moretitle) $label.=' - '.$moretitle; } - $linkclose=''; + $linkclose=($target?' target="'.$target.'"':''); if (empty($notooltip) && $user->rights->facture->lire) { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) @@ -2720,7 +2721,7 @@ class Facture extends CommonInvoice // Check parameters if ($type < 0) return -1; - + if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); $this->error=$langs->trans('ErrorStartDateGreaterEnd'); @@ -2929,7 +2930,7 @@ class Facture extends CommonInvoice return -3; } } - + if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); $this->error=$langs->trans('ErrorStartDateGreaterEnd'); diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 9ddefd0ede4..44f69f512bd 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -165,7 +165,7 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; - print '
    0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' 
    ' . price($totalpaye) . ' 
    ' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' 
    '; print $langs->trans('RemainderToPay'); if ($resteapayeraffiche < 0) print ' ('.$langs->trans('ExcessReceived').')'; print ' :' . price($resteapayeraffiche) . '' . price($resteapayeraffiche) . ' 
    ' . price($sign * $resteapayeraffiche) . '' . price($sign * $resteapayeraffiche) . ' 
    '; + print '
    '; print ''; print ''; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 28c6f8ec24a..fa8af87ac29 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1305,7 +1305,7 @@ else print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; - if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) + if ($action != 'editconditions' && $user->rights->facture->creer) print ''; print '
    '; print $langs->trans('PaymentConditionsShort'); print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
    '; print ''; @@ -1329,7 +1329,7 @@ else print ''; - if ($action != 'editmode' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) + if ($action != 'editmode' && $user->rights->facture->creer) print ''; print '
    '; print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
    '; print ''; @@ -1463,7 +1463,7 @@ else print ''; - if ($action != 'editfrequency' && $object->statut == self::STATUS_DRAFT && $user->rights->facture->creer) + if ($action != 'editfrequency' && $user->rights->facture->creer) print ''; print '
    '; print $langs->trans('Frequency'); print 'id . '">' . img_edit($langs->trans('Edit'), 1) . '
    '; print ''; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index b58ac1d1e93..c005e0d70e6 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -26,7 +26,7 @@ /** * \file htdocs/compta/paiement/list.php * \ingroup compta - * \brief Page liste des paiements des factures clients + * \brief Payment page for customer invoices */ require '../../main.inc.php'; @@ -37,9 +37,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; // Load translation files required by the page -$langs->loadLangs(array('bills', 'compta', 'companies')); +$langs->loadLangs(array('bills', 'banks', 'compta', 'companies')); + +$action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); -// Security check $facid = GETPOST('facid', 'int'); $socid = GETPOST('socid', 'int'); $userid = GETPOST('userid', 'int'); @@ -47,6 +50,7 @@ $day = GETPOST('day', 'int'); $month = GETPOST('month', 'int'); $year = GETPOST('year', 'int'); +// Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'facture', $facid, ''); @@ -83,7 +87,7 @@ $arrayfields=array(); * Actions */ -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { $search_ref=""; $search_account=""; @@ -94,22 +98,22 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $day=''; $year=''; $month=''; + $search_array_options=array(); } - /* * View */ -llxHeader('', $langs->trans('ListPayment')); - $form=new Form($db); $formother=new FormOther($db); -if (GETPOST("orphelins")) +llxHeader('', $langs->trans('ListPayment')); + +if (GETPOST("orphelins", "alpha")) { - // Paiements lies a aucune facture (pour aide au diagnostic) + // Payments not linked to an invoice. Should not happend. For debug only. $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code"; @@ -197,7 +201,6 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $i = 0; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); @@ -213,6 +216,7 @@ if ($resql) if ($optioncss != '') print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -228,18 +232,18 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year?$year:-1, 'year', 1, 20, 5); print ''; - print ''; + print ''; print ''; print ''; print ''; $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1); print ''; - print ''; + print ''; print ''; print ''; if (! empty($conf->banque->enabled)) @@ -264,7 +268,7 @@ if ($resql) print ''; print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.libelle", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder); @@ -283,6 +287,8 @@ if ($resql) print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; + $i = 0; + $totalarray=array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); @@ -290,35 +296,39 @@ if ($resql) $paymentstatic->id=$objp->rowid; $paymentstatic->ref=$objp->ref; + $companystatic->id=$objp->socid; + $companystatic->name=$objp->name; + $companystatic->email=$objp->email; + print ''; print ''; print $paymentstatic->getNomUrl(1); print ''; + if (! $i) $totalarray['nbfield']++; // Date $dateformatforpayment = 'day'; if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour'; print ''.dol_print_date($db->jdate($objp->dp), $dateformatforpayment).''; + if (! $i) $totalarray['nbfield']++; // Thirdparty print ''; if ($objp->socid > 0) { - $companystatic->id=$objp->socid; - $companystatic->name=$objp->name; - $companystatic->email=$objp->email; - print $companystatic->getNomUrl(1, '', 24); } - else print ' '; print ''; + if (! $i) $totalarray['nbfield']++; // Type print ''.$langs->trans("PaymentTypeShort".$objp->paiement_code).''; + if (! $i) $totalarray['nbfield']++; // Payment number print ''.$objp->num_paiement.''; + if (! $i) $totalarray['nbfield']++; // Account if (! empty($conf->banque->enabled)) @@ -338,11 +348,15 @@ if ($resql) print $accountstatic->getNomUrl(1); } - else print ' '; print ''; + if (! $i) $totalarray['nbfield']++; } + // Amount print ''.price($objp->amount).''; + if (! $i) $totalarray['nbfield']++; + $totalarray['pos'][7]='amount'; + $totalarray['val']['amount'] += $objp->amount; if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { @@ -351,13 +365,39 @@ if ($resql) print $paymentstatic->LibStatut($objp->statut, 5); if ($objp->statut == 0) print ''; print ''; + if (! $i) $totalarray['nbfield']++; } - print ' '; - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; $i++; } + + // Show total line + if (isset($totalarray['pos'])) + { + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + } + else print ''; + } + } + print ''; + } + print "\n"; print "
    "; print "\n"; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 142dd1b0e1e..b462095278d 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1592,6 +1592,9 @@ class BonPrelevement extends CommonObject { // phpcs:enable global $conf; + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $CrLf = "\n"; $Rowing = sprintf("%06d", $row_idfac); diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 5335b8fc39e..3ff92d23c1c 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -114,7 +114,7 @@ if ($object->id) print '
    '; print '
    '; - print ''; + print '
    '; print ''; print ''; print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index d3093a6f374..8bdbd68bfc4 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -665,7 +665,7 @@ if ($id > 0) $cssforamountpaymentcomplete = 'amountpaymentcomplete'; print ''.$langs->trans("RemainderToPay")." :"; - print ''.price($resteapayer)."\n"; + print ''.price($resteapayer)."\n"; print ""; $db->free($resql); diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 87bef4e69d1..1025f7b11ed 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -145,7 +145,7 @@ if ($object->id) } - print ''; + print '
    '; print ''; print ''; diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index bb8819f9588..78a1029b2f4 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -131,7 +131,7 @@ if ($object->id) } - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; + print '
    '; print ''; print ''; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 1f2f895fed8..86f2dc8c3c9 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -124,7 +124,7 @@ if ($object->id) print '
    '; print '
    '; - print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; + print '
    '; // Company /* diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 79fc66dfce8..7eaa97061d0 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1393,7 +1393,7 @@ class Contrat extends CommonObject if (empty($txtva) || ! is_numeric($txtva)) $txtva=0; if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0; if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0; - + if ($price_base_type=='HT') { $pu=$pu_ht; @@ -1405,13 +1405,13 @@ class Contrat extends CommonObject // Check parameters if (empty($remise_percent)) $remise_percent=0; - + if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); $this->error=$langs->trans('ErrorStartDateGreaterEnd'); return -1; } - + $this->db->begin(); $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); @@ -1603,7 +1603,7 @@ class Contrat extends CommonObject { $remise_percent=0; } - + if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); $this->error=$langs->trans('ErrorStartDateGreaterEnd'); diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 64ecff642f7..27d97572529 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -178,7 +178,7 @@ if ($object->id) print '
    '; - print '
    '; + print '
    '; print ''; print ''; print '
    '.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
    '.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
    '; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 22e30466300..38473252377 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -7,6 +7,7 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -802,6 +803,10 @@ while ($i < min($num, $limit)) } $db->free($resql); +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print ''; print '
    '; diff --git a/htdocs/core/actions_changeselectedfields.inc.php b/htdocs/core/actions_changeselectedfields.inc.php index 4cfc29209b1..1e001e4a7b7 100644 --- a/htdocs/core/actions_changeselectedfields.inc.php +++ b/htdocs/core/actions_changeselectedfields.inc.php @@ -28,7 +28,7 @@ // $object must be defined (object is loaded in this file with fetch) // Save selection -if (GETPOST('formfilteraction') == 'listafterchangingselectedfields') +if (GETPOST('formfilteraction', 'none') == 'listafterchangingselectedfields') { $tabparam=array(); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index bddf190b62c..55dda5a5934 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -539,7 +539,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders { $orders = GETPOST('toselect', 'array'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); - $validate_invoices = GETPOST('valdate_invoices', 'int'); + $validate_invoices = GETPOST('validate_invoices', 'int'); $TFact = array(); $TFactThird = array(); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 3c0e979cbed..ddb1bb0c6d0 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1303,9 +1303,9 @@ class CMailFile * This function has been modified as provided by SirSir to allow multiline responses when * using SMTP Extensions. * - * @param Socket $socket Socket - * @param string $response Response string - * @return boolean true if success + * @param resource $socket Socket + * @param string $response Response string + * @return boolean true if success */ public function server_parse($socket, $response) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7294d77aa07..0f8a7c7d17b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3286,7 +3286,7 @@ abstract class CommonObject * @param string $targettype Object target type * @param int $rowid Row id of line to delete. If defined, other parameters are not used. * @return int >0 if OK, <0 if KO - * @see add_object_linked, updateObjectLinked, fetchObjectLinked + * @see add_object_linked(), updateObjectLinked(), fetchObjectLinked() */ public function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '') { diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 891ea5e4bc6..2713cca3cda 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -39,7 +39,7 @@ abstract class CommonObjectLine extends CommonObject * Id of the line * @var int * @deprecated Try to use id property as possible (even if field into database is still rowid) - * @see id + * @see $id */ public $rowid; diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index ddaef527630..756a8264e04 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -41,7 +41,7 @@ abstract class CommonOrderLine extends CommonObjectLine * Product ref * @var string * @deprecated Use product_ref - * @see product_ref + * @see $product_ref */ public $ref; @@ -55,7 +55,7 @@ abstract class CommonOrderLine extends CommonObjectLine * Product label * @var string * @deprecated Use product_label - * @see product_label + * @see $product_label */ public $libelle; @@ -80,7 +80,7 @@ abstract class CommonOrderLine extends CommonObjectLine /** * Unit price * @deprecated - * @see subprice + * @see $subprice */ public $price; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index ecbecdeee2d..12d6b337fd0 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -659,8 +659,8 @@ class Conf if (! isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1; - $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; - $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; + if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; + if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; // For backward compatibility if (isset($this->product)) $this->produit=$this->product; diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php index cb31a287656..02a083978ef 100644 --- a/htdocs/core/class/coreobject.class.php +++ b/htdocs/core/class/coreobject.class.php @@ -82,7 +82,7 @@ class CoreObject extends CommonObject * * @param string $field name of field * @param string $type type of field to test - * @return value of field or false + * @return boolean value of field or false */ private function checkFieldType($field, $type) { diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 97f5b9b016f..2487d87137f 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -54,7 +54,7 @@ class Cstate // extends CommonObject /** * @var string * @deprecated - * @see name + * @see $name */ public $nom=''; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 514ae0369ed..d947d7c129b 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -257,7 +257,7 @@ class DolGraph * * @param array $data Data * @return void - * @see draw_jflot for syntax of data array + * @see draw_jflot() for syntax of data array */ public function SetData($data) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4f61435f124..32e5149b1c1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -586,7 +586,7 @@ class Form $disabled=0; $ret='
    '; - $ret.=''; // Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks. $parameters=array(); @@ -2321,7 +2321,7 @@ class Form * constructProductListOption. * This define value for &$opt and &$optJson. * - * @param resultset $objp Resultset of fetch + * @param resource $objp Resultset of fetch * @param string $opt Option (var used for returned value in string option format) * @param string $optJson Option (var used for returned value in json format) * @param int $price_level Price level @@ -5153,7 +5153,7 @@ class Form * @param datetime $adddateof Add a link "Date of invoice" using the following date. * @return string|void Nothing or string if nooutput is 1 * @deprecated - * @see form_date, select_month, select_year, select_dayofweek + * @see form_date(), select_month(), select_year(), select_dayofweek() */ public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '') { @@ -6056,7 +6056,7 @@ class Form * @param string $placeholder String to use as placeholder * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string - * @see selectArrayAjax, ajax_combobox in ajax.lib.php + * @see selectArrayAjax(), ajax_combobox() in ajax.lib.php */ public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) { @@ -6304,7 +6304,6 @@ class Form else $array[$key]['checked']=0; } } - //var_dump($array); $lis=''; $listcheckedstring=''; @@ -6774,8 +6773,6 @@ class Form return $resultyesno; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of export templates diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index fa44c8dbcc9..87b32902684 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -224,9 +224,9 @@ class FormAccounting extends Form /** * Return select filter with date of transaction * - * @param string $htmlname Name of select field - * @param string $selectedkey Value - * @return string HTML edit field + * @param string $htmlname Name of select field + * @param string $selectedkey Value + * @return string HTML edit field */ public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { @@ -247,7 +247,7 @@ class FormAccounting extends Form } while ($obj = $this->db->fetch_object($resql)) { - $options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext'); + $options[$obj->import_key] = $obj->import_key; } return Form::selectarray($htmlname, $options, $selectedkey); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 65f92c86948..d42bfcbeb5a 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -215,7 +215,7 @@ class FormCompany * @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param string $htmlname Id of department. If '', we want only the string with