Merge branch 'develop' of git://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
altairis 2019-11-28 10:34:16 +01:00
commit 7ae17efdc4
81 changed files with 897 additions and 540 deletions

179
ChangeLog
View File

@ -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.

View File

@ -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);

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* 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'){

View File

@ -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';
}

View File

@ -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 '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
print '<tr class="drag drop oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_PW"), $langs->trans("WithGMailYouCanCreateADedicatedPassword"));
print '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{

View File

@ -42,11 +42,11 @@ print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$lan
print "\n";
// Recupere l'OS au sens PHP
print "<tr $bc[0]><td width=\"240\">".$langs->trans("PHP_OS")."</td><td>".PHP_OS."</td></tr>\n";
print '<tr class="oddeven"><td>'.$langs->trans("PHP_OS")."</td><td>".PHP_OS."</td></tr>\n";
// Recupere la version de l'OS
$osversion=version_os();
print "<tr $bc[1]><td width=\"240\">".$langs->trans("Version")."</td><td>".$osversion."</td></tr>\n";
print '<tr class="oddeven"><td>'.$langs->trans("Version")."</td><td>".$osversion."</td></tr>\n";
print '</table>';
// End of page

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id . '">
<input type="hidden" name="id" value="' . $object->id.'">
';
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 '<div class="div-table-responsive-no-min">';
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 '<table id="tablelines" class="noborder noshadow" width="100%">';
}
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 '</table>';
}
@ -613,11 +613,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
if (is_array($object->lines) && count($object->lines) > 0)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=validate">' . $langs->trans("Validate") . '</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>';
}
else
{
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">' . $langs->trans("Validate") . '</a>';
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
}
}
}

View File

@ -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);

View File

@ -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);

View File

@ -167,7 +167,7 @@ if ($object->id)
print "</table>\n";
print '</div>';
print dol_fiche_end();
dol_fiche_end();

View File

@ -628,7 +628,7 @@ if ($resql)
if (!empty($arrayfields['ava.rowid']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1);
$form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1);
print ajax_combobox('search_availability');
print '</td>';
}

View File

@ -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)

View File

@ -174,7 +174,7 @@ if ($id > 0 || !empty($ref))
print "</div>\n";
print dol_fiche_end();
dol_fiche_end();
$modulepart = 'commande';
$permission = $user->rights->commande->creer;

View File

@ -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);

View File

@ -231,7 +231,7 @@ else
print '</div>';
print dol_fiche_end();
dol_fiche_end();
// Actions buttons

View File

