diff --git a/ChangeLog b/ChangeLog index 6fdbcfcd899..6258b36e084 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,9 +6,184 @@ English Dolibarr ChangeLog ***** ChangeLog for 11.0.0 compared to 10.0.0 ***** For Users: +NEW: Module BOM is now stable (Module MO - Manufacturing Order is still in development). +NEW: A nicer dashboard for opened elements on Home page. +NEW: Add task widget and add task progress bar +NEW: Accountancy - Can add specific widget in this accountancy area. +NEW: Accountancy - Add export model LDCompta V9 & higher +NEW: Accountancy - Add permission on export, delete operations in ledger +NEW: Add 2 hidden options to set the default sorting (sort and order) on document page. +NEW: add ability to edit price without tax before adding a line of a predefined product. +NEW: Add a tab to setup "Opening hours" of company (information only). +NEW: Add attendee to ical export + cleanup. +NEW: Add bank data of users into the expense report exports. +NEW: add clone customers prices in clone product or service. +NEW: Add column of module source and POS terminal in the invoice list. +NEW: Add column last modification date into the table of targets for emailing. +NEW: Add column VAT rate in product list +NEW: add constant DISPATCH_FORCE_QTY_INPUT +NEW: Add constant MAIN_DISABLE_GLOBAL_WORKBOARD to disable workboard in home page +NEW: add country code in import product model +NEW: Add 'Direct Cash Payment' button in TakePOS +NEW: Add odt support to supplier orders +NEW: Add experimental SumUp payment to TakePOS (need to set a hidden constant) +NEW: Add feature to search a string into website containers +NEW: Add GET and POST /supplierinvoices/payments REST API endpoints. +NEW: Show progress bar for declared progression of tasks. +NEW: Add hidden option to update supplier buying price during receptions. +NEW: Add hidden option PROPOSAL_SHOW_INVOICED_AMOUNT (not reliable if one invoice is done on several order or several proposal) +NEW: Add hidden option SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT for add possibility to update supplier buying price in the reception on a supplier order +NEW: Add hidden option THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER to copy extrafields from third party to order. +NEW: Add hidden options to send by email even for object with draft status. +NEW: Add last change date in page "Other setup". Can sort page on name/date. +NEW: Add link to export targets of an emailings into a CSV file. +NEW: Add link to the public interface on the ticket card. +NEW: Add location into event tooltip. Use full day for fullday events +NEW: add MAIN_LANGUAGES_ALLOWED constant to limit languages displayed. +NEW: add MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS constant. +NEW: add mass actions in shipment list. +NEW: add minimum stock filter in load warehoues for product form. +NEW: add name_alias in fields to search all +NEW: add new rule fetchidfromcodeandlabel for categories import +NEW: add office phone for salespresentatives +NEW: add office phone & job on user tooltips +NEW: Add option MAIN_PDF_FORCE_FONT_SIZE +NEW: Add option MEMBER_CAN_CONVERT_CUSTOMERS_TO_MEMBERS +NEW: Add option multiselect for developers on the selector of language. +NEW: Add option WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL +NEW: Add pagination on list of object of a category +NEW: add parent category id or label in import category module +NEW: add parent id or ref column in warehouse import +NEW: Can set the Address/Contact by default on third parties. +NEW: Add search into template +NEW: Add shipment widget +NEW: add socialnetworks dictionary +NEW: Add statistics on product into contracts +NEW: Add status of warehouse in tooltip of a warehouse. +NEW: add supplier's product list +NEW: add units fields in buying price tab of product card +NEW: Add units in select products lines +NEW: Add upload document on account statement +NEW: Add widgets for BOMs and MOs +NEW: Amount invoiced column in proposal list +NEW: Ask the new label and new dates in confirm popup when cloning tax +NEW: auto set closing date and user on invoice +NEW: Avoid wrap between picto and text on getNomUrl +NEW: Balance Stripe connect account for supplier +NEW: Bank Add an option for colorize background color of debit or credit movement +NEW: Beautify the select box of warehouses +NEW: birthday widget for member +NEW: Widgets uses fiscal year +NEW: Can change supplier when cloning a Purchase Order +NEW: can choose lines while creating order from origin +NEW: Can crop/resize image attached on a bank record +NEW: Can defined a position of numbering submodules for thirdparties +NEW: Can edit date or RUM mandate. +NEW: Can edit link to the translation page in website module +NEW: Can edit the price of predefined product during adding in documents +NEW: Can enter price tax incl on vendor proposal and purchase orders +NEW: Can filter on description on bank account transaction lists. +NEW: Can filter on label on invoice in accounting vendor binding pages +NEW: Can load multilang translation in same step than fetch_lines +NEW: Can restrict access using DAV module to some host IPs only +NEW: Can restrict API usage to some IP only +NEW: Can select website templates from available default templates with a preview. +NEW: Can set a filter on object linked in modulebuilder. +NEW: Can set a squarred icon on your company setup +NEW: can specify hour start end for selectDate and step for minutes +NEW: Categories/Tags are also available on warehouses +NEW: Check if a resource is in use in an event +NEW: Code for extrafields uses the new array $extrafields->attributes +NEW: Compute column value from others columns in import module +NEW: Copy linked categories on product clone process. +NEW: Default for Stripe is STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION +NEW: Digitaria model for numbering accountancy thirdparty +NEW: Display membership in takepos if member linked to the thirdparty +NEW: Display supplier in objectline if defined +NEW: Add default duration of subscriptions on members type +NEW: Email template for Takepos (to send invoice) +NEW: Expense request and holiday validator fields +NEW: Export ledger table in Charlemagne format +NEW: Export livre Charlemagne +NEW: Extend option ORDER_ADD_ORDERS_WITH_PARENT_PROD_IF_INCDEC for all virtual product stats (renamed into PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC) +NEW: FCKeditor setup for tickets +NEW: GeoIP v2 support is natively provided -> So IPv6 is supported +NEW: List by closing date on order list and proposal list +NEW: Look and feel v11: Some setup pages are by default direclty in edit mode. +NEW: Management of retained warranty on situation invoices +NEW: Mass email action on invoice list use billing contact if exists +NEW: more living colors for charts and option for "color bind" people +NEW: Supports multiple payments in a TakePOS sale +NEW: multiselect with checkbox in categories/tags search for product list +NEW: Option to allow to create members from third-party +NEW: Platform compliance with Stripe Connect +NEW: print / send email form in TakePOS +NEW: Public holidays are now in a dictionary table (no more hard coded per country) +NEW: Better performance by reducing the $companystatic calls on some pages. +NEW: Replace the "info" tab on contract with the more complete "agenda" tab. +NEW: Save user of last modification in donation record. +NEW: Show html combo list instead input text for extrafields typed as list. +NEW: Show POS application and the terminal used on invoice card. +NEW: Add categories/tags for stocks. +NEW: Support Net Measure in product's card.php +NEW: Extrafields separator can be collapsed or not +NEW: Extrafields support on Leave requests. +NEW: Extrafields support on Salaries. +NEW: Extrafields support in Product supplier prices. +NEW: Add extrafields for warehouses +NEW: Add extrafields in export of expense report (and holiday) +NEW: The integrity checker now show also the expected size of files. +NEW: The order method in purchase order is now mandatory when recording an order. +NEW: update / delete stripe account for supplier +NEW: Use the gender of member for picto in member lists. +NEW: Use the squarre logo as favicon of pages +NEW: VAT list - Add date start & date end in filters +NEW: widget box for supplier orders awaiting reception +NEW: Update translations +NEW: #4301 -For Developers: +For Developers or integrators: +NEW: Add a manifest.json.php file for web app. +NEW: Removed deprecated code that create linked object from ->origin +NEW: experimental zapier for dolibarr +NEW: Accountancy - Add hook bookkeepinglist on general ledger +NEW: Can update product type with the update method. +NEW: add API shipment mode dictionnary +NEW: Add API to get Country by code and iso +NEW: Add API to get objects by ref, ref_ext, ... +NEW: Add anonymous telemetry +NEW: Add a category to a contact in API +NEW: Add fk projet on stock movement +NEW: Add hidden option to set fields for the quick search on products. +NEW: add hook on commongeneratedocument +NEW: Add hook on fileupload.class.php to enable modules to override… +NEW: Add hooks on index pages +NEW: adding 'formObjectOptions' hooks loading at card.php of adherents module +NEW: Add method getStructuredData for website +NEW: Add payments GET and POST REST API endpoints for supplierinvoices. +NEW: Add POST /bankaccounts/transfer REST API endpoint. +NEW: add "printBucktrackInfo" hook, an external module can add info +NEW: Add trigger DIRECT_DEBIT_ORDER_CREATE on widthdraw is missing +NEW: API to post documents for "product" and Delete document +NEW: add new function "setEntity()" and better compatibility with Multicompany +NEW: Can add a button "Create" after combo of object with modulebuilder. +NEW: contacts type dictionnary in api_setup.class.php +NEW: Look and feel v11: Introduce CSS "trforbreak" +NEW: list of measuring units API +NEW: get social networks dictionary by API +NEW: Get thirdparty's salesrepresentatives by API +NEW: get user connected informations in REST API +NEW: mode for list thirdparty API (add easy filter for supplier only) +NEW: purchase_prices API +NEW: Provides more complete demo data +NEW: Module builder can generate CSS of JS file. +NEW: Use a dedicated css for the pencil to edit a field. +NEW: multilangs in fetch_lines +NEW: Add more complete info for triggers actioncom +NEW: add multicurrency rate at currency list API +NEW: Update jquery library to 3.4.1 +NEW: Upgrade ACE editor to v1.4.6 WARNING: @@ -31,6 +206,8 @@ Following changes may create regressions for some external modules, but were nec * Renamed property of thirdparty "statut_commercial" into "status_prospect_label" * The jquery plugin/dependency multiselect has been removed. It was not used by Dolibarr core. + + ***** ChangeLog for 10.0.3 compared to 10.0.2 ***** IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card. The unit were not saved correctly in database making calculation on shipments wrong. diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index f6146cb409b..6bd27da529b 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -75,7 +75,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 610bd875c4f..6a719c25b5f 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2012 Mikael Carlavan * Copyright (C) 2017 ATM Consulting * Copyright (C) 2017 Pierre-Henry Favre - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,8 +44,8 @@ $action = GETPOST('action', 'alpha'); $id = GETPOST('id', 'int'); $apply_to = GETPOST('apply_to'); -$fk_user = GETPOST('fk_user'); -$fk_usergroup = GETPOST('fk_usergroup'); +$fk_user = GETPOST('fk_user', 'int'); +$fk_usergroup = GETPOST('fk_usergroup', 'int'); $fk_c_type_fees = GETPOST('fk_c_type_fees'); $code_expense_rules_type = GETPOST('code_expense_rules_type'); @@ -97,11 +97,11 @@ if ($action == 'save') $object->setValues($_POST); if($apply_to=='U'){ - $object->fk_user=$fk_user; + $object->fk_user = (int) $fk_user; $object->fk_usergroup=0; $object->is_for_all=0; }elseif($apply_to=='G'){ - $object->fk_usergroup=$fk_usergroup; + $object->fk_usergroup = (int) $fk_usergroup; $object->fk_user=0; $object->is_for_all=0; }elseif($apply_to=='A'){ diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index f0b0218c0e5..5f6d52e1169 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -43,7 +43,7 @@ $type='contract'; if (empty($conf->global->HOLIDAY_ADDON)) { - $conf->global->HOLIDAY_ADDON='mod_holiday_madona'; + $conf->global->HOLIDAY_ADDON = 'mod_holiday_madonna'; } diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 546a322fcdf..5f59a198fa4 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -384,7 +384,9 @@ if ($action == 'edit') if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { $mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:''); - print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''; + print ''; + print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword")); + print ''; // SuperAdministrator access only if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) { diff --git a/htdocs/admin/system/os.php b/htdocs/admin/system/os.php index 7399a218e9c..d171fcaa2ec 100644 --- a/htdocs/admin/system/os.php +++ b/htdocs/admin/system/os.php @@ -42,11 +42,11 @@ print ''.$langs->trans("Parameter").''.$lan print "\n"; // Recupere l'OS au sens PHP -print "".$langs->trans("PHP_OS")."".PHP_OS."\n"; +print ''.$langs->trans("PHP_OS")."".PHP_OS."\n"; // Recupere la version de l'OS $osversion=version_os(); -print "".$langs->trans("Version")."".$osversion."\n"; +print ''.$langs->trans("Version")."".$osversion."\n"; print ''; // End of page diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 448f5d15ed9..4785ab78174 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -79,7 +79,7 @@ class Documents extends DolibarrApi } //--- Finds and returns the document - $entity=$conf->entity; + $entity = $conf->entity; $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read'); $accessallowed = $check_access['accessallowed']; @@ -94,16 +94,16 @@ class Documents extends DolibarrApi } $filename = basename($original_file); - $original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset + $original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset - if (! file_exists($original_file_osencoded)) + if (!file_exists($original_file_osencoded)) { dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING); throw new RestException(404, 'File not found'); } - $file_content=file_get_contents($original_file_osencoded); - return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'encoding'=>'base64' ); + $file_content = file_get_contents($original_file_osencoded); + return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'encoding'=>'base64'); } @@ -141,12 +141,12 @@ class Documents extends DolibarrApi $outputlangs = $langs; if ($langcode && $langs->defaultlang != $langcode) { - $outputlangs=new Translate('', $conf); + $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($langcode); } //--- Finds and returns the document - $entity=$conf->entity; + $entity = $conf->entity; $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'write'); $accessallowed = $check_access['accessallowed']; @@ -165,20 +165,20 @@ class Documents extends DolibarrApi $hidedesc = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 0 : 1; $hideref = empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 0 : 1; - $templateused=''; + $templateused = ''; if ($modulepart == 'facture' || $modulepart == 'invoice') { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $this->invoice = new Facture($this->db); $result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Invoice not found'); } - $templateused = $doctemplate?$doctemplate:$this->invoice->modelpdf; + $templateused = $doctemplate ? $doctemplate : $this->invoice->modelpdf; $result = $this->invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); - if( $result <= 0 ) { + if ($result <= 0) { throw new RestException(500, 'Error generating document'); } } @@ -187,12 +187,12 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $this->order = new Commande($this->db); $result = $this->order->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Order not found'); } - $templateused = $doctemplate?$doctemplate:$this->order->modelpdf; + $templateused = $doctemplate ? $doctemplate : $this->order->modelpdf; $result = $this->order->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); - if( $result <= 0 ) { + if ($result <= 0) { throw new RestException(500, 'Error generating document'); } } @@ -201,12 +201,12 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $this->propal = new Propal($this->db); $result = $this->propal->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Proposal not found'); } - $templateused = $doctemplate?$doctemplate:$this->propal->modelpdf; + $templateused = $doctemplate ? $doctemplate : $this->propal->modelpdf; $result = $this->propal->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); - if( $result <= 0 ) { + if ($result <= 0) { throw new RestException(500, 'Error generating document'); } } @@ -216,15 +216,15 @@ class Documents extends DolibarrApi } $filename = basename($original_file); - $original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset + $original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset - if (! file_exists($original_file_osencoded)) + if (!file_exists($original_file_osencoded)) { throw new RestException(404, 'File not found'); } - $file_content=file_get_contents($original_file_osencoded); - return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'base64' ); + $file_content = file_get_contents($original_file_osencoded); + return array('filename'=>$filename, 'content-type' => dol_mimetype($filename), 'filesize'=>filesize($original_file), 'content'=>base64_encode($file_content), 'langcode'=>$outputlangs->defaultlang, 'template'=>$templateused, 'encoding'=>'base64'); } /** @@ -257,7 +257,7 @@ class Documents extends DolibarrApi throw new RestException(400, 'bad value for parameter id or ref'); } - $id = (empty($id)?0:$id); + $id = (empty($id) ? 0 : $id); if ($modulepart == 'societe' || $modulepart == 'thirdparty') { @@ -268,12 +268,12 @@ class Documents extends DolibarrApi } $object = new Societe($this->db); - $result=$object->fetch($id, $ref); - if ( ! $result ) { + $result = $object->fetch($id, $ref); + if (!$result) { throw new RestException(404, 'Thirdparty not found'); } - $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id; + $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id; } elseif ($modulepart == 'adherent' || $modulepart == 'member') { @@ -284,12 +284,12 @@ class Documents extends DolibarrApi } $object = new Adherent($this->db); - $result=$object->fetch($id, $ref); - if ( ! $result ) { + $result = $object->fetch($id, $ref); + if (!$result) { throw new RestException(404, 'Member not found'); } - $upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member'); + $upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member'); } elseif ($modulepart == 'propal' || $modulepart == 'proposal') { @@ -300,12 +300,12 @@ class Documents extends DolibarrApi } $object = new Propal($this->db); - $result=$object->fetch($id, $ref); - if ( ! $result ) { + $result = $object->fetch($id, $ref); + if (!$result) { throw new RestException(404, 'Proposal not found'); } - $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal'); + $upload_dir = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal'); } elseif ($modulepart == 'commande' || $modulepart == 'order') { @@ -316,12 +316,12 @@ class Documents extends DolibarrApi } $object = new Commande($this->db); - $result=$object->fetch($id, $ref); - if ( ! $result ) { + $result = $object->fetch($id, $ref); + if (!$result) { throw new RestException(404, 'Order not found'); } - $upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande'); + $upload_dir = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande'); } elseif ($modulepart == 'shipment' || $modulepart == 'expedition') { @@ -332,12 +332,12 @@ class Documents extends DolibarrApi } $object = new Expedition($this->db); - $result=$object->fetch($id, $ref); - if ( ! $result ) { + $result = $object->fetch($id, $ref); + if (!$result) { throw new RestException(404, 'Shipment not found'); } - $upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment'); + $upload_dir = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment'); } elseif ($modulepart == 'facture' || $modulepart == 'invoice') { @@ -348,12 +348,12 @@ class Documents extends DolibarrApi } $object = new Facture($this->db); - $result=$object->fetch($id, $ref); - if ( ! $result ) { + $result = $object->fetch($id, $ref); + if (!$result) { throw new RestException(404, 'Invoice not found'); } - $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); + $upload_dir = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice'); } elseif ($modulepart == 'produit' || $modulepart == 'product') { @@ -364,8 +364,8 @@ class Documents extends DolibarrApi } $object = new Product($this->db); - $result=$object->fetch($id, $ref); - if ( ! $result ) { + $result = $object->fetch($id, $ref); + if (!$result) { throw new RestException(404, 'Product not found'); } @@ -380,8 +380,8 @@ class Documents extends DolibarrApi } $object = new ActionComm($this->db); - $result=$object->fetch($id, $ref); - if ( ! $result ) { + $result = $object->fetch($id, $ref); + if (!$result) { throw new RestException(404, 'Event not found'); } @@ -392,9 +392,9 @@ class Documents extends DolibarrApi throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); } - $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); if (empty($filearray)) { - throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' or Ref '.$object->ref:'').' does not return any document.'); + throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(!empty($object->Ref) ? ' or Ref '.$object->ref : '').' does not return any document.'); } return $filearray; @@ -447,7 +447,7 @@ class Documents extends DolibarrApi var_dump($filecontent); exit;*/ - if(empty($modulepart)) + if (empty($modulepart)) { throw new RestException(400, 'Modulepart not provided.'); } @@ -467,11 +467,11 @@ class Documents extends DolibarrApi $entity = DolibarrApiAccess::$user->entity; if ($ref) { - $tmpreldir=''; + $tmpreldir = ''; if ($modulepart == 'facture' || $modulepart == 'invoice') { - $modulepart='facture'; + $modulepart = 'facture'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object = new Facture($this->db); @@ -491,11 +491,11 @@ class Documents extends DolibarrApi $task_result = $object->fetch('', $ref); // Fetching the tasks project is required because its out_dir might be a sub-directory of the project - if($task_result > 0) + if ($task_result > 0) { $project_result = $object->fetch_projet(); - if($project_result >= 0) + if ($project_result >= 0) { $tmpreldir = dol_sanitizeFileName($object->project->ref).'/'; } @@ -516,11 +516,11 @@ class Documents extends DolibarrApi throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); } - if(is_object($object)) + if (is_object($object)) { $result = $object->fetch('', $ref); - if($result == 0) + if ($result == 0) { throw new RestException(404, "Object with ref '".$ref."' was not found."); } @@ -530,7 +530,7 @@ class Documents extends DolibarrApi } } - if (! ($object->id > 0)) + if (!($object->id > 0)) { throw new RestException(404, 'The object '.$modulepart." with ref '".$ref."' was not found."); } @@ -538,7 +538,7 @@ class Documents extends DolibarrApi $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write'); - $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir + $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir if (empty($upload_dir) || $upload_dir == '/') { @@ -547,12 +547,12 @@ class Documents extends DolibarrApi } else { - if ($modulepart == 'invoice') $modulepart ='facture'; + if ($modulepart == 'invoice') $modulepart = 'facture'; $relativefile = $subdir; $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write'); - $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir + $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir if (empty($upload_dir) || $upload_dir == '/') { @@ -568,8 +568,8 @@ class Documents extends DolibarrApi throw new RestException(500, 'Error while trying to create directory.'); } - $destfile = $upload_dir . '/' . $original_file; - $destfiletmp = DOL_DATA_ROOT.'/admin/temp/' . $original_file; + $destfile = $upload_dir.'/'.$original_file; + $destfiletmp = DOL_DATA_ROOT.'/admin/temp/'.$original_file; dol_delete_file($destfiletmp); //var_dump($original_file);exit; @@ -577,7 +577,7 @@ class Documents extends DolibarrApi throw new RestException(401, 'Directory not exists : '.dirname($destfile)); } - if (! $overwriteifexists && dol_is_file($destfile)) + if (!$overwriteifexists && dol_is_file($destfile)) { throw new RestException(500, "File with name '".$original_file."' already exists."); } @@ -595,7 +595,7 @@ class Documents extends DolibarrApi } $result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1); - if (! $result) + if (!$result) { throw new RestException(500, "Failed to move file into '".$destfile."'"); } @@ -629,7 +629,7 @@ class Documents extends DolibarrApi } //--- Finds and returns the document - $entity=$conf->entity; + $entity = $conf->entity; $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read'); $accessallowed = $check_access['accessallowed']; @@ -644,9 +644,9 @@ class Documents extends DolibarrApi } $filename = basename($original_file); - $original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset + $original_file_osencoded = dol_osencode($original_file); // New file name encoded in OS encoding charset - if (! file_exists($original_file_osencoded)) + if (!file_exists($original_file_osencoded)) { dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING); throw new RestException(404, 'File not found'); diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 1f6966fcd15..b23bf03f29b 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -60,7 +60,7 @@ foreach ($object->fields as $key => $val) if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'asset', $id); diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 3c91c91a675..c6488f9e0be 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -40,7 +40,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')) $ref = GETPOST('ref', 'alpha'); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'asset', $id); diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index 79e80518557..9af78befa0b 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -46,7 +46,7 @@ $hookmanager->initHooks(array('assetnote')); // Note that conf->hooks_modules co $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'asset', $id); diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index d0cf2995081..8e0afc77d0a 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -53,7 +53,7 @@ else $search_agenda_label=GETPOST('search_agenda_label'); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'bom', $id); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 38ccb13b6b5..252caa8da10 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -70,16 +70,16 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); -$permissionnote=$user->rights->bom->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$upload_dir = $conf->bom->multidir_output[isset($object->entity)?$object->entity:1]; +$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1]; /* @@ -521,29 +521,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea * Lines */ - if (! empty($object->table_element_line)) + if (!empty($object->table_element_line)) { // Show object lines $result = $object->getLinesArray(); - print '
- - + print ' + + - + '; - if (! empty($conf->use_javascript_ajax) && $object->status == 0) { - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } print '
'; - if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print ''; } - if (! empty($object->lines)) + if (!empty($object->lines)) { $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl'); } @@ -561,7 +561,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'; } @@ -613,11 +613,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { if (is_array($object->lines) && count($object->lines) > 0) { - print '' . $langs->trans("Validate") . ''; + print ''.$langs->trans("Validate").''; } else { - print '' . $langs->trans("Validate") . ''; + print ''.$langs->trans("Validate").''; } } } diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 9c2280e889b..6ac836fdcae 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -41,7 +41,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')) $ref = GETPOST('ref', 'alpha'); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'bom', $id); diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index e37a64d0f28..8d4e2241e97 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -47,7 +47,7 @@ $hookmanager->initHooks(array('bomnote', 'globalcard')); // Note that conf->hook $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'bom', $id); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 2556c2d2084..ed6091e3568 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -167,7 +167,7 @@ if ($object->id) print "\n"; print '
'; - print dol_fiche_end(); + dol_fiche_end(); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 4a38ff4096a..1a44efa45ec 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -628,7 +628,7 @@ if ($resql) if (!empty($arrayfields['ava.rowid']['checked'])) { print ''; - print $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1); + $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1); print ajax_combobox('search_availability'); print ''; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0c093d561c0..ef15d983d20 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -977,35 +977,22 @@ class Commande extends CommonOrder $sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id; if ($this->db->query($sql)) { - if ($this->id) + $this->ref = $initialref; + + if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects { - $this->ref = $initialref; + $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds + } - if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects + // Add object linked + if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects)) + { + foreach ($this->linked_objects as $origin => $tmp_origin_id) { - $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds - } - - // Add object linked - if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects)) - { - foreach ($this->linked_objects as $origin => $tmp_origin_id) + if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) { - if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...)) + foreach ($tmp_origin_id as $origin_id) { - foreach ($tmp_origin_id as $origin_id) - { - $ret = $this->add_object_linked($origin, $origin_id); - if (!$ret) - { - $this->error = $this->db->lasterror(); - $error++; - } - } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) - { - $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); if (!$ret) { @@ -1014,44 +1001,54 @@ class Commande extends CommonOrder } } } + else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + { + $origin_id = $tmp_origin_id; + $ret = $this->add_object_linked($origin, $origin_id); + if (!$ret) + { + $this->error = $this->db->lasterror(); + $error++; + } + } } + } - if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) // Get contact from origin object + if (!$error && $this->id && !empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && !empty($this->origin) && !empty($this->origin_id)) // Get contact from origin object + { + $originforcontact = $this->origin; + $originidforcontact = $this->origin_id; + if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order { - $originforcontact = $this->origin; - $originidforcontact = $this->origin_id; - if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; + $exp = new Expedition($this->db); + $exp->fetch($this->origin_id); + $exp->fetchObjectLinked(); + if (count($exp->linkedObjectsIds['commande']) > 0) { - require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; - $exp = new Expedition($this->db); - $exp->fetch($this->origin_id); - $exp->fetchObjectLinked(); - if (count($exp->linkedObjectsIds['commande']) > 0) + foreach ($exp->linkedObjectsIds['commande'] as $key => $value) { - foreach ($exp->linkedObjectsIds['commande'] as $key => $value) - { - $originforcontact = 'commande'; - if (is_object($value)) $originidforcontact = $value->id; - else $originidforcontact = $value; - break; // We take first one - } + $originforcontact = 'commande'; + if (is_object($value)) $originidforcontact = $value->id; + else $originidforcontact = $value; + break; // We take first one } } - - $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; - $sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; - - $resqlcontact = $this->db->query($sqlcontact); - if ($resqlcontact) - { - while ($objcontact = $this->db->fetch_object($resqlcontact)) - { - //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; - $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object - } - } - else dol_print_error($resqlcontact); } + + $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; + + $resqlcontact = $this->db->query($sqlcontact); + if ($resqlcontact) + { + while ($objcontact = $this->db->fetch_object($resqlcontact)) + { + //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; + $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object + } + } + else dol_print_error($resqlcontact); } if (!$error) diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 8d5afb985a3..6714e25ddeb 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -174,7 +174,7 @@ if ($id > 0 || !empty($ref)) print "\n"; - print dol_fiche_end(); + dol_fiche_end(); $modulepart = 'commande'; $permission = $user->rights->commande->creer; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 15f6a1236d5..0f0c3d11386 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -107,7 +107,7 @@ else { dol_print_error($db); } - if (empty($min)) $min = dol_now - 3600 * 24; + if (empty($min)) $min = dol_now() - 3600 * 24; $log="graph.php: min=".$min." max=".$max; dol_syslog($log); diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 515e5308903..24d49040c13 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -231,7 +231,7 @@ else print ''; - print dol_fiche_end(); + dol_fiche_end(); // Actions buttons diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 193bcdae2d6..0f5a5e35225 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -56,7 +56,7 @@ class box_task extends ModeleBoxes */ public function __construct($db, $param = '') { - global $user, $langs; + global $conf, $user, $langs; // Load translation files required by the page $langs->loadLangs(array('boxes', 'projects')); @@ -64,7 +64,7 @@ class box_task extends ModeleBoxes $this->boxlabel = "Tasks"; $this->db = $db; - $this->hidden = !($user->rights->projet->lire); + $this->hidden = (!empty($conf->global->PROJECT_HIDE_TASKS) || !($user->rights->projet->lire)); } /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bbd11c8f522..ef34ab5093f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7029,7 +7029,7 @@ abstract class CommonObject if ($nbbyrow > 0) { - if ($nbphoto == 1) $return .= ''; + if ($nbphoto == 1) $return .= '
'; if ($nbphoto % $nbbyrow == 1) $return .= ''; $return .= '
'; diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 4c728256413..f6537bf6528 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -53,7 +53,14 @@ class Events // extends CommonObject */ public $error=''; + /** + * @var int timestamp + */ public $tms; + + /** + * @var string Type + */ public $type; /** @@ -63,8 +70,14 @@ class Events // extends CommonObject public $dateevent; + /** + * @var string IP + */ public $ip; + /** + * @var string User agent + */ public $user_agent; /** @@ -179,7 +192,7 @@ class Events // extends CommonObject public function update($user = null, $notrigger = 0) { // Clean parameters - $this->id=trim($this->id); + $this->id = (int) $this->id; $this->type=trim($this->type); $this->description=trim($this->description); @@ -234,7 +247,7 @@ class Events // extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; + $this->id = $obj->rowid; $this->tms = $this->db->jdate($obj->tms); $this->type = $obj->type; $this->entity = $obj->entity; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 889a38efddb..8479db591d9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -557,7 +557,7 @@ class ExtraFields } else { - print dol_print_error($this->db); + dol_print_error($this->db); return -1; } } @@ -813,7 +813,7 @@ class ExtraFields else { $this->db->rollback(); - print dol_print_error($this->db); + dol_print_error($this->db); return -1; } } diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index 0277630ae78..2a2a6c97078 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -64,6 +64,7 @@ class FormCron extends Form global $langs; $langs->load('cron@cron'); + $out = ''; if (!empty($readonly)) { if ($selected=='command') { $out= $langs->trans('CronType_command'); diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index a21f06dacfe..e29b817b0b7 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -421,14 +421,13 @@ class FormTicket if ($withdolfichehead) dol_fiche_end(); - print '
'; + print '
'; print ''; - if ($this->withcancel) { - print "     "; + print "      "; print "trans("Cancel")."\">"; } - print "
\n"; + print ''; print "\n"; print "\n"; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 8991e1ad23b..d2626414ba6 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -326,7 +326,7 @@ function ajax_multiautocompleter($htmlname, $fields, $url, $option = '', $minLen * @param string $message Message of dialog box * @param int $w Width of dialog box * @param int $h height of dialog box - * @return void + * @return string */ function ajax_dialog($title, $message, $w = 350, $h = 150) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9faa3762111..0d614198d1e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5956,16 +5956,18 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__'; $substitutionarray['__THIRDPARTY_PHONE__'] = '__THIRDPARTY_PHONE__'; $substitutionarray['__THIRDPARTY_FAX__'] = '__THIRDPARTY_FAX__'; - $substitutionarray['__THIRDPARTY_ADRESS__'] = '__THIRDPARTY_ADRESS__'; + $substitutionarray['__THIRDPARTY_ADDRESS__'] = '__THIRDPARTY_ADDRESS__'; $substitutionarray['__THIRDPARTY_ZIP__'] = '__THIRDPARTY_ZIP__'; $substitutionarray['__THIRDPARTY_TOWN__'] = '__THIRDPARTY_TOWN__'; - $substitutionarray['__THIRDPARTY_SIREN__'] = '__THIRDPARTY_SIREN__'; - $substitutionarray['__THIRDPARTY_SIRET__'] = '__THIRDPARTY_SIRET__'; - $substitutionarray['__THIRDPARTY_APE__'] = '__THIRDPARTY_APE__'; - $substitutionarray['__THIRDPARTY_RCSRM__'] = '__THIRDPARTY_RCSRM__'; + $substitutionarray['__THIRDPARTY_IDPROF1__'] = '__THIRDPARTY_IDPROF1__'; + $substitutionarray['__THIRDPARTY_IDPROF2__'] = '__THIRDPARTY_IDPROF2__'; + $substitutionarray['__THIRDPARTY_IDPROF3__'] = '__THIRDPARTY_IDPROF3__'; + $substitutionarray['__THIRDPARTY_IDPROF4__'] = '__THIRDPARTY_IDPROF4__'; + $substitutionarray['__THIRDPARTY_IDPROF5__'] = '__THIRDPARTY_IDPROF5__'; + $substitutionarray['__THIRDPARTY_IDPROF6__'] = '__THIRDPARTY_IDPROF6__'; $substitutionarray['__THIRDPARTY_TVAINTRA__'] = '__THIRDPARTY_TVAINTRA__'; - /*$substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = '__THIRDPARTY_NOTE_PUBLIC__'; - $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = '__THIRDPARTY_NOTE_PRIVATE__';*/ + $substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = '__THIRDPARTY_NOTE_PUBLIC__'; + $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = '__THIRDPARTY_NOTE_PRIVATE__'; } if (!empty($conf->adherent->enabled)) { @@ -6059,41 +6061,49 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if (is_object($object) && $object->element == 'societe') { - $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object) ? $object->id : ''); - $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object) ? $object->name : ''); - $substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object) ? $object->name_alias : ''); - $substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object) ? $object->code_client : ''); - $substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object) ? $object->code_fournisseur : ''); - $substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object) ? $object->email : ''); - $substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object) ? $object->phone : ''); - $substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object) ? $object->name_fax : ''); - $substitutionarray['__THIRDPARTY_ADRESS__'] = (is_object($object) ? $object->address : ''); - $substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object) ? $object->zip : ''); - $substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object) ? $object->town : ''); - $substitutionarray['__THIRDPARTY_SIREN__'] = (is_object($object) ? $object->idprof1 : ''); - $substitutionarray['__THIRDPARTY_SIRET__'] = (is_object($object) ? $object->idprof2 : ''); - $substitutionarray['__THIRDPARTY_APE__'] = (is_object($object) ? $object->idprof3 : ''); - $substitutionarray['__THIRDPARTY_RCSRM__'] = (is_object($object) ? $object->idprof4 : ''); - $substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object) ? $object->tva_intra : ''); + $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object)?$object->id:''); + $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object)?$object->name:''); + $substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object)?$object->name_alias:''); + $substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object)?$object->code_client:''); + $substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object)?$object->code_fournisseur:''); + $substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object)?$object->email:''); + $substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object)?$object->phone:''); + $substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object)?$object->fax:''); + $substitutionarray['__THIRDPARTY_ADDRESS__'] = (is_object($object)?$object->address:''); + $substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object)?$object->zip:''); + $substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object)?$object->town:''); + $substitutionarray['__THIRDPARTY_IDPROF1__'] = (is_object($object)?$object->idprof1:''); + $substitutionarray['__THIRDPARTY_IDPROF2__'] = (is_object($object)?$object->idprof2:''); + $substitutionarray['__THIRDPARTY_IDPROF3__'] = (is_object($object)?$object->idprof3:''); + $substitutionarray['__THIRDPARTY_IDPROF4__'] = (is_object($object)?$object->idprof4:''); + $substitutionarray['__THIRDPARTY_IDPROF5__'] = (is_object($object)?$object->idprof5:''); + $substitutionarray['__THIRDPARTY_IDPROF6__'] = (is_object($object)?$object->idprof6:''); + $substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object)?$object->tva_intra:''); + $substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = (is_object($object)?dol_htmlentitiesbr($object->note_public):''); + $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = (is_object($object)?dol_htmlentitiesbr($object->note_private):''); } elseif (is_object($object->thirdparty) && $object->thirdparty->id > 0) { - $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty) ? $object->thirdparty->id : ''); - $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty) ? $object->thirdparty->name : ''); - $substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object->thirdparty) ? $object->thirdparty->name_alias : ''); - $substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object->thirdparty) ? $object->thirdparty->code_client : ''); - $substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object->thirdparty) ? $object->thirdparty->code_fournisseur : ''); - $substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object->thirdparty) ? $object->thirdparty->email : ''); - $substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object->thirdparty) ? $object->phone : ''); - $substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object->thirdparty) ? $object->name_fax : ''); - $substitutionarray['__THIRDPARTY_ADRESS__'] = (is_object($object->thirdparty) ? $object->address : ''); - $substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object->thirdparty) ? $object->zip : ''); - $substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object->thirdparty) ? $object->town : ''); - $substitutionarray['__THIRDPARTY_SIREN__'] = (is_object($object->thirdparty) ? $object->idprof1 : ''); - $substitutionarray['__THIRDPARTY_SIRET__'] = (is_object($object->thirdparty) ? $object->idprof2 : ''); - $substitutionarray['__THIRDPARTY_APE__'] = (is_object($object->thirdparty) ? $object->idprof3 : ''); - $substitutionarray['__THIRDPARTY_RCSRM__'] = (is_object($object->thirdparty) ? $object->idprof4 : ''); - $substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object->thirdparty) ? $object->tva_intra : ''); + $substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:''); + $substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:''); + $substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object->thirdparty)?$object->thirdparty->name_alias:''); + $substitutionarray['__THIRDPARTY_CODE_CLIENT__'] = (is_object($object->thirdparty)?$object->thirdparty->code_client:''); + $substitutionarray['__THIRDPARTY_CODE_FOURNISSEUR__'] = (is_object($object->thirdparty)?$object->thirdparty->code_fournisseur:''); + $substitutionarray['__THIRDPARTY_EMAIL__'] = (is_object($object->thirdparty)?$object->thirdparty->email:''); + $substitutionarray['__THIRDPARTY_PHONE__'] = (is_object($object->thirdparty)?$object->thirdparty->phone:''); + $substitutionarray['__THIRDPARTY_FAX__'] = (is_object($object->thirdparty)?$object->thirdparty->fax:''); + $substitutionarray['__THIRDPARTY_ADDRESS__'] = (is_object($object->thirdparty)?$object->thirdparty->address:''); + $substitutionarray['__THIRDPARTY_ZIP__'] = (is_object($object->thirdparty)?$object->thirdparty->zip:''); + $substitutionarray['__THIRDPARTY_TOWN__'] = (is_object($object->thirdparty)?$object->thirdparty->town:''); + $substitutionarray['__THIRDPARTY_IDPROF1__'] = (is_object($object->thirdparty)?$object->thirdparty->idprof1:''); + $substitutionarray['__THIRDPARTY_IDPROF2__'] = (is_object($object->thirdparty)?$object->thirdparty->idprof2:''); + $substitutionarray['__THIRDPARTY_IDPROF3__'] = (is_object($object->thirdparty)?$object->thirdparty->idprof3:''); + $substitutionarray['__THIRDPARTY_IDPROF4__'] = (is_object($object->thirdparty)?$object->thirdparty->idprof4:''); + $substitutionarray['__THIRDPARTY_IDPROF5__'] = (is_object($object->thirdparty)?$object->thirdparty->idprof5:''); + $substitutionarray['__THIRDPARTY_IDPROF6__'] = (is_object($object->thirdparty)?$object->thirdparty->idprof6:''); + $substitutionarray['__THIRDPARTY_TVAINTRA__'] = (is_object($object->thirdparty)?$object->thirdparty->tva_intra:''); + $substitutionarray['__THIRDPARTY_NOTE_PUBLIC__'] = (is_object($object->thirdparty)?dol_htmlentitiesbr($object->thirdparty->note_public):''); + $substitutionarray['__THIRDPARTY_NOTE_PRIVATE__'] = (is_object($object->thirdparty)?dol_htmlentitiesbr($object->thirdparty->note_private):''); } if (is_object($object->project) && $object->project->id > 0) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 12d9b06fee6..0356ecc8b23 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1564,11 +1564,13 @@ function dol_print_reduction($reduction, $langs) * Return OS version. * Note that PHP_OS returns only OS (not version) and OS PHP was built on, not necessarly OS PHP runs on. * - * @return string OS version + * @param string $option Option string + * @return string OS version */ -function version_os() +function version_os($option = '') { - $osversion = php_uname(); + if ($option == 'smr') $osversion = php_uname('s').' '.php_uname('m').' '.php_uname('r'); + else $osversion = php_uname(); return $osversion; } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 875705cd8c3..58a46aef0ec 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1990,11 +1990,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } /** - * @param task $task Task the task object - * @param label $label bool|string true = auto, false = dont display, string = replace output - * @param progressNumber $progressNumber bool|string true = auto, false = dont display, string = replace output - * @param hideOnProgressNull $hideOnProgressNull bool hide if progress is null - * @param spaced $spaced bool used to add space at bottom (made by css) + * @param Task $task the task object + * @param bool|string $label true = auto, false = dont display, string = replace output + * @param bool|string $progressNumber true = auto, false = dont display, string = replace output + * @param bool $hideOnProgressNull hide if progress is null + * @param bool $spaced used to add space at bottom (made by css) * @return string * @see getTaskProgressBadge() */ @@ -2113,10 +2113,10 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide return $out; } /** - * @param task $task Task the task object - * @param label $label string empty = auto (progress), string = replace output - * @param tooltip $tooltip string empty = auto , string = replace output - * @return string + * @param Task $task the task object + * @param string $label empty = auto (progress), string = replace output + * @param string $tooltip empty = auto , string = replace output + * @return string * @see getTaskProgressView() */ function getTaskProgressBadge($task, $label = '', $tooltip = '') diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index d5226bb7e3d..7a3102e8aca 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -422,7 +422,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (! empty($objectid) && $objectid > 0) { $ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select); - return $ok ? 1 : accessforbidden(); + $params=array('objectid' => $objectid, 'features' => join(',', $featuresarray), 'features2' => $feature2); + return $ok ? 1 : accessforbidden('', 1, 1, 0, $params); } return 1; @@ -660,13 +661,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand * Show a message to say access is forbidden and stop program * Calling this function terminate execution of PHP. * - * @param string $message Force error message - * @param int $printheader Show header before - * @param int $printfooter Show footer after - * @param int $showonlymessage Show only message parameter. Otherwise add more information. + * @param string $message Force error message + * @param int $printheader Show header before + * @param int $printfooter Show footer after + * @param int $showonlymessage Show only message parameter. Otherwise add more information. + * @param array|null $params Send params * @return void */ -function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0) +function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null) { global $conf, $db, $user, $langs, $hookmanager; if (! is_object($langs)) @@ -697,7 +699,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('main')); } - $parameters = array('message'=>$message); + $parameters = array('message'=>$message, 'params'=>$params); $reshook=$hookmanager->executeHooks('getAccessForbiddenMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks print $hookmanager->resPrint; if (empty($reshook)) diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index e3a80e5d1df..dc86853859e 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -38,6 +38,14 @@ function takepos_prepare_head() $head[$h][2] = 'setup'; $h++; + if ($conf->global->TAKEPOS_CUSTOM_RECEIPT) + { + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; + $head[$h][1] = $langs->trans("Receipt"); + $head[$h][2] = 'receipt'; + $h++; + } + $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); for ($i = 1; $i <= $numterminals; $i++) { diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index d8225a1b2a5..8f99dcc59a1 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -35,7 +35,6 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; */ class modExpedition extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * @@ -189,7 +188,7 @@ class modExpedition extends DolibarrModules $r++; $this->rights[$r][0] = 1101; - $this->rights[$r][1] = 'Lire les bons de livraison'; + $this->rights[$r][1] = 'Read delivery receipts'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'livraison'; @@ -197,7 +196,7 @@ class modExpedition extends DolibarrModules $r++; $this->rights[$r][0] = 1102; - $this->rights[$r][1] = 'Creer modifier les bons de livraison'; + $this->rights[$r][1] = 'Create/modify delivery receipts'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'livraison'; @@ -205,7 +204,7 @@ class modExpedition extends DolibarrModules $r++; $this->rights[$r][0] = 1104; - $this->rights[$r][1] = 'Valider les bons de livraison'; + $this->rights[$r][1] = 'Validate delivery receipts'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'livraison_advance'; @@ -213,7 +212,7 @@ class modExpedition extends DolibarrModules $r++; $this->rights[$r][0] = 1109; - $this->rights[$r][1] = 'Supprimer les bons de livraison'; + $this->rights[$r][1] = 'Delete delivery receipts'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'livraison'; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 081149be51d..642c233c200 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -269,4 +269,46 @@ class modHoliday extends DolibarrModules // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; // $r++; } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + global $conf; + + // Permissions + $this->remove($options); + + //ODT template + /*$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/holiday/template_holiday.odt'; + $dirodt=DOL_DATA_ROOT.'/doctemplates/holiday'; + $dest=$dirodt.'/template_order.odt'; + + if (file_exists($src) && ! file_exists($dest)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + dol_mkdir($dirodt); + $result=dol_copy($src, $dest, 0, 0); + if ($result < 0) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + return 0; + } + } + */ + + $sql = array( + // "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'holiday' AND entity = ".$conf->entity, + // "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','holiday',".$conf->entity.")" + ); + + return $this->_init($sql, $options); + } } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index e71d44cd573..711249576a1 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -888,7 +888,7 @@ class EmailCollector extends CommonObject dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG); - $langs->loadLangs(array("project", "companies", "mails", "errors", "ticket")); + $langs->loadLangs(array("project", "companies", "mails", "errors", "ticket", "agenda")); $error = 0; $this->output = ''; @@ -1122,11 +1122,31 @@ class EmailCollector extends CommonObject $this->db->begin(); + // GET Email meta datas $overview = imap_fetch_overview($connection, $imapemail, 0); dol_syslog("** Process email - msgid=".$overview[0]->message_id." date=".dol_print_date($overview[0]->udate, 'dayrfc', 'gmt')." subject=".$overview[0]->subject); + // Decode $overview[0]->subject according to RFC2047 + // Can use also imap_mime_header_decode($str) + // Can use also mb_decode_mimeheader($str) + // Can use also iconv_mime_decode($str, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8') + if (function_exists('imap_mime_header_decode')) { + $elements = imap_mime_header_decode($overview[0]->subject); + $newstring = ''; + if (! empty($elements)) { + $num = count($elements); + for ($i = 0; $i < $num; $i++) { + $newstring .= ($newstring ? ' ' : '').$elements[$i]->text; + } + $overview[0]->subject = $newstring; + } + } + elseif (function_exists('mb_decode_mimeheader')) { + $overview[0]->subject = mb_decode_mimeheader($overview[0]->subject); + } + // Parse IMAP email structure global $htmlmsg, $plainmsg, $charset, $attachments; $this->getmsg($connection, $imapemail); diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index c12bd6decf3..e434bc524e2 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -168,7 +168,7 @@ if ($id > 0 || !empty($ref)) { print "\n"; - print dol_fiche_end(); + dol_fiche_end(); $modulepart = 'expedition'; $permission = $user->rights->expedition->creer; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 098b6b93710..2a1cf24b3b7 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -630,7 +630,7 @@ if (($action != 'create' && $action != 'add') && !$error) { $db->free($resql); } else { - print dol_print_error($db); + dol_print_error($db); } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 28610c14203..a4a7964ca5a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2675,7 +2675,7 @@ else if ($calculationrule == 'totalofround') $calculationrulenum = 1; else $calculationrulenum = 2; // Show link for "recalculate" - if (empty($object->getVentilExportCompta())) { + if ($object->getVentilExportCompta() == 0) { $s = $langs->trans("ReCalculate").' '; $s .= ''.$langs->trans("Mode1").''; $s .= ' / '; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c44c588b335..4c4a5212abd 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -267,6 +267,7 @@ class Holiday extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday("; + $sql .= "ref,"; $sql .= "fk_user,"; $sql .= "date_create,"; $sql .= "description,"; @@ -279,6 +280,7 @@ class Holiday extends CommonObject $sql .= "fk_user_create,"; $sql .= "entity"; $sql .= ") VALUES ("; + $sql .= "'(PROV)',"; $sql .= "'".$this->db->escape($this->fk_user)."',"; $sql .= " '".$this->db->idate($now)."',"; $sql .= " '".$this->db->escape($this->description)."',"; @@ -304,12 +306,31 @@ class Holiday extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."holiday"); - if (!$notrigger) + if ($this->id) { - // Call trigger - $result = $this->call_trigger('HOLIDAY_CREATE', $user); - if ($result < 0) { $error++; } - // End call triggers + // update ref + $initialref = '(PROV'.$this->id.')'; + if (!empty($this->ref)) $initialref = $this->ref; + + $sql = 'UPDATE '.MAIN_DB_PREFIX."holiday SET ref='".$this->db->escape($initialref)."' WHERE rowid=".$this->id; + if ($this->db->query($sql)) + { + $this->ref = $initialref; + + if (!$error) + { + $result = $this->insertExtraFields(); + if ($result < 0) $error++; + } + + if (!$error && !$notrigger) + { + // Call trigger + $result = $this->call_trigger('HOLIDAY_CREATE', $user); + if ($result < 0) { $error++; } + // End call triggers + } + } } } @@ -337,7 +358,7 @@ class Holiday extends CommonObject * * @param int $id Id object * @param string $ref Ref object - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $ref = '') { @@ -402,12 +423,17 @@ class Holiday extends CommonObject $this->fk_user_create = $obj->fk_user_create; $this->fk_type = $obj->fk_type; $this->entity = $obj->entity; + + $this->fetch_optionals(); + + $result = 1; + } + else { + $result = 0; } $this->db->free($resql); - $this->fetch_optionals(); - - return 1; + return $result; } else { diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 96ac938883c..d9ea8c01a62 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -59,6 +59,10 @@ ALTER TABLE llx_emailcollector_emailcollectoraction ADD COLUMN position integer -- For v11 +UPDATE llx_holiday SET ref = rowid WHERE ref IS NULL; +-- VMYSQL4.3 ALTER TABLE llx_holiday MODIFY COLUMN ref varchar(30) NOT NULL; +-- VPGSQL8.2 ALTER TABLE llx_holiday ALTER COLUMN ref SET NOT NULL; + ALTER TABLE llx_c_email_senderprofile MODIFY COLUMN active tinyint DEFAULT 1 NOT NULL; insert into llx_c_type_container (code,label,module,active) values ('menu', 'Menu', 'system', 1); diff --git a/htdocs/install/mysql/tables/llx_holiday.sql b/htdocs/install/mysql/tables/llx_holiday.sql index ce8383fe94d..e8116c477a8 100644 --- a/htdocs/install/mysql/tables/llx_holiday.sql +++ b/htdocs/install/mysql/tables/llx_holiday.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_holiday ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, -ref varchar(30) NULL, -- number +ref varchar(30) NOT NULL, ref_ext varchar(255), entity integer DEFAULT 1 NOT NULL, -- Multi company id fk_user integer NOT NULL, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 05c076625f1..d93b5930fed 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -625,7 +625,7 @@ Module5000Desc=Allows you to manage multiple companies Module6000Name=Workflow Module6000Desc=Workflow management (automatic creation of object and/or automatic status change) Module10000Name=Websites -Module10000Desc=Create websites (public) with a WYSIWYG editor. Just setup your web server (Apache, Nginx, ...) to point to the dedicated Dolibarr directory to have it online on the internet with your own domain name. +Module10000Desc=Create websites (public) with a WYSIWYG editor. This is a webmaster or developer oriented CMS (it is better to know HTML and CSS language). Just setup your web server (Apache, Nginx, ...) to point to the dedicated Dolibarr directory to have it online on the internet with your own domain name. Module20000Name=Leave Request Management Module20000Desc=Define and track employee leave requests Module39000Name=Product Lots @@ -844,10 +844,10 @@ Permission1002=Create/modify warehouses Permission1003=Delete warehouses Permission1004=Read stock movements Permission1005=Create/modify stock movements -Permission1101=Read delivery orders -Permission1102=Create/modify delivery orders -Permission1104=Validate delivery orders -Permission1109=Delete delivery orders +Permission1101=Read delivery receipts +Permission1102=Create/modify delivery receipts +Permission1104=Validate delivery receipts +Permission1109=Delete delivery receipts Permission1121=Read supplier proposals Permission1122=Create/modify supplier proposals Permission1123=Validate supplier proposals diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 44e78324abf..10c536e0d48 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - commercial -Commercial=Commercial -CommercialArea=Commercial area +Commercial=Commerce +CommercialArea=Commerce area Customer=Customer Customers=Customers Prospect=Prospect diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang index 778cb3332ad..1f48c01de75 100644 --- a/htdocs/langs/en_US/deliveries.lang +++ b/htdocs/langs/en_US/deliveries.lang @@ -2,7 +2,7 @@ Delivery=Delivery DeliveryRef=Ref Delivery DeliveryCard=Receipt card -DeliveryOrder=Delivery order +DeliveryOrder=Delivery receipt DeliveryDate=Delivery date CreateDeliveryOrder=Generate delivery receipt DeliveryStateSaved=Delivery state saved diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 6e3ba31d36c..b177abf75fd 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -847,6 +847,7 @@ Progress=Progress ProgressShort=Progr. FrontOffice=Front office BackOffice=Back office +Submit=Submit View=View Export=Export Exports=Exports diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index d14aa8a3c71..c808aac4cb7 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -83,7 +83,7 @@ ListOfDictionariesEntries=List of dictionaries entries ListOfPermissionsDefined=List of defined permissions SeeExamples=See examples here EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION) -VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example: preg_match('/public/', $_SERVER['PHP_SELF'])?0:1 +VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example:
preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
($user->rights->holiday->define_holiday ? 1 : 0) IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0) SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0) SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax. diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 53758677770..79c4978b660 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -33,6 +33,7 @@ TicketDictSeverity=Ticket - Severities TicketTypeShortBUGSOFT=Dysfonctionnement logiciel TicketTypeShortBUGHARD=Dysfonctionnement matériel TicketTypeShortCOM=Commercial question + TicketTypeShortHELP=Request for functionnal help TicketTypeShortISSUE=Issue, bug or problem TicketTypeShortREQUEST=Change or enhancement request diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6b17bb6f947..938f4411b57 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2551,6 +2551,7 @@ if (!function_exists("llxFooter")) print ''."\n"; // Add code for the asynchronous anonymous first ping (for telemetry) + // You can use &forceping=1 in parameters to force the ping. if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || GETPOST('forceping', 'alpha')) { //print ''; @@ -2560,6 +2561,8 @@ if (!function_exists("llxFooter")) { if (empty($_COOKIE['DOLINSTALLNOPING_'.md5($conf->file->instance_unique_id)])) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + print "\n".''."\n"; print "\n\n"; $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); @@ -2580,7 +2583,8 @@ if (!function_exists("llxFooter")) entity: "entity; ?>", dbtype: "type); ?>", country_code: "country_code); ?>", - php_version: "" + php_version: "", + os_version: "" }, success: function (data, status, xhr) { // success callback function (data contains body of response) console.log("Ping ok"); diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 69583f8c555..db6462eb90a 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -68,37 +68,37 @@ class doc_generic_myobject_odt extends ModelePDFMyObject global $conf, $langs, $mysoc; // Load translation files required by the page - $langs->loadLangs(array("main","companies")); + $langs->loadLangs(array("main", "companies")); $this->db = $db; $this->name = "ODT templates"; $this->description = $langs->trans("DocumentModelOdt"); - $this->scandir = 'MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan + $this->scandir = 'MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan // Page size for A4 format $this->type = 'odt'; $this->page_largeur = 0; $this->page_hauteur = 0; - $this->format = array($this->page_largeur,$this->page_hauteur); - $this->marge_gauche=0; - $this->marge_droite=0; - $this->marge_haute=0; - $this->marge_basse=0; + $this->format = array($this->page_largeur, $this->page_hauteur); + $this->marge_gauche = 0; + $this->marge_droite = 0; + $this->marge_haute = 0; + $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte - $this->option_credit_note = 0; // Support credit notes - $this->option_freetext = 1; // Support add of a personalised text - $this->option_draft_watermark = 0; // Support add of a watermark on drafts + $this->option_logo = 1; // Affiche logo + $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION + $this->option_modereg = 0; // Affiche mode reglement + $this->option_condreg = 0; // Affiche conditions reglement + $this->option_codeproduitservice = 0; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 0; // Support add of a watermark on drafts // Recupere emetteur - $this->emetteur=$mysoc; - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined + $this->emetteur = $mysoc; + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined } @@ -110,83 +110,83 @@ class doc_generic_myobject_odt extends ModelePDFMyObject */ public function info($langs) { - global $conf,$langs; + global $conf, $langs; // Load translation files required by the page - $langs->loadLangs(array("errors","companies")); + $langs->loadLangs(array("errors", "companies")); $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte.= '
'; - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= '
'; // List of directories area - $texte.= ''; + $texte .= ''; - $texte.= ''; - $texte.= ''; + $texte .= ''; + $texte .= ''; - $texte.= '
'; - $texttitle=$langs->trans("ListOfDirectories"); - $listofdir=explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH))); - $listoffiles=array(); - foreach($listofdir as $key=>$tmpdir) + $texte .= '
'; + $texttitle = $langs->trans("ListOfDirectories"); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH))); + $listoffiles = array(); + foreach ($listofdir as $key=>$tmpdir) { - $tmpdir=trim($tmpdir); - $tmpdir=preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); - if (! $tmpdir) { + $tmpdir = trim($tmpdir); + $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); + if (!$tmpdir) { unset($listofdir[$key]); continue; } - if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); + if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); else { - $tmpfiles=dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); - if (count($tmpfiles)) $listoffiles=array_merge($listoffiles, $tmpfiles); + $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); + if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } } - $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); + $texthelp = $langs->trans("ListOfDirectoriesForModelGenODT"); // Add list of substitution keys - $texthelp.='
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; - $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it + $texthelp .= '
'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
'; + $texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it - $texte.= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); - $texte.= '
'; - $texte.= ''; - $texte.= '
'; - $texte.= ''; - $texte.= '
'; + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); + $texte .= '
'; + $texte .= ''; + $texte .= '
'; + $texte .= ''; + $texte .= '
'; // Scan directories - $nbofiles=count($listoffiles); - if (! empty($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH)) + $nbofiles = count($listoffiles); + if (!empty($conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH)) { - $texte.=$langs->trans("NumberOfModelFilesFound").': '; + $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; - $texte.=count($listoffiles); + $texte .= count($listoffiles); //$texte.=$nbofiles?'':''; - $texte.=''; + $texte .= ''; } if ($nbofiles) { - $texte.='
'; - $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); - $texte.= '
'; + $texte .= $langs->trans("ExampleOfDirectoriesForModelGen"); + $texte .= '
'; - $texte.= '
'; + $texte .= '
'; + $texte .= ''; return $texte; } @@ -206,7 +206,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $user,$langs,$conf,$mysoc,$hookmanager; + global $user, $langs, $conf, $mysoc, $hookmanager; if (empty($srctemplatepath)) { @@ -215,28 +215,28 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } // Add odtgeneration hook - if (! is_object($hookmanager)) + if (!is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); + $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('odtgeneration')); global $action; - if (! is_object($outputlangs)) $outputlangs=$langs; - $sav_charset_output=$outputlangs->charset_output; - $outputlangs->charset_output='UTF-8'; + if (!is_object($outputlangs)) $outputlangs = $langs; + $sav_charset_output = $outputlangs->charset_output; + $outputlangs->charset_output = 'UTF-8'; $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); if ($conf->commande->dir_output) { // If $object is id instead of object - if (! is_object($object)) + if (!is_object($object)) { $id = $object; $object = new Commande($this->db); - $result=$object->fetch($id); + $result = $object->fetch($id); if ($result < 0) { dol_print_error($this->db, $object->error); @@ -244,16 +244,16 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } } - $dir = $conf->commande->multidir_output[isset($object->entity)?$object->entity:1]; + $dir = $conf->commande->multidir_output[isset($object->entity) ? $object->entity : 1]; $objectref = dol_sanitizeFileName($object->ref); - if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref; - $file = $dir . "/" . $objectref . ".odt"; + if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref; + $file = $dir."/".$objectref.".odt"; - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } } @@ -261,25 +261,25 @@ class doc_generic_myobject_odt extends ModelePDFMyObject if (file_exists($dir)) { //print "srctemplatepath=".$srctemplatepath; // Src filename - $newfile=basename($srctemplatepath); - $newfiletmp=preg_replace('/\.od(t|s)/i', '', $newfile); - $newfiletmp=preg_replace('/template_/i', '', $newfiletmp); - $newfiletmp=preg_replace('/modele_/i', '', $newfiletmp); - $newfiletmp=$objectref.'_'.$newfiletmp; + $newfile = basename($srctemplatepath); + $newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile); + $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); + $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); + $newfiletmp = $objectref.'_'.$newfiletmp; //$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt'; // Get extension (ods or odt) - $newfileformat=substr($newfile, strrpos($newfile, '.')+1); - if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) + $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); + if (!empty($conf->global->MAIN_DOC_USE_TIMING)) { - $format=$conf->global->MAIN_DOC_USE_TIMING; - if ($format == '1') $format='%Y%m%d%H%M%S'; - $filename=$newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; + $format = $conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format = '%Y%m%d%H%M%S'; + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } else { - $filename=$newfiletmp.'.'.$newfileformat; + $filename = $newfiletmp.'.'.$newfileformat; } - $file=$dir.'/'.$filename; + $file = $dir.'/'.$filename; //print "newdir=".$dir; //print "newfile=".$newfile; //print "file=".$file; @@ -289,20 +289,20 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // If CUSTOMER contact defined on order, we use it - $usecontact=false; - $arrayidcontact=$object->getIdContact('external', 'CUSTOMER'); + $usecontact = false; + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); if (count($arrayidcontact) > 0) { - $usecontact=true; - $result=$object->fetch_contact($arrayidcontact[0]); + $usecontact = true; + $result = $object->fetch_contact($arrayidcontact[0]); } // Recipient name - $contactobject=null; - if (! empty($usecontact)) + $contactobject = null; + if (!empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else { $socobject = $object->thirdparty; // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use @@ -311,11 +311,11 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } else { - $socobject=$object->thirdparty; + $socobject = $object->thirdparty; } // Make substitution - $substitutionarray=array( + $substitutionarray = array( '__FROM_NAME__' => $this->emetteur->name, '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, @@ -324,15 +324,15 @@ class doc_generic_myobject_odt extends ModelePDFMyObject ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray); - $reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray); + $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Line of free text - $newfreetext=''; - $paramfreetext='ORDER_FREE_TEXT'; - if (! empty($conf->global->$paramfreetext)) + $newfreetext = ''; + $paramfreetext = 'ORDER_FREE_TEXT'; + if (!empty($conf->global->$paramfreetext)) { - $newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray); + $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); } // Open and load template @@ -342,15 +342,15 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $srctemplatepath, array( 'PATH_TO_TMP' => $conf->commande->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) ); } - catch(Exception $e) + catch (Exception $e) { - $this->error=$e->getMessage(); + $this->error = $e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); return -1; } @@ -365,31 +365,31 @@ class doc_generic_myobject_odt extends ModelePDFMyObject try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { dol_syslog($e->getMessage(), LOG_INFO); } // Define substitution array $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); - $array_object_from_properties=$this->get_substitutionarray_each_var_object($object, $outputlangs); - $array_objet=$this->get_substitutionarray_object($object, $outputlangs); - $array_user=$this->get_substitutionarray_user($user, $outputlangs); - $array_soc=$this->get_substitutionarray_mysoc($mysoc, $outputlangs); - $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject, $outputlangs); - $array_other=$this->get_substitutionarray_other($outputlangs); + $array_object_from_properties = $this->get_substitutionarray_each_var_object($object, $outputlangs); + $array_objet = $this->get_substitutionarray_object($object, $outputlangs); + $array_user = $this->get_substitutionarray_user($user, $outputlangs); + $array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs); + $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); + $array_other = $this->get_substitutionarray_other($outputlangs); // retrieve contact information for use in object as contact_xxx tags $array_thirdparty_contact = array(); - if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); + if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); $tmparray = array_merge($substitutionarray, $array_object_from_properties, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); - $reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - foreach($tmparray as $key=>$value) + foreach ($tmparray as $key=>$value) { try { if (preg_match('/logo$/', $key)) // Image @@ -402,7 +402,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { dol_syslog($e->getMessage(), LOG_INFO); } @@ -414,7 +414,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject try { $listlines = $odfHandler->setSegment('lines'); } - catch(OdfException $e) + catch (OdfException $e) { // We may arrive here if tags for lines not present into template $foundtagforlines = 0; @@ -424,22 +424,22 @@ class doc_generic_myobject_odt extends ModelePDFMyObject { foreach ($object->lines as $line) { - $tmparray=$this->get_substitutionarray_lines($line, $outputlangs); + $tmparray = $this->get_substitutionarray_lines($line, $outputlangs); complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines"); // Call the ODTSubstitutionLine hook - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line); - $reshook=$hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - foreach($tmparray as $key => $val) + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line); + $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + foreach ($tmparray as $key => $val) { try { $listlines->setVars($key, $val, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { dol_syslog($e->getMessage(), LOG_INFO); } - catch(SegmentException $e) + catch (SegmentException $e) { dol_syslog($e->getMessage(), LOG_INFO); } @@ -449,21 +449,21 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $odfHandler->mergeSegment($listlines); } } - catch(OdfException $e) + catch (OdfException $e) { - $this->error=$e->getMessage(); + $this->error = $e->getMessage(); dol_syslog($this->error, LOG_WARNING); return -1; } // Replace labels translated - $tmparray=$outputlangs->get_translations_for_substitutions(); - foreach($tmparray as $key=>$value) + $tmparray = $outputlangs->get_translations_for_substitutions(); + foreach ($tmparray as $key=>$value) { try { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { dol_syslog($e->getMessage(), LOG_INFO); } @@ -471,15 +471,15 @@ class doc_generic_myobject_odt extends ModelePDFMyObject // Call the beforeODTSave hook - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); - $reshook=$hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ - $this->error=$e->getMessage(); + } catch (Exception $e) { + $this->error = $e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); return -1; } @@ -488,27 +488,27 @@ class doc_generic_myobject_odt extends ModelePDFMyObject try { $odfHandler->saveToDisk($file); } catch (Exception $e) { - $this->error=$e->getMessage(); + $this->error = $e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); return -1; } } - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); - $reshook=$hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); + $reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); - $odfHandler=null; // Destroy object + $odfHandler = null; // Destroy object $this->result = array('fullpath'=>$file); - return 1; // Success + return 1; // Success } else { - $this->error=$langs->transnoentities("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } } diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 4a077e35b5b..e607cdfebb4 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -89,7 +89,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity]."/".$object->id; // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $object->id); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 7c4fa1ebbdc..fd4e0435dbc 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -100,17 +100,17 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); $permissiontoread = $user->rights->mymodule->myobject->read; -$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php -$upload_dir = $conf->mymodule->multidir_output[isset($object->entity)?$object->entity:1]; +$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php +$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1]; /* @@ -392,29 +392,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea * Lines */ - if (! empty($object->table_element_line)) + if (!empty($object->table_element_line)) { // Show object lines $result = $object->getLinesArray(); - print '
- - + print ' + + - + '; - if (! empty($conf->use_javascript_ajax) && $object->status == 0) { - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } print '
'; - if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print ''; } - if (! empty($object->lines)) + if (!empty($object->lines)) { $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1); } @@ -432,7 +432,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'; } @@ -446,21 +446,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action != 'presend' && $action != 'editline') { print '
'."\n"; - $parameters=array(); - $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { // Send - print '' . $langs->trans('SendMail') . ''."\n"; + print ''.$langs->trans('SendMail').''."\n"; // Back to draft if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { - print '' . $langs->trans("SetToDraft") . ''; + print ''.$langs->trans("SetToDraft").''; } } @@ -493,7 +493,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Clone if ($permissiontoadd) { - print '' . $langs->trans("ToClone") . ''."\n"; + print ''.$langs->trans("ToClone").''."\n"; } /* diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 5a58a068a64..a712783f55e 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -80,7 +80,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".dol_sanitizeFileName($object->ref); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $object->id); diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index f7440c71cf8..fe2919ea7a0 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -59,7 +59,7 @@ $hookmanager->initHooks(array('myobjectnote', 'globalcard')); // Note that conf- $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 884bc234cbf..7009915eec1 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -54,7 +54,7 @@ else $search_agenda_label=GETPOST('search_agenda_label'); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mrp', $id); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 7cbb7256b5f..7fe93d795a1 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -100,7 +100,7 @@ if (GETPOST('fk_bom', 'int')) } // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); @@ -109,7 +109,7 @@ $permissionnote = $user->rights->mrp->write; // Used by the include of actions_s $permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php $permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$upload_dir = $conf->mrp->multidir_output[isset($object->entity)?$object->entity:1]; +$upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1]; /* diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 72fab7c3517..eae4daf67c9 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -41,7 +41,7 @@ $id=(GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); $ref = GETPOST('ref', 'alpha'); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mrp', $id); diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index aeb4630168d..1a9fbe278a9 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -47,7 +47,7 @@ $hookmanager->initHooks(array('monote','globalcard')); // Note that conf->ho $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mrp', $id); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 2b63065f72c..45507e44928 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -88,7 +88,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); @@ -97,7 +97,7 @@ $permissionnote = $user->rights->mrp->write; // Used by the include of actions_s $permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php $permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$upload_dir = $conf->mrp->multidir_output[isset($object->entity)?$object->entity:1]; +$upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1]; /* diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 37c950e9956..05d5818b3ff 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -965,8 +965,8 @@ class Products extends DolibarrApi /** * Delete attributes by id. * - * @param int $id ID of Attribute - * @return int + * @param int $id ID of Attribute + * @return int Result of deletion * * @throws RestException * @throws 401 @@ -981,12 +981,13 @@ class Products extends DolibarrApi $prodattr = new ProductAttribute($this->db); $prodattr->id = (int) $id; - $result = $prodattr->delete(); + $result = $prodattr->delete(DolibarrApiAccess::$user); - if ($result > 0) { - return 1; + if ($result <= 0) { + throw new RestException(500, "Error deleting attribute"); } - throw new RestException(500, "Error deleting attribute"); + + return $result; } /** @@ -1485,8 +1486,8 @@ class Products extends DolibarrApi /** * Delete product variants. * - * @param int $id ID of Variant - * @return int + * @param int $id ID of Variant + * @return int Result of deletion * * @throws RestException * @throws 401 @@ -1502,12 +1503,11 @@ class Products extends DolibarrApi $prodcomb = new ProductCombination($this->db); $prodcomb->id = (int) $id; $result = $prodcomb->delete(DolibarrApiAccess::$user); - return $result; - if ($result > 0) + if ($result <= 0) { - return 1; + throw new RestException(500, "Error deleting variant"); } - throw new RestException(500, "Error deleting variant"); + return $result; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 43821b99b31..09949ee3791 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -72,7 +72,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 4ee108595e6..7010190fd14 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -72,7 +72,7 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 4c1e8b0e62e..a6e06dfb5ff 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -729,7 +729,7 @@ dol_fiche_end(); // Save print '
'; -print ''; +print ''; if (!empty($backtopage)) { print '     '; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 0bde25460e3..0601ecf5b1e 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -53,7 +53,6 @@ $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); - /* * Actions */ @@ -358,7 +357,7 @@ if ($action != "infos_success") { $formticket->withfile = 2; $formticket->action = 'create_ticket'; - $formticket->param = array('returnurl' => $_SERVER['PHP_SELF']); + $formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : '')); if (empty($defaultref)) { $defaultref = ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index beadddc6397..eaf4f14bbe6 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -781,7 +781,7 @@ if ($resql) print $reception->getNomUrl(1); $filename = dol_sanitizeFileName($reception->ref); $filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref); - $urlsource = $_SERVER['PHP_SELF'].'?id='.$reception->rowid; + $urlsource = $_SERVER['PHP_SELF'].'?id='.$reception->id; print $formfile->getDocumentsLink($reception->element, $filename, $filedir); print "\n"; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 1ccb1631a31..688b71bb68e 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -111,11 +111,15 @@ if ($action == 'setvalue' && $user->admin) // Payment token for URL $result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN", GETPOST('PAYMENT_SECURITY_TOKEN', 'alpha'), 'chaine', 0, '', $conf->entity); - if (!$result > 0) - $error++; - $result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN_UNIQUE", GETPOST('PAYMENT_SECURITY_TOKEN_UNIQUE', 'alpha'), 'chaine', 0, '', $conf->entity); - if (!$result > 0) + if (!$result > 0) { $error++; + } + if (empty($conf->use_javascript_ajax)) { + $result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN_UNIQUE", GETPOST('PAYMENT_SECURITY_TOKEN_UNIQUE', 'alpha'), 'chaine', 0, '', $conf->entity); + if (!$result > 0) { + $error++; + } + } if (!$error) { $db->commit(); @@ -452,7 +456,7 @@ print ''; dol_fiche_end(); -print '
'; +print '
'; print ''; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 5995489184d..b5944e914ae 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -81,7 +81,10 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); - + if (! empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { + $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); + } if ($conf->global->TAKEPOS_ORDER_NOTES == 1) { $extrafields = new ExtraFields($db); @@ -241,6 +244,20 @@ print ''; print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1); print "\n"; +// Sumup options +if ($conf->global->TAKEPOS_ENABLE_SUMUP) { + print ''; + print $langs->trans("SumupAffiliate"); + print ''; + print ''; + print "\n"; + print ''; + print $langs->trans("SumupAppId"); + print ''; + print ''; + print "\n"; +} + // Custom Receipt print ''; print $langs->trans('CustomReceipt'); diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 4696426aaf8..e2839901a77 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -74,7 +74,10 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); - foreach($paiements as $modep) { + if (! empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { + $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_SUMUP".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); + } + foreach($paiements as $modep) { if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; $name="CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse; $res = dolibarr_set_const($db, $name, (GETPOST($name, 'alpha') > 0 ? GETPOST($name, 'alpha') : ''), 'chaine', 0, '', $conf->entity); @@ -151,6 +154,13 @@ if (! empty($conf->banque->enabled)) $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1); if (! empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse})) $atleastonefound++; print ''; + if ($conf->global->TAKEPOS_ENABLE_SUMUP) { + print '' . $langs->trans("CashDeskBankAccountForSumup") . ''; + print ''; + $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP' . $terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_SUMUP' . $terminaltouse, 0, "courant=1", 1); + if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP' . $terminaltouse})) $atleastonefound++; + print ''; + } foreach($paiements as $modep) { if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; // Already managed before diff --git a/htdocs/takepos/lib/takepos.lib.php b/htdocs/takepos/lib/takepos.lib.php deleted file mode 100644 index af1ea6aa100..00000000000 --- a/htdocs/takepos/lib/takepos.lib.php +++ /dev/null @@ -1,60 +0,0 @@ -. - */ - -/** - * \file takepos/lib/takepos.lib.php - * \ingroup takepos - * \brief Library files with common functions for TakePos - */ - -/** - * Prepare admin pages header - * - * @return array - */ -function takeposAdminPrepareHead() -{ - global $langs, $conf; - - $langs->load("cashdesk"); - - $h = 0; - $head = array(); - - $head[$h][0] = dol_buildpath("/takepos/admin/setup.php", 1); - $head[$h][1] = $langs->trans("Settings"); - $head[$h][2] = 'settings'; - $h++; - $head[$h][0] = dol_buildpath("/takepos/admin/about.php", 1); - $head[$h][1] = $langs->trans("About"); - $head[$h][2] = 'about'; - $h++; - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - //$this->tabs = array( - // 'entity:+tabname:Title:@takepos:/takepos/mypage.php?id=__ID__' - //); // to add new tab - //$this->tabs = array( - // 'entity:-tabname:Title:@takepos:/takepos/mypage.php?id=__ID__' - //); // to remove a tab - complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos'); - - complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos', 'remove'); - - return $head; -} diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 42ebe2fa85a..5e5a07b3625 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -176,6 +176,35 @@ else print "var received=0;"; else location.reload(); }); } + + function ValidateSumup() { + + var invoiceid = 0 ? $invoiceid : 0); ?>; + var amountpayed = $("#change1").val(); + if (amountpayed > total_ttc; ?>) { + amountpayed = total_ttc; ?>; + } + + // Starting sumup app + window.open('sumupmerchant://pay/1.0?affiliate-key=&app-id=&total=' + amountpayed + '¤cy=EUR&title=' + invoiceid + '&callback=/takepos/smpcb.php'); + + var loop = window.setInterval(function () { + $.ajax('/takepos/smpcb.php?status').done(function (data) { + console.log(data); + if (data === "SUCCESS") { + parent.$("#poslines").load("invoice.php?place=&action=valid&pay=CB&amount=" + amountpayed + "&invoiceid=" + invoiceid, function () { + //parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight); + parent.$.colorbox.close(); + //parent.setFocusOnSearchField(); // This does not have effect + }); + clearInterval(loop); + } else if (data === "FAILED") { + parent.$.colorbox.close(); + clearInterval(loop); + } + }); + }, 2500); + }
@@ -269,6 +298,13 @@ while($i < count($paiements)){ global->TAKEPOS_ENABLE_SUMUP && !empty(dolibarr_get_const($db, "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"]))) { + ?> + + + + + + The HTML5 Herald + + + + + + + +'; + $_SESSION['SMP_CURRENT_PAYMENT'] = $_GET['smp-status']; + + print ''; + + print "Transaction status registered, you can close this"; + + die(''); +} + + print 'NOOP'; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d25c106bf39..b4c8ab558eb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2127,7 +2127,7 @@ form#login { border-radius: 4px; border:solid 1px rgba(80,80,80,.4); - border-top:solid 1px f8f8f8; + border-top:solid 1px #f8f8f8; } .login_table input#username, .login_table input#password, .login_table input#securitycode{ border: none; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 9692e074397..00771f4fdba 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -95,7 +95,7 @@ if ($id || $track_id || $ref) { $url_page_current = DOL_URL_ROOT.'/ticket/card.php'; // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; $result = restrictedArea($user, 'ticket', $object->id); diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 16aa16765a9..39dc2e61f9f 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -71,24 +71,19 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -if (empty($reshook)) -{ - if ($action == 'addrights' && $caneditperms) - { +if (empty($reshook)) { + if ($action == 'addrights' && $caneditperms) { $editgroup = new Usergroup($db); $result = $editgroup->fetch($id); - if ($result > 0) - { + if ($result > 0) { $editgroup->addrights($rights, $module, '', $entity); } } - if ($action == 'delrights' && $caneditperms) - { + if ($action == 'delrights' && $caneditperms) { $editgroup = new Usergroup($db); $result = $editgroup->fetch($id); - if ($result > 0) - { + if ($result > 0) { $editgroup->delrights($rights, $module, '', $entity); } } diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 1172d08f74d..3ccdb6dbf03 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -174,9 +174,10 @@ class ProductAttribute /** * Deletes a product attribute * - * @return int <0 KO, >0 OK + * @param User $user Object user + * @return int <0 KO, >0 OK */ - public function delete() + public function delete($user = null) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_attribute WHERE rowid = ".(int) $this->id; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index f8a8b9cc9e5..c3f2b198301 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -394,7 +394,7 @@ if (! empty($id) || ! empty($ref)) } } $listofvariantselected .= '
'; - //print dol_fiche_end(); + //dol_fiche_end(); } else { $title = $langs->trans('EditProductCombination'); } @@ -602,7 +602,7 @@ if (! empty($id) || ! empty($ref)) print ''; } - print dol_fiche_end(); + dol_fiche_end(); ?>
diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 5d2dcb9a15f..dff0dd70175 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -825,14 +825,26 @@ if ($action == 'addcontainer') if (!$error) { - $res = $objectpage->create($user); - if ($res <= 0) - { + $pageid = $objectpage->create($user); + if ($pageid <= 0) { $error++; setEventMessages($objectpage->error, $objectpage->errors, 'errors'); $action = 'createcontainer'; } + else { + // If there is no home page yet, this new page will be set as the home page + if (empty($object->fk_default_home)) { + $object->fk_default_home = $pageid; + $res = $object->update($user); + if ($res <= 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } } + if (!$error) { if (!empty($objectpage->content)) @@ -2891,7 +2903,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print '
'; if (!empty($conf->use_javascript_ajax)) print ' '; - print '
'; + print '
'; print '
'; print ''; print ''; // Translation of diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index e6c5b0f7c3d..2241b128dee 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -61,7 +61,7 @@ foreach ($object->fields as $key => $val) if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'website', $id); diff --git a/htdocs/zapier/hook_agenda.php b/htdocs/zapier/hook_agenda.php index 98812cd47b5..e3cbc1a21d6 100644 --- a/htdocs/zapier/hook_agenda.php +++ b/htdocs/zapier/hook_agenda.php @@ -66,7 +66,7 @@ else $search_agenda_label=GETPOST('search_agenda_label'); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php index 1ea85ce8d57..1070a02af9d 100644 --- a/htdocs/zapier/hook_card.php +++ b/htdocs/zapier/hook_card.php @@ -99,7 +99,7 @@ if (empty($action) && empty($id) && empty($ref)) $action = 'view'; include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); diff --git a/htdocs/zapier/hook_document.php b/htdocs/zapier/hook_document.php index 67d438c106b..966a2b138cf 100644 --- a/htdocs/zapier/hook_document.php +++ b/htdocs/zapier/hook_document.php @@ -54,7 +54,7 @@ $id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')) $ref = GETPOST('ref', 'alpha'); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); diff --git a/htdocs/zapier/hook_note.php b/htdocs/zapier/hook_note.php index c56b36be33e..abb66fd6f38 100644 --- a/htdocs/zapier/hook_note.php +++ b/htdocs/zapier/hook_note.php @@ -60,7 +60,7 @@ $hookmanager->initHooks(array('myobjectnote', 'globalcard')); // Note that conf- $extrafields->fetch_name_optionals_label($object->table_element); // Security check - Protection if external user -//if ($user->socid > 0) access_forbidden(); +//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id);
'; @@ -2912,7 +2924,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print '
'; if (!empty($conf->use_javascript_ajax)) print ' '; - print '
'; + print '
'; print '
'; } @@ -3015,7 +3027,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print '
'; print $langs->trans('Language'); print ''; - print $formadmin->select_language($pagelang ? $pagelang : $langs->defaultlang, 'WEBSITE_LANG', 0, null, '1'); + print $formadmin->select_language($pagelang ? $pagelang : $langs->defaultlang, 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200'); print '