@ -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));
}
/**

View File

@ -7029,7 +7029,7 @@ abstract class CommonObject
if ($nbbyrow > 0)
{
if ($nbphoto == 1) $return .= '<table class="valigntop center centpercent" style="border: 0; padding: 2; border-spacing: 2px; border-collapse: separate;">';
if ($nbphoto == 1) $return .= '<table class="valigntop center centpercent" style="border: 0; padding: 2px; border-spacing: 2px; border-collapse: separate;">';
if ($nbphoto % $nbbyrow == 1) $return .= '<tr class="center valignmiddle" style="border: 1px">';
$return .= '<td style="width: '.ceil(100 / $nbbyrow).'%" class="photo">';

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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');

View File

@ -421,14 +421,13 @@ class FormTicket
if ($withdolfichehead) dol_fiche_end();
print '<br><center>';
print '<div class="center">';
print '<input class="button" type="submit" name="add" value="'.$langs->trans(($this->withthreadid > 0 ? "SendResponse" : "NewTicket")).'" />';
if ($this->withcancel) {
print " &nbsp; &nbsp; ";
print " &nbsp; &nbsp; &nbsp;";
print "<input class=\"button\" type=\"submit\" name=\"cancel\" value=\"".$langs->trans("Cancel")."\">";
}
print "</center>\n";
print '</div>';
print "</form>\n";
print "<!-- End form TICKET -->\n";

View File

@ -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)
{

View File

@ -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)

View File

@ -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;
}

View File

@ -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 = '')

View File

@ -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))

View File

@ -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++)
{

View File

@ -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';

View File

@ -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);
}
}

View File

@ -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);

View File

@ -168,7 +168,7 @@ if ($id > 0 || !empty($ref)) {
print "</div>\n";
print dol_fiche_end();
dol_fiche_end();
$modulepart = 'expedition';
$permission = $user->rights->expedition->creer;

View File

@ -630,7 +630,7 @@ if (($action != 'create' && $action != 'add') && !$error) {
$db->free($resql);
} else {
print dol_print_error($db);
dol_print_error($db);
}
}

View File

@ -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 .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
$s .= ' / ';

View File

@ -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
{

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -847,6 +847,7 @@ Progress=Progress
ProgressShort=Progr.
FrontOffice=Front office
BackOffice=Back office
Submit=Submit
View=View
Export=Export
Exports=Exports

View File

@ -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:<br>preg_match('/public/', $_SERVER['PHP_SELF'])?0:1<br>($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.

View File

@ -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

View File

@ -2551,6 +2551,7 @@ if (!function_exists("llxFooter"))
print '<div id="dialogforpopup" style="display: none;"></div>'."\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 '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->';
@ -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".'<!-- Includes JS for Ping of Dolibarr MAIN_FIRST_PING_OK_DATE = '.$conf->global->MAIN_FIRST_PING_OK_DATE.' MAIN_FIRST_PING_OK_ID = '.$conf->global->MAIN_FIRST_PING_OK_ID.' -->'."\n";
print "\n<!-- JS CODE TO ENABLE the anonymous Ontime Ping -->\n";
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
@ -2580,7 +2583,8 @@ if (!function_exists("llxFooter"))
entity: "<?php echo (int) $conf->entity; ?>",
dbtype: "<?php echo dol_escape_js($db->type); ?>",
country_code: "<?php echo dol_escape_js($mysoc->country_code); ?>",
php_version: "<?php echo phpversion(); ?>"
php_version: "<?php echo phpversion(); ?>",
os_version: "<?php echo version_os('smr'); ?>"
},
success: function (data, status, xhr) { // success callback function (data contains body of response)
console.log("Ping ok");

View File

@ -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.".<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
$texte.= '<input type="hidden" name="param1" value="MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH">';
$texte.= '<table class="nobordernopadding" width="100%">';
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH">';
$texte .= '<table class="nobordernopadding" width="100%">';
// List of directories area
$texte.= '<tr><td>';
$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 .= '<tr><td>';
$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.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte.= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte.= '<textarea class="flat" cols="60" name="value1">';
$texte.=$conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH;
$texte.= '</textarea>';
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte.= '<br></div></div>';
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
$texte .= '<br></div></div>';
// 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").': <b>';
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
$texte.=count($listoffiles);
$texte .= count($listoffiles);
//$texte.=$nbofiles?'</a>':'';
$texte.='</b>';
$texte .= '</b>';
}
if ($nbofiles)
{
$texte.='<div id="div_'.get_class($this).'" class="hidden">';
foreach($listoffiles as $file)
$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
foreach ($listoffiles as $file)
{
$texte.=$file['name'].'<br>';
$texte .= $file['name'].'<br>';
}
$texte.='<div id="div_'.get_class($this).'">';
$texte .= '<div id="div_'.get_class($this).'">';
}
$texte.= '</td>';
$texte .= '</td>';
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte.= '</td>';
$texte.= '</tr>';
$texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte .= '</td>';
$texte .= '</tr>';
$texte.= '</table>';
$texte.= '</form>';
$texte .= '</table>';
$texte .= '</form>';
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;
}
}

View File

@ -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);

View File

@ -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 ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id . '">
<input type="hidden" name="id" value="' . $object->id.'">
';
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 '<div class="div-table-responsive-no-min">';
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 '<table id="tablelines" class="noborder noshadow" width="100%">';
}
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 '</table>';
}
@ -446,21 +446,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action != 'presend' && $action != 'editline') {
print '<div class="tabsAction">'."\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 '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
// Back to draft
if ($object->status == $object::STATUS_VALIDATED)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
}
}
@ -493,7 +493,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Clone
if ($permissiontoadd)
{
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=myobject">' . $langs->trans("ToClone") . '</a>'."\n";
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=myobject">'.$langs->trans("ToClone").'</a>'."\n";
}
/*

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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];
/*

View File

@ -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);

View File

@ -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);

View File

@ -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];
/*

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -729,7 +729,7 @@ dol_fiche_end();
// Save
print '<div class="center">';
print '<input type="submit" value="'.$langs->trans("Save").'" id="submitsave" class="button">';
print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
if (!empty($backtopage))
{
print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button">';

View File

@ -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 = '';

View File

@ -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 "</td>\n";

View File

@ -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 '</table>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
print '</form>';

View File

@ -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 '<td colspan="2">';
print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1);
print "</td></tr>\n";
// Sumup options
if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
print '<tr class="oddeven"><td>';
print $langs->trans("SumupAffiliate");
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="' . $conf->global->TAKEPOS_SUMUP_AFFILIATE . '"></input>';
print "</td></tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("SumupAppId");
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_SUMUP_APPID" value="' . $conf->global->TAKEPOS_SUMUP_APPID . '"></input>';
print "</td></tr>\n";
}
// Custom Receipt
print '<tr class="oddeven"><td>';
print $langs->trans('CustomReceipt');

View File

@ -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 '</td></tr>';
if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
print '<tr class="oddeven"><td>' . $langs->trans("CashDeskBankAccountForSumup") . '</td>';
print '<td>';
$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 '</td></tr>';
}
foreach($paiements as $modep) {
if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue; // Already managed before

View File

@ -1,60 +0,0 @@
<?php
/* Copyright (C) 2018 SuperAdmin
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \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;
}

View File

@ -176,6 +176,35 @@ else print "var received=0;";
else location.reload();
});
}
function ValidateSumup() {
<?php $_SESSION['SMP_CURRENT_PAYMENT'] = "NEW" ?>
var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
var amountpayed = $("#change1").val();
if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
amountpayed = <?php echo $invoice->total_ttc; ?>;
}
// Starting sumup app
window.open('sumupmerchant://pay/1.0?affiliate-key=<?php echo dolibarr_get_const($db, "TAKEPOS_SUMUP_AFFILIATE")?>&app-id=<?php echo dolibarr_get_const($db, "TAKEPOS_SUMUP_APPID")?>&total=' + amountpayed + '&currency=EUR&title=' + invoiceid + '&callback=<?php echo DOL_MAIN_URL_ROOT ?>/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=<?php echo $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);
}
</script>
<div style="position:absolute; top:2%; left:5%; height:30%; width:91%;">
@ -269,6 +298,13 @@ while($i < count($paiements)){
<?php
$i=$i+1;
}
if($conf->global->TAKEPOS_ENABLE_SUMUP && !empty(dolibarr_get_const($db, "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"]))) {
?>
<button type="button" class="calcbutton2" onclick="ValidateSumup();">Sumup</button>
<?php
}
$class=($i==3)?"calcbutton3":"calcbutton2";
foreach($action_buttons as $button){
$newclass = $class.($button["class"]?" ".$button["class"]:"");

35
htdocs/takepos/smpcb.php Normal file
View File

@ -0,0 +1,35 @@
<?php
require '../main.inc.php';
if(isset($_GET['status'])) {
die(strtoupper($_SESSION['SMP_CURRENT_PAYMENT']));
}
if($_GET['smp-status']) {
print '<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="css/styles.css?v=1.0">
</head>
<body>';
$_SESSION['SMP_CURRENT_PAYMENT'] = $_GET['smp-status'];
print '<script type="application/javascript">
window.onload = function() {
window.close();
};
</script>';
print "Transaction status registered, you can close this";
die('</body></html>');
}
print 'NOOP';

View File

@ -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;

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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;

View File

@ -394,7 +394,7 @@ if (! empty($id) || ! empty($ref))
}
}
$listofvariantselected .= '</div>';
//print dol_fiche_end();
//dol_fiche_end();
} else {
$title = $langs->trans('EditProductCombination');
}
@ -602,7 +602,7 @@ if (! empty($id) || ! empty($ref))
print '</table>';
}
print dol_fiche_end();
dol_fiche_end();
?>
<div style="text-align: center">

View File

@ -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 '<br>';
if (!empty($conf->use_javascript_ajax)) print '<input type="radio" name="radiocreatefrom" id="checkboxcreatefromfetching" value="checkboxcreatefromfetching"'.(GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching' ? ' checked' : '').'> ';
print '<label for="checkboxcreatefromfetching"><span class="opacitymedium">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
print '<label for="checkboxcreatefromfetching"><span class="opacitymediumxx">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
print '<hr class="tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
print '<table class="tableforfield centpercent tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
print '<tr><td class="titlefield">';
@ -2912,7 +2924,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<br>';
if (!empty($conf->use_javascript_ajax)) print '<input type="radio" name="radiocreatefrom" id="checkboxcreatemanually" value="checkboxcreatemanually"'.(GETPOST('radiocreatefrom') == 'checkboxcreatemanually' ? ' checked' : '').'> ';
print '<label for="checkboxcreatemanually"><span class="opacitymedium">'.$langs->trans("OrEnterPageInfoManually").'</span></label><br>';
print '<label for="checkboxcreatemanually"><span class="opacitymediumxx">'.$langs->trans("OrEnterPageInfoManually").'</span></label><br>';
print '<hr class="tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
}
@ -3015,7 +3027,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<tr><td>';
print $langs->trans('Language');
print '</td><td>';
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 '</td></tr>';
// Translation of

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);