diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 035387834bd..84deea18f00 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -3,7 +3,7 @@
*Please:*
- *only keep the "Fix", "Close" or "New" section*
- *follow the project [contributing guidelines](/.github/CONTRIBUTING.md)*
-- *replace the bracket enclosed textswith meaningful informations*
+- *replace the bracket enclosed texts with meaningful information*
# Fix #[*issue_number Short description*]
diff --git a/ChangeLog b/ChangeLog
index f439186f5ca..b7a52d28069 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,11 +3,24 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
+***** ChangeLog for 15.0.0 compared to 14.0.0 *****
+
+For developers:
+---------------
+
+WARNING:
+
+Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
+* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
+* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
+
+
+
***** ChangeLog for 14.0.0 compared to 13.0.0 *****
For users:
----------
-NEW: Module Recruitement to follow application to job positions is now stable.
+NEW: Module Recruitment to follow application to job positions is now stable.
NEW: Feature to make Stock Inventories
NEW: Several security issues after a second private bug hunting campaign.
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
@@ -50,7 +63,7 @@ NEW: Make public bookmarks editable by admin users only
NEW: If main logo not defined, can use the squarred logo on login page
NEW: The manifest file can use the squared image if available
NEW: Enhance the multicurrency rate editor
-NEW: Normalyse Type company field with ajax combobox
+NEW: Normalise Type company field with ajax combobox
NEW: preload product description on selection for customer propal/order/invoice
NEW: Search usergroups & resources
NEW: Setup Page for module creation with module builder enhancement #FoundationFunding
@@ -67,14 +80,15 @@ NEW: #16378 more E-Mail Contact substitution Values for better salutation
NEW: option to keep the "Automatically create the payment" checkbox empty on the tax creation page
Accountancy
-NEW: Accountancy - Add FEC import
-NEW: Accountancy - Add a confirmation form with options on export
-NEW: Accountancy - Add select date from/to in already bind customer and supplier list
-NEW: Accountancy - Format FEC - Add new field DateLimitReglmt
-NEW: Accountancy - In ledger & journals, show link on bank transaction
-NEW: Accountancy - Possibility to filter on journals in balance
-NEW: Accountancy - Add a page to list subledger accounts
-NEW: Multiselect ledger account code filter on book keeping list
+NEW: Add FEC import
+NEW: Add a confirmation form with options on export (for notified export and validate operations)
+NEW: Add select date from/to in already bind customer and supplier list
+NEW: FEC / FEC2 export - Add new field DateLimitReglmt
+NEW: In ledger & journals, show link on bank transaction
+NEW: Possibility to filter on journals in balance
+NEW: Add a page to list subledger accounts
+NEW: Multiselect journal code filter on journal / balance / ledger
+NEW: Add first step to close fiscal year
Agenda
NEW: add support for Friday as a non working day
@@ -93,7 +107,7 @@ NEW: can filter files in ECM/GED on status Shared / Not shared
NEW: add a check to avoid an invoice date in the future
NEW: add the total of margin in invoice list
NEW: can set a percentage when creating an invoice from another object
-NEW: Support down payment on supplier invoice (& somes ajustments)
+NEW: Support down payment on supplier invoice (& some adjustments)
Margin
NEW: add the total of margin in invoice list
@@ -162,7 +176,7 @@ NEW: Add a security center page with all information and advices related to the
NEW: Add a performance center page with all information and advices related to the performance of your instance
Modules
-NEW: Module Recruitement is now stable
+NEW: Module Recruitment is now stable
NEW: start new experimental module Event Organization Management
NEW: start new experimental module Partnership Management
NEW: start new experimental module Knowledge Management
@@ -171,11 +185,14 @@ NEW: Check update availability for externals modules using a button on module pa
Module SimplePOS is deprecated - TakePOS is recommended for the future
new Options
-NEW: add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared
-NEW: add option SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared
-NEW: add option MAIN_SECURITY_ANTI_SSRF_SERVER_IP to define list of IPs that are local IPs
-NEW: add option SOCIETE_DISABLE_WORKFORCE to hide staff field
-NEW: add constant MAIN_BUGTRACK_URL to set a custom url to redirect to when clicking on link "declare a bug"
+NEW: add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared
+NEW: add option SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared
+NEW: add option MAIN_SECURITY_ANTI_SSRF_SERVER_IP to define list of IPs that are local IPs
+NEW: add option SOCIETE_DISABLE_WORKFORCE to hide staff field
+NEW: add constant MAIN_BUGTRACK_URL to set a custom url to redirect to when clicking on link "declare a bug"
+NEW: add constant ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY to manage binding with accountancy account declared on thirdparty card
+NEW: add constant MAIN_PRODUCT_PERENTITY_SHARED to manage some informations (Accounting account) when product is shared on several entities
+NEW: add constant MAIN_COMPANY_PERENTITY_SHARED to manage some informations (Accounting account) when company is shared on several entities
For developers:
@@ -209,7 +226,7 @@ NEW: hook printFieldListTitle for cabyprodserv.php
NEW: hook to allow external modules to add their own shortlist of recent objects
NEW: SQL-altering hooks in the turnover by product report
NEW: add form confirm hook on company card
-NEW: add hook addSectionECMAuto method to add custom diretory into ECM auto files
+NEW: add hook addSectionECMAuto method to add custom directory into ECM auto files
WARNING:
@@ -219,23 +236,24 @@ Following changes may create regressions for some external modules, but were nec
* The ICS value for direct debit or credit transfer is now stored on each bank account instead of into the global setup.
* API /setup/shipment_methods has been replaced with API /setup/shipping_methods
* Field "total" renamed into "total_ht" for table llx_facture, llx_facture_rec for better field name consistency
-* Field "tva" renamed into "total_tva" for table llx_propal, llx_supplier_proposal, llx_commande, llx_commande_fournisseur for better field name consistency
+* Field "tva" renamed into "total_tva" for llx_facture, table llx_propal, llx_supplier_proposal, llx_commande, llx_commande_fournisseur for better field name consistency
* Field "total" renamed into "total_ttc" for table llx_propal, llx_supplier_proposal for better field name consistency
* If your database is PostgreSQL, you must use version 9.1.0 or more (Dolibarr need the SQL function CONCAT)
* If your database is MySQL or MariaDB, you need at least version 5.1
* Function set_price_level() has been renamed into setPriceLevel() to follow camelcase rules
-* removed deprecated subtituion key __REFCLIENT__ (replaced with __REF_CLIENT__)
+* Removed deprecated substitution key __REFCLIENT__ (replaced with __REF_CLIENT__)
* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries.
+* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
***** ChangeLog for 13.0.4 compared to 13.0.3 *****
FIX: Allow disabling of a module (not a dangerous action) even if there is problem with token (due to bugged modules).
-FIX: 13.0 - fatal - missing inclusion of ajax.lib.php for calling `ajax_autocompleter()`
-FIX: #17919 pictures in docs.
+FIX: 13.0 - fatal - missing inclusion of ajax.lib.php for calling 'ajax_autocompleter()'
+FIX: #17919 pictures in docs
FIX: #18006
FIX: Accountancy - if we define a date start, automatic binding try to continue to solve old binding
-FIX: Accoutancy Limit date payment not registered on purchases operations
+FIX: Accountancy - Limit date payment not registered on purchases operations
FIX: Can't edit replacement invoice
FIX: deposit can create credit note in payment conf
FIX: division by zero on create
@@ -339,7 +357,7 @@ FIX: File attachment on lots/batches
FIX: handling $heightforinfotot when he's superior to a page height on Supplier Invoice
FIX: hourglass and hide button to pay
FIX: massaction validate invoice do not regenerate PDF
-FIX: missing mp4 video mime
+FIX: #16627 fix missing mp4 video mime
FIX: picto on shipment to reset qty to 0. Some quantities were not reset.
FIX: Protection to avoid #16504
FIX: rounding amount on card updating
diff --git a/README.md b/README.md
index 7878f6270a7..834cc09236e 100644
--- a/README.md
+++ b/README.md
@@ -79,7 +79,7 @@ If you don't have time to install it yourself, you can try some commercial 'read
## UPGRADING
-Dolibarr supports upgrading usually wihtout the need for any (commercial) support (depending on if you use any commercial extensions) and supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
+Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
- At first make a backup of your Dolibarr files & than [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).
diff --git a/dev/tools/spider.php b/dev/tools/spider.php
new file mode 100644
index 00000000000..954978b24df
--- /dev/null
+++ b/dev/tools/spider.php
@@ -0,0 +1,145 @@
+#!/usr/bin/env php
+.
+ */
+
+/**
+ * \file dev/tools/spider.php
+ * \brief Script to spider Dolibarr app.
+ *
+ * To use it:
+ * - Disable module "bookmark"
+ * - Exclude param optioncss, token, sortfield, sortorder
+ */
+
+$crawledLinks=array();
+const MAX_DEPTH=2;
+
+
+/**
+ * @param string $url URL
+ * @param string $depth Depth
+ * @return string String
+ */
+function followLink($url, $depth = 0)
+{
+ global $crawledLinks;
+ $crawling=array();
+ if ($depth>MAX_DEPTH) {
+ echo "
The Crawler is giving up!
";
+ return;
+ }
+ $options=array(
+ 'http'=>array(
+ 'method'=>"GET",
+ 'user-agent'=>"gfgBot/0.1\n"
+ )
+ );
+ $context=stream_context_create($options);
+ $doc=new DomDocument();
+ @$doc->loadHTML(file_get_contents($url, false, $context));
+ $links=$doc->getElementsByTagName('a');
+ $pageTitle=getDocTitle($doc, $url);
+ $metaData=getDocMetaData($doc);
+ foreach ($links as $i) {
+ $link=$i->getAttribute('href');
+ if (ignoreLink($link)) continue;
+ $link=convertLink($url, $link);
+ if (!in_array($link, $crawledLinks)) {
+ $crawledLinks[]=$link;
+ $crawling[]=$link;
+ insertIntoDatabase($link, $pageTitle, $metaData, $depth);
+ }
+ }
+ foreach ($crawling as $crawlURL)
+ followLink($crawlURL, $depth+1);
+}
+
+/**
+ * @param string $site Site
+ * @param string $path Path
+ * @return string String
+ */
+function convertLink($site, $path)
+{
+ if (substr_compare($path, "//", 0, 2)==0)
+ return parse_url($site)['scheme'].$path;
+ elseif (substr_compare($path, "http://", 0, 7)==0 or
+ substr_compare($path, "https://", 0, 8)==0 or
+ substr_compare($path, "www.", 0, 4)==0)
+ return $path;
+ else return $site.'/'.$path;
+}
+
+/**
+ * @param string $url URL
+ * @return boolean
+ */
+function ignoreLink($url)
+{
+ return $url[0]=="#" or substr($url, 0, 11) == "javascript:";
+}
+
+/**
+ * @param string $link URL
+ * @param string $title Title
+ * @param string $metaData Array
+ * @param int $depth Depth
+ * @return void
+ */
+function insertIntoDatabase($link, $title, &$metaData, $depth)
+{
+ //global $crawledLinks;
+
+ echo "Inserting new record {URL= ".$link.", Title = '$title', Description = '".$metaData['description']."', Keywords = ' ".$metaData['keywords']."'} ";
+
+ //²$crawledLinks[]=$link;
+}
+
+/**
+ * @param string $doc Doc
+ * @param string $url URL
+ * @return string URL/Title
+ */
+function getDocTitle(&$doc, $url)
+{
+ $titleNodes=$doc->getElementsByTagName('title');
+ if (count($titleNodes)==0 or !isset($titleNodes[0]->nodeValue))
+ return $url;
+ $title=str_replace('', '\n', $titleNodes[0]->nodeValue);
+ return (strlen($title)<1)?$url:$title;
+}
+
+/**
+ * @param string $doc Doc
+ * @return array Array
+ */
+function getDocMetaData(&$doc)
+{
+ $metaData=array();
+ $metaNodes=$doc->getElementsByTagName('meta');
+ foreach ($metaNodes as $node)
+ $metaData[$node->getAttribute("name")] = $node->getAttribute("content");
+ if (!isset($metaData['description']))
+ $metaData['description']='No Description Available';
+ if (!isset($metaData['keywords'])) $metaData['keywords']='';
+ return array(
+ 'keywords'=>str_replace('', '\n', $metaData['keywords']),
+ 'description'=>str_replace('', '\n', $metaData['description'])
+ );
+}
+
+
+followLink("http://localhost/dolibarr_dev/htdocs");
diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index 98320613bfc..f8c0c95d3c1 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -91,7 +91,6 @@ if ($action == 'update') {
if (!$error) {
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
- var_dump($constname);
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index 4c7194b2255..c156a388735 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -637,6 +637,8 @@ if ($action == 'create') {
print_liste_field_titre("Credit", "", "", "", "", 'class="right"');
if (empty($object->date_validation)) {
print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"');
+ } else {
+ print_liste_field_titre("");
}
print "\n";
@@ -683,8 +685,8 @@ if ($action == 'create') {
print ''.price($line->debit).' ';
print ''.price($line->credit).' ';
- if (empty($line->date_export) || empty($line->date_validation)) {
- print '';
+ print ' ';
+ if (empty($line->date_export) && empty($line->date_validation)) {
print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
print img_edit('', 0, 'class="marginrightonly"');
print ' ';
@@ -713,7 +715,7 @@ if ($action == 'create') {
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings');
}
- if (empty($object->date_export) || empty($object->date_validation)) {
+ if (empty($object->date_export) && empty($object->date_validation)) {
if ($action == "" || $action == 'add') {
print ' ';
print '';
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index a70bb710937..bc260c77ed3 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -366,42 +366,42 @@ if (empty($reshook)) {
if (!empty($search_date_creation_start)) {
$filter['t.date_creation>='] = $search_date_creation_start;
$tmp = dol_getdate($search_date_creation_start);
- $param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']);
+ $param .= '&search_date_creation_startmonth='.urlencode($tmp['mon']).'&search_date_creation_startday='.urlencode($tmp['mday']).'&search_date_creation_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_creation_end)) {
$filter['t.date_creation<='] = $search_date_creation_end;
$tmp = dol_getdate($search_date_creation_end);
- $param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']);
+ $param .= '&search_date_creation_endmonth='.urlencode($tmp['mon']).'&search_date_creation_endday='.urlencode($tmp['mday']).'&search_date_creation_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_modification_start)) {
$filter['t.tms>='] = $search_date_modification_start;
$tmp = dol_getdate($search_date_modification_start);
- $param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']);
+ $param .= '&search_date_modification_startmonth='.urlencode($tmp['mon']).'&search_date_modification_startday='.urlencode($tmp['mday']).'&search_date_modification_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_modification_end)) {
$filter['t.tms<='] = $search_date_modification_end;
$tmp = dol_getdate($search_date_modification_end);
- $param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']);
+ $param .= '&search_date_modification_endmonth='.urlencode($tmp['mon']).'&search_date_modification_endday='.urlencode($tmp['mday']).'&search_date_modification_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_export_start)) {
$filter['t.date_export>='] = $search_date_export_start;
$tmp = dol_getdate($search_date_export_start);
- $param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']);
+ $param .= '&search_date_export_startmonth='.urlencode($tmp['mon']).'&search_date_export_startday='.urlencode($tmp['mday']).'&search_date_export_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_export_end)) {
$filter['t.date_export<='] = $search_date_export_end;
$tmp = dol_getdate($search_date_export_end);
- $param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']);
+ $param .= '&search_date_export_endmonth='.urlencode($tmp['mon']).'&search_date_export_endday='.urlencode($tmp['mday']).'&search_date_export_endyear='.urlencode($tmp['year']);
}
if (!empty($search_date_validation_start)) {
$filter['t.date_validated>='] = $search_date_validation_start;
$tmp = dol_getdate($search_date_validation_start);
- $param .= '&date_validation_startmonth='.urlencode($tmp['mon']).'&date_validation_startday='.urlencode($tmp['mday']).'&date_validation_startyear='.urlencode($tmp['year']);
+ $param .= '&search_date_validation_startmonth='.urlencode($tmp['mon']).'&search_date_validation_startday='.urlencode($tmp['mday']).'&search_date_validation_startyear='.urlencode($tmp['year']);
}
if (!empty($search_date_validation_end)) {
$filter['t.date_validated<='] = $search_date_validation_end;
$tmp = dol_getdate($search_date_validation_end);
- $param .= '&date_validation_endmonth='.urlencode($tmp['mon']).'&date_validation_endday='.urlencode($tmp['mday']).'&date_validation_endyear='.urlencode($tmp['year']);
+ $param .= '&search_date_validation_endmonth='.urlencode($tmp['mon']).'&search_date_validation_endday='.urlencode($tmp['mday']).'&search_date_validation_endyear='.urlencode($tmp['year']);
}
if (!empty($search_debit)) {
$filter['t.debit'] = $search_debit;
@@ -576,7 +576,7 @@ if (!empty($sortfield)) {
// Export into a file with format defined into setup (FEC, CSV, ...)
// Must be after definition of $sql
if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->export) {
- // TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them.
+ // TODO Replace the fetchAll to get all ->line followed by call to ->export(). It consumew too much memory on large export. Replace this with the query($sql) and loop on each line to export them.
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
if ($result < 0) {
@@ -822,7 +822,7 @@ if (!empty($arrayfields['t.piece_num']['checked'])) {
// Code journal
if (!empty($arrayfields['t.code_journal']['checked'])) {
print '';
- print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
+ print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth150');
print ' ';
}
// Date document
@@ -865,7 +865,7 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) {
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount');
print '';
} else {
- print ' ';
+ print ' ';
}
print '';
}
@@ -904,10 +904,10 @@ print $hookmanager->resPrint;
if (!empty($arrayfields['t.date_creation']['checked'])) {
print '';
print '';
- print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print $form->selectDate($search_date_creation_start, 'search_date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '
';
print '';
- print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
+ print $form->selectDate($search_date_creation_end, 'search_date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '
';
print ' ';
}
@@ -915,10 +915,10 @@ if (!empty($arrayfields['t.date_creation']['checked'])) {
if (!empty($arrayfields['t.tms']['checked'])) {
print '';
print '';
- print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print $form->selectDate($search_date_modification_start, 'search_date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '
';
print '';
- print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print $form->selectDate($search_date_modification_end, 'search_date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '
';
print ' ';
}
@@ -926,10 +926,10 @@ if (!empty($arrayfields['t.tms']['checked'])) {
if (!empty($arrayfields['t.date_export']['checked'])) {
print '';
print '';
- print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '
';
print '';
- print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
+ print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '
';
print ' ';
}
@@ -937,10 +937,10 @@ if (!empty($arrayfields['t.date_export']['checked'])) {
if (!empty($arrayfields['t.date_validated']['checked'])) {
print '';
print '';
- print $form->selectDate($search_date_validation_start, 'date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '
';
print '';
- print $form->selectDate($search_date_validation_end, 'date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
+ print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '
';
print ' ';
}
@@ -1243,7 +1243,7 @@ while ($i < min($num, $limit)) {
// Action column
print '';
- if (empty($line->date_export) || empty($line->date_validation)) {
+ if (empty($line->date_export) && empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->creer) {
print '' . img_edit() . ' ';
}
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 98c3f14191b..27f23d36a74 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2016 Neil Orley
* Copyright (C) 2013-2016 Olivier Geffroy
* Copyright (C) 2013-2020 Florian Henry
- * Copyright (C) 2013-2020 Alexandre Spangaro
+ * Copyright (C) 2013-2021 Alexandre Spangaro
* Copyright (C) 2018 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -56,6 +56,14 @@ $search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
$search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
+$search_date_validation_startyear = GETPOST('search_date_validation_startyear', 'int');
+$search_date_validation_startmonth = GETPOST('search_date_validation_startmonth', 'int');
+$search_date_validation_startday = GETPOST('search_date_validation_startday', 'int');
+$search_date_validation_endyear = GETPOST('search_date_validation_endyear', 'int');
+$search_date_validation_endmonth = GETPOST('search_date_validation_endmonth', 'int');
+$search_date_validation_endday = GETPOST('search_date_validation_endday', 'int');
+$search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
+$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@@ -81,7 +89,7 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_
}
// Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -144,6 +152,7 @@ $arrayfields = array(
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
+ 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
@@ -221,6 +230,14 @@ if (empty($reshook)) {
$search_date_export_endyear = '';
$search_date_export_endmonth = '';
$search_date_export_endday = '';
+ $search_date_validation_start = '';
+ $search_date_validation_end = '';
+ $search_date_validation_startyear = '';
+ $search_date_validation_startmonth = '';
+ $search_date_validation_startday = '';
+ $search_date_validation_endyear = '';
+ $search_date_validation_endmonth = '';
+ $search_date_validation_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
@@ -301,6 +318,14 @@ if (empty($reshook)) {
$filter['t.date_export<='] = $search_date_export_end;
$param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
}
+ if (!empty($search_date_validation_start)) {
+ $filter['t.date_validated>='] = $search_date_validation_start;
+ $param .= '&search_date_validation_startmonth='.$search_date_validation_startmonth.'&search_date_validation_startday='.$search_date_validation_startday.'&search_date_validation_startyear='.$search_date_validation_startyear;
+ }
+ if (!empty($search_date_validation_end)) {
+ $filter['t.date_validated<='] = $search_date_validation_end;
+ $param .= '&search_date_validation_endmonth='.$search_date_validation_endmonth.'&search_date_validation_endday='.$search_date_validation_endday.'&search_date_validation_endyear='.$search_date_validation_endyear;
+ }
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@@ -484,10 +509,9 @@ $moreforfilter = '';
$moreforfilter .= '';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '
';
-$moreforfilter .= $langs->trans('From').' ';
-$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200');
-$moreforfilter .= ' '.$langs->trans('to').' ';
-$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200');
+$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200');
+$moreforfilter .= ' ';
+$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200');
$moreforfilter .= '
';
$moreforfilter .= '
';
@@ -564,6 +588,17 @@ if (!empty($arrayfields['t.date_export']['checked'])) {
print '';
print ' ';
}
+// Date validation
+if (!empty($arrayfields['t.date_validated']['checked'])) {
+ print '';
+ print '';
+ print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print '
';
+ print '';
+ print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
+ print '
';
+ print ' ';
+}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@@ -605,6 +640,9 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) {
if (!empty($arrayfields['t.date_export']['checked'])) {
print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
}
+if (!empty($arrayfields['t.date_validated']['checked'])) {
+ print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center ');
+}
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@@ -632,20 +670,19 @@ while ($i < min($num, $limit)) {
$accountg = length_accountg($line->numero_compte);
//if (empty($accountg)) $accountg = '-';
+ $colspan = 0; // colspan before field 'label of operation'
+ $colspanend = 3; // colspan after debit/credit
+ if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
+ if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; }
+ if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
+
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
- $colnumber = 5;
- $colnumberend = 7;
-
- if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
- $colnumber--;
- }
- if (empty($arrayfields['t.date_export']['checked'])) {
- $colnumber--;
- }
-
- $colspan = $totalarray['nbfield'] - $colnumber;
- $colspanend = $totalarray['nbfield'] - $colnumberend;
// Show a subtotal by accounting account
if (isset($displayed_account_number)) {
print ' ';
@@ -845,6 +882,14 @@ while ($i < min($num, $limit)) {
}
}
+ // Validated operation date
+ if (!empty($arrayfields['t.date_validated']['checked'])) {
+ print ''.dol_print_date($line->date_validation, 'dayhour').' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
@@ -852,12 +897,14 @@ while ($i < min($num, $limit)) {
// Action column
print '';
- if (empty($line->date_export)) {
+ if (empty($line->date_export) && empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->creer) {
- print ''.img_edit().' ';
+ print '' . img_edit() . ' ';
}
+ }
+ if (empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->supprimer) {
- print ' '.img_delete().' ';
+ print ''.img_delete().' ';
}
}
print ' ';
@@ -874,9 +921,7 @@ while ($i < min($num, $limit)) {
$i++;
}
-if ($num > 0) {
- $colspan = $totalarray['nbfield'] - $colnumber;
- $colspanend = $totalarray['nbfield'] - $colnumberend;
+if ($num > 0 && $colspan > 0) {
print ' ';
print ''.$langs->trans("TotalForAccount").' '.$accountg.': ';
print ''.price($sous_total_debit).' ';
diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php
index 20899c693c6..5e83c729fb1 100644
--- a/htdocs/accountancy/bookkeeping/listbysubaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php
@@ -2,8 +2,8 @@
/* Copyright (C) 2016 Neil Orley
* Copyright (C) 2013-2016 Olivier Geffroy
* Copyright (C) 2013-2020 Florian Henry
- * Copyright (C) 2013-2020 Alexandre Spangaro
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2013-2021 Alexandre Spangaro
+ * Copyright (C) 2018-2020 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,7 +46,7 @@ $search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
-$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear);
+$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
@@ -55,7 +55,15 @@ $search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
-$search_date_export_end = dol_mktime(0, 0, 0, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
+$search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
+$search_date_validation_startyear = GETPOST('search_date_validation_startyear', 'int');
+$search_date_validation_startmonth = GETPOST('search_date_validation_startmonth', 'int');
+$search_date_validation_startday = GETPOST('search_date_validation_startday', 'int');
+$search_date_validation_endyear = GETPOST('search_date_validation_endyear', 'int');
+$search_date_validation_endmonth = GETPOST('search_date_validation_endmonth', 'int');
+$search_date_validation_endday = GETPOST('search_date_validation_endday', 'int');
+$search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
+$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
$search_accountancy_code = GETPOST("search_accountancy_code");
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
@@ -144,6 +152,7 @@ $arrayfields = array(
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
+ 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1),
);
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
@@ -221,6 +230,14 @@ if (empty($reshook)) {
$search_date_export_endyear = '';
$search_date_export_endmonth = '';
$search_date_export_endday = '';
+ $search_date_validation_start = '';
+ $search_date_validation_end = '';
+ $search_date_validation_startyear = '';
+ $search_date_validation_startmonth = '';
+ $search_date_validation_startday = '';
+ $search_date_validation_endyear = '';
+ $search_date_validation_endmonth = '';
+ $search_date_validation_endday = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
@@ -301,6 +318,14 @@ if (empty($reshook)) {
$filter['t.date_export<='] = $search_date_export_end;
$param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
}
+ if (!empty($search_date_validation_start)) {
+ $filter['t.date_validated>='] = $search_date_validation_start;
+ $param .= '&search_date_validation_startmonth='.$search_date_validation_startmonth.'&search_date_validation_startday='.$search_date_validation_startday.'&search_date_validation_startyear='.$search_date_validation_startyear;
+ }
+ if (!empty($search_date_validation_end)) {
+ $filter['t.date_validated<='] = $search_date_validation_end;
+ $param .= '&search_date_validation_endmonth='.$search_date_validation_endmonth.'&search_date_validation_endday='.$search_date_validation_endday.'&search_date_validation_endyear='.$search_date_validation_endyear;
+ }
}
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
@@ -373,7 +398,6 @@ $title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccou
llxHeader('', $title_page);
-
// List
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@@ -448,7 +472,6 @@ print ' ';
print ' ';
-
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
@@ -488,10 +511,9 @@ $moreforfilter = '';
$moreforfilter .= '';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '
';
-$moreforfilter .= $langs->trans('From').' ';
-$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', 1, 'maxwidth200');
-$moreforfilter .= ' '.$langs->trans('to').' ';
-$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', 1, 'maxwidth200');
+$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
+$moreforfilter .= ' ';
+$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
$moreforfilter .= '
';
$moreforfilter .= '
';
@@ -568,6 +590,17 @@ if (!empty($arrayfields['t.date_export']['checked'])) {
print '';
print '';
}
+// Date validation
+if (!empty($arrayfields['t.date_validated']['checked'])) {
+ print '';
+ print '';
+ print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
+ print '
';
+ print '';
+ print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
+ print '
';
+ print ' ';
+}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
@@ -609,6 +642,9 @@ if (!empty($arrayfields['t.lettering_code']['checked'])) {
if (!empty($arrayfields['t.date_export']['checked'])) {
print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
}
+if (!empty($arrayfields['t.date_validated']['checked'])) {
+ print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center ');
+}
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@@ -636,21 +672,19 @@ while ($i < min($num, $limit)) {
$accountg = length_accounta($line->subledger_account);
//if (empty($accountg)) $accountg = '-';
+ $colspan = 0; // colspan before field 'label of operation'
+ $colspanend = 3; // colspan after debit/credit
+ if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
+ if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
+ if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; }
+ if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
+
// Is it a break ?
if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
- $colnumber = 5;
- $colnumberend = 7;
-
- if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) {
- $colnumber--;
- }
- if (empty($arrayfields['t.date_export']['checked'])) {
- $colnumber--;
- }
-
- $colspan = $totalarray['nbfield'] - $colnumber;
- $colspanend = $totalarray['nbfield'] - $colnumberend;
-
// Show a subtotal by accounting account
if (isset($displayed_account_number)) {
print '';
@@ -859,6 +893,14 @@ while ($i < min($num, $limit)) {
}
}
+ // Validated operation date
+ if (!empty($arrayfields['t.date_validated']['checked'])) {
+ print ''.dol_print_date($line->date_validation, 'dayhour').' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
@@ -866,12 +908,14 @@ while ($i < min($num, $limit)) {
// Action column
print '';
- if (empty($line->date_export)) {
+ if (empty($line->date_export) && empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->creer) {
- print ''.img_edit().' ';
+ print '' . img_edit() . ' ';
}
+ }
+ if (empty($line->date_validation)) {
if ($user->rights->accounting->mouvements->supprimer) {
- print ' '.img_delete().' ';
+ print ''.img_delete().' ';
}
}
print ' ';
@@ -888,9 +932,7 @@ while ($i < min($num, $limit)) {
$i++;
}
-if ($num > 0) {
- $colspan = $totalarray['nbfield'] - $colnumber;
- $colspanend = $totalarray['nbfield'] - $colnumberend;
+if ($num > 0 && $colspan > 0) {
print ' ';
print ''.$langs->trans("TotalForAccount").' '.$accountg.': ';
print ''.price($sous_total_debit).' ';
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index f007208cf57..d46580b98b2 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -5,7 +5,7 @@
* Copyright (C) 2015 Florian Henry
* Copyright (C) 2015 Raphaël Doursenaud
* Copyright (C) 2016 Pierre-Henry Favre
- * Copyright (C) 2016-2020 Alexandre Spangaro
+ * Copyright (C) 2016-2021 Alexandre Spangaro
* Copyright (C) 2013-2017 Olivier Geffroy
* Copyright (C) 2017 Elarifr. Ari Elbaz
* Copyright (C) 2017-2019 Frédéric France
@@ -59,6 +59,8 @@ class AccountancyExport
public static $EXPORT_TYPE_LDCOMPTA10 = 120;
public static $EXPORT_TYPE_GESTIMUMV3 = 130;
public static $EXPORT_TYPE_GESTIMUMV5 = 135;
+ public static $EXPORT_TYPE_ISUITEEXPERT = 200;
+ // Generic FEC after that
public static $EXPORT_TYPE_FEC = 1000;
public static $EXPORT_TYPE_FEC2 = 1010;
@@ -123,6 +125,7 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'),
+ self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
);
ksort($listofexporttypes, SORT_NUMERIC);
@@ -158,6 +161,7 @@ class AccountancyExport
self::$EXPORT_TYPE_GESTIMUMV5 => 'gestimumv5',
self::$EXPORT_TYPE_FEC => 'fec',
self::$EXPORT_TYPE_FEC2 => 'fec2',
+ self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert',
);
return $formatcode[$type];
@@ -243,6 +247,10 @@ class AccountancyExport
'label' => $langs->trans('Modelcsv_FEC2'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
+ self::$EXPORT_TYPE_ISUITEEXPERT => array(
+ 'label' => 'iSuite Expert',
+ 'ACCOUNTING_EXPORT_FORMAT' => 'csv',
+ ),
),
'cr'=> array(
'1' => $langs->trans("Unix"),
@@ -334,6 +342,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_FEC2:
$this->exportFEC2($TData);
break;
+ case self::$EXPORT_TYPE_ISUITEEXPERT :
+ $this->exportiSuiteExpert($TData);
+ break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
@@ -466,34 +477,43 @@ class AccountancyExport
}
/**
- * Export format : CIEL
+ * Export format : CIEL (Format XIMPORT)
+ * Format since 2003 compatible CIEL version > 2002 / Sage50
+ * Last review for this format : 2021/07/28 Alexandre Spangaro (aspangaro@open-dsi.fr)
+ *
+ * Help : https://sage50c.online-help.sage.fr/aide-technique/
+ * In sage software | Use menu : "Exchange" > "Importing entries..."
+ *
+ * If you want to force filename to "XIMPORT.TXT" for automatically import file present in a directory :
+ * use constant ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME
*
* @param array $TData data
* @return void
*/
public function exportCiel(&$TData)
{
- global $conf;
-
$end_line = "\r\n";
$i = 1;
- $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
+
foreach ($TData as $data) {
- $code_compta = $data->numero_compte;
+ $code_compta = length_accountg($data->numero_compte);
if (!empty($data->subledger_account)) {
- $code_compta = $data->subledger_account;
+ $code_compta = length_accounta($data->subledger_account);
}
+ $date_document = dol_print_date($data->doc_date, '%Y%m%d');
+ $date_echeance = dol_print_date($data->date_lim_reglement, '%Y%m%d');
+
$Tab = array();
- $Tab['num_ecriture'] = str_pad($i, 5);
+ $Tab['num_ecriture'] = str_pad($data->piece_num, 5);
$Tab['code_journal'] = str_pad($data->code_journal, 2);
- $Tab['date_ecriture'] = $date_ecriture;
- $Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
- $Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
+ $Tab['date_ecriture'] = str_pad($date_document, 8, ' ', STR_PAD_LEFT);
+ $Tab['date_echeance'] = str_pad($date_echeance, 8, ' ', STR_PAD_LEFT);
+ $Tab['num_piece'] = str_pad(self::trunc($data->doc_ref, 12), 12);
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25);
- $Tab['montant'] = str_pad(abs($data->debit - $data->credit), 13, ' ', STR_PAD_LEFT);
+ $Tab['montant'] = str_pad(price2fec(abs($data->debit - $data->credit)), 13, ' ', STR_PAD_LEFT);
$Tab['type_montant'] = str_pad($data->sens, 1);
$Tab['vide'] = str_repeat(' ', 18);
$Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34);
@@ -1287,7 +1307,9 @@ class AccountancyExport
/**
* Export format : LD Compta version 10 & higher
- * http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
+ * Last review for this format : 08-15-2021 Alexandre Spangaro (aspangaro@open-dsi.fr)
+ *
+ * Help : http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
*
* @param array $objectLines data
*
@@ -1450,14 +1472,14 @@ class AccountancyExport
print $date_lim_reglement.$separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
- if (($line->debit - $line->credit) > 0) {
+ if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign.
$nature_piece = 'AF';
} else {
$nature_piece = 'FF';
}
} elseif ($line->doc_type == 'customer_invoice') {
- if (($line->debit - $line->credit) < 0) {
- $nature_piece = 'AC';
+ if (($line->amount) < 0) {
+ $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign.
} else {
$nature_piece = 'FC';
}
@@ -1752,6 +1774,62 @@ class AccountancyExport
}
}
+ /**
+ * Export format : iSuite Expert
+ *
+ * by OpenSolus [https://opensolus.fr]
+ *
+ * @param array $objectLines data
+ *
+ * @return void
+ */
+ public function exportiSuiteExpert($objectLines)
+ {
+ $this->separator = ';';
+ $this->end_line = "\r\n";
+
+
+ foreach ($objectLines as $line) {
+ $tab = array();
+
+ $date = dol_print_date($line->doc_date, '%d/%m/%Y');
+
+ $tab[] = $line->piece_num;
+ $tab[] = $date;
+ $tab[] = substr($date, 6, 4);
+ $tab[] = substr($date, 3, 2);
+ $tab[] = substr($date, 0, 2);
+ $tab[] = $line->doc_ref;
+ //Conversion de chaine UTF8 en Latin9
+ $tab[] = mb_convert_encoding(str_replace(' - Compte auxiliaire', '', $line->label_operation), "Windows-1252", 'UTF-8');
+
+ //Calcul de la longueur des numéros de comptes
+ $taille_numero = strlen(length_accountg($line->numero_compte));
+
+ //Création du numéro de client générique
+ $numero_cpt_client = '411';
+ for ($i = 1; $i <= ($taille_numero - 3); $i++) {
+ $numero_cpt_client .= '0';
+ }
+
+ //Création des comptes auxiliaire des clients
+ if (length_accountg($line->numero_compte) == $numero_cpt_client) {
+ $tab[] = rtrim(length_accounta($line->subledger_account), "0");
+ } else {
+ $tab[] = length_accountg($line->numero_compte);
+ }
+ $nom_client = explode(" - ", $line->label_operation);
+ $tab[] = mb_convert_encoding($nom_client[0], "Windows-1252", 'UTF-8');
+ $tab[] = price($line->debit);
+ $tab[] = price($line->credit);
+ $tab[] = price($line->montant);
+ $tab[] = $line->code_journal;
+
+ $separator = $this->separator;
+ print implode($separator, $tab) . $this->end_line;
+ }
+ }
+
/**
* trunc
*
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 6bd39f4e227..0c9b4113c2a 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -729,7 +729,10 @@ class BookKeeping extends CommonObject
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
$sql .= " t.date_creation,";
- $sql .= " t.date_export,";
+ // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist
+ if ($mode != "_tmp") {
+ $sql .= " t.date_export,";
+ }
$sql .= " t.date_validated as date_validation";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
$sql .= ' WHERE 1 = 1';
@@ -1024,6 +1027,12 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
+ } elseif ($key == 't.code_journal' && !empty($value)) {
+ if (is_array($value)) {
+ $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
+ } else {
+ $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
+ }
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}
@@ -1506,6 +1515,7 @@ class BookKeeping extends CommonObject
$sql = "DELETE";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE piece_num = ".(int) $piecenum;
+ $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion
$sql .= " AND entity IN (".getEntity('accountancy').")";
$resql = $this->db->query($sql);
@@ -1621,7 +1631,11 @@ class BookKeeping extends CommonObject
global $conf;
$sql = "SELECT piece_num, doc_date,code_journal, journal_label, doc_ref, doc_type,";
- $sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation";
+ $sql .= " date_creation, tms as date_modification, date_validated as date_validation";
+ // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist
+ if ($mode != "_tmp") {
+ $sql .= ", date_export";
+ }
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
@@ -1698,7 +1712,11 @@ class BookKeeping extends CommonObject
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num,";
- $sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation";
+ $sql .= " date_creation, tms as date_modification, date_validated as date_validation";
+ // In llx_accounting_bookkeeping_tmp, field date_export doesn't exist
+ if ($mode != "_tmp") {
+ $sql .= ", date_export";
+ }
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php
index 6e13a662948..1842c23f418 100644
--- a/htdocs/accountancy/index.php
+++ b/htdocs/accountancy/index.php
@@ -49,7 +49,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) {
accessforbidden();
}
-if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) {
+if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->comptarapport->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) {
accessforbidden();
}
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index 34e533974fc..bdda4583d54 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -177,7 +177,7 @@ $accountingjournalstatic->fetch($id_journal);
$journal = $accountingjournalstatic->code;
$journal_label = $accountingjournalstatic->label;
-
+//print $sql;
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
@@ -252,6 +252,7 @@ if ($result) {
);
// Set accountancy code for user
+ // $obj->accountancy_code is the accountancy_code of table u=user but it is defined only if a link with type 'user' exists)
$compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : '');
$tabuser[$obj->rowid] = array(
@@ -277,7 +278,7 @@ if ($result) {
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
}
- // Load of url links to the line into llx_bank
+ // Load of url links to the line into llx_bank (so load llx_bank_url)
$links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
// By default
@@ -287,7 +288,7 @@ if ($result) {
// get_url may return -1 which is not traversable
if (is_array($links) && count($links) > 0) {
- // Now loop on each link of record in bank.
+ // Now loop on each link of record in bank (code similar to bankentries_list.php)
foreach ($links as $key => $val) {
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) {
// So we excluded 'company' and 'user' here. We want only payment lines
@@ -302,6 +303,7 @@ if ($result) {
}
}
+ // Special case to ask later to add more request to get information for old links without company link.
if ($links[$key]['type'] == 'withdraw') {
$tabmoreinfo[$obj->rowid]['withdraw'] = 1;
}
@@ -401,6 +403,44 @@ if ($result) {
$paymentsalstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id;
+
+ // This part of code is no more required. it is here to solve case where a link were missing (ith v14.0.0) and keep writing in accountancy complete.
+ // Note: A better way to fix this is to delete payement of salary and recreate it, or to fix the bookkeeping table manually after.
+ if (!empty($conf->global->ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT)) {
+ $tmpsalary = new Salary($db);
+ $tmpsalary->fetch($paymentsalstatic->id);
+ $tmpsalary->fetch_user($tmpsalary->fk_user);
+
+ $userstatic->id = $tmpsalary->user->id;
+ $userstatic->name = $tmpsalary->user->name;
+ $userstatic->email = $tmpsalary->user->email;
+ $userstatic->firstname = $tmpsalary->user->firstname;
+ $userstatic->lastname = $tmpsalary->user->lastname;
+ $userstatic->statut = $tmpsalary->user->statut;
+ $userstatic->accountancy_code = $tmpsalary->user->accountancy_code;
+
+ if ($userstatic->id > 0) {
+ $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0);
+ } else {
+ $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen
+ }
+
+ if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user.
+ $compta_user = $userstatic->accountancy_code;
+ if ($compta_user) {
+ $tabtp[$obj->rowid][$compta_user] += $obj->amount;
+ $tabuser[$obj->rowid] = array(
+ 'id' => $userstatic->id,
+ 'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname),
+ 'lastname' => $userstatic->lastname,
+ 'firstname' => $userstatic->firstname,
+ 'email' => $userstatic->email,
+ 'accountancy_code' => $compta_user,
+ 'status' => $userstatic->statut
+ );
+ }
+ }
+ }
} elseif ($links[$key]['type'] == 'payment_expensereport') {
$paymentexpensereportstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= $paymentexpensereportstatic->getNomUrl(2);
@@ -468,7 +508,7 @@ if ($result) {
}
}
- // If no links were found to know the amount on thirdparty, we init it to account 'NotDefined'.
+ // If no links were found to know the amount on thirdparty/user, we init it to account 'NotDefined'.
if (empty($tabtp[$obj->rowid])) {
$tabtp[$obj->rowid]['NotDefined'] = $tabbq[$obj->rowid][$compta_bank];
}
@@ -1162,9 +1202,9 @@ if (empty($action) || $action == 'view') {
if ($tabtype[$key] == 'unknown') {
// We will accept writing, but into a waiting account
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') {
- print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').' ';
+ print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').' ';
} else {
- print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).' '; // We will use a waiting account
+ print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).' '; // We will use a waiting account
}
} else {
// We will refuse writing
@@ -1187,7 +1227,7 @@ if (empty($action) || $action == 'view') {
if ($tabtype[$key] == 'member') {
$errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
}
- print ''.$langs->trans($errorstring).' ';
+ print ''.$langs->trans($errorstring).' ';
}
} else {
print $accounttoshow;
@@ -1196,7 +1236,7 @@ if (empty($action) || $action == 'view') {
// Subledger account
print "";
- if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payment with subledger
+ if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payments that uses a subledger
$accounttoshowsubledger = length_accounta($k);
if ($accounttoshow != $accounttoshowsubledger) {
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') {
@@ -1205,14 +1245,14 @@ if (empty($action) || $action == 'view') {
var_dump($tabbq[$key]);*/
//print ''.$langs->trans("ThirdpartyAccountNotDefined").' ';
if (!empty($tabcompany[$key]['code_compta'])) {
- if (in_array($tabtype[$key], array('payment_various'))) {
+ if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) {
// For such case, if subledger is not defined, we won't use subledger accounts.
- print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").' ';
+ print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").' ';
} else {
- print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).' ';
+ print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).' ';
}
} else {
- print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").' ';
+ print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").' ';
}
} else {
print $accounttoshowsubledger;
@@ -1220,10 +1260,15 @@ if (empty($action) || $action == 'view') {
}
}
print " ";
+
print "".$reflabel." ";
+
print ''.$val["type_payment"]." ";
+
print ''.($mt < 0 ? price(-$mt) : '')." ";
+
print ''.($mt >= 0 ? price($mt) : '')." ";
+
print " ";
}
}
diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php
index 1700d391f54..ecb0f7a6b09 100644
--- a/htdocs/accountancy/tpl/export_journal.tpl.php
+++ b/htdocs/accountancy/tpl/export_journal.tpl.php
@@ -16,6 +16,8 @@
* along with this program. If not, see .
*/
+// $formatexportset ùust be defined
+
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
@@ -56,6 +58,8 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
$completefilename = $siren."FEC".$endaccountingperiod.".txt";
+} elseif ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_CIEL && $type_export == "general_ledger" && !empty($conf->global->ACCOUNTING_EXPORT_XIMPORT_FORCE_FILENAME)) {
+ $completefilename = "XIMPORT.TXT";
} else {
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
}
diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
index 87b8a6874c4..419b32f3c34 100644
--- a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
+++ b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
@@ -31,8 +31,6 @@ print load_fiche_titre($this->control->tpl['title']);
dol_htmloutput_errors((is_numeric($object->error) ? '' : $object->error), $object->errors);
-dol_htmloutput_errors((is_numeric($GLOBALS['error']) ? '' : $GLOBALS['error']), $GLOBALS['errors']);
-
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
echo $this->control->tpl['ajax_selectcountry']; ?>
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 7c5d074d51e..42e0b84228f 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -535,7 +535,7 @@ if (empty($reshook)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
}
- if ($conf->global->ADHERENT_MAIL_REQUIRED && !isValidEMail($email)) {
+ if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($email)) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
@@ -1032,7 +1032,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
// EMail
- print ''.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? ' ' : '').' ';
+ print ''.(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? '' : '').$langs->trans("EMail").(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? ' ' : '').' ';
print ''.img_picto('', 'object_email').' ';
// Website
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index d669270b565..68430a71bab 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -65,6 +65,7 @@ $search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma');
$catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
+$socid = GETPOST('socid', 'int');
$filter = GETPOST("filter", 'alpha');
if ($filter) {
@@ -175,7 +176,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$massaction = '';
}
-$parameters = array('socid'=>$socid);
+$parameters = array('socid'=>isset($socid) ? $socid : null);
$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');
diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php
index cc216d794d1..0444d03b2ff 100644
--- a/htdocs/adherents/note.php
+++ b/htdocs/adherents/note.php
@@ -68,16 +68,21 @@ if ($id) {
$caneditfieldmember = $user->rights->adherent->creer;
}
+$hookmanager->initHooks(array('membernote'));
+
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
-
/*
* Actions
*/
-
-include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
-
+$reshook = $hookmanager->executeHooks('doActions', array(), $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)) {
+ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
+}
/*
diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php
index d3d84cb3624..7146e89648e 100644
--- a/htdocs/adherents/subscription/list.php
+++ b/htdocs/adherents/subscription/list.php
@@ -115,7 +115,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$massaction = '';
}
-$parameters = array('socid'=>$socid);
+$parameters = array('socid'=>isset($socid) ? $socid : null);
$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');
@@ -496,7 +496,7 @@ while ($i < min($num, $limit)) {
$adherent->gender = $obj->gender;
$adherent->morphy = $obj->morphy;
$adherent->email = $obj->email;
- $adherent->typeid = $obj->type;
+ $adherent->typeid = $obj->fk_type;
$adherent->datefin = $db->jdate($obj->datef);
$typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid);
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 033592a9afc..f640407c570 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -43,6 +43,8 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
+$sall = GETPOST("sall", "alpha");
+$filter = GETPOST("filter", 'alpha');
$search_lastname = GETPOST('search_lastname', 'alpha');
$search_login = GETPOST('search_login', 'alpha');
$search_email = GETPOST('search_email', 'alpha');
@@ -379,12 +381,12 @@ if ($action == 'create') {
print ''.$langs->trans("Description").' ';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor = new DolEditor('comment', $object->note, '', 200, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
+ $doleditor = new DolEditor('comment', $object->note, '', 200, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create();
print ' '.$langs->trans("WelcomeEMail").' ';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
+ $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create();
print ' ';
@@ -812,12 +814,12 @@ if ($rowid > 0) {
print ''.$langs->trans("Description").' ';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
+ $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create();
print " ";
print ''.$langs->trans("WelcomeEMail").' ';
- $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
+ $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create();
print " ";
diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php
index 7435fc440ed..6c8f273ae77 100644
--- a/htdocs/adherents/type_translation.php
+++ b/htdocs/adherents/type_translation.php
@@ -157,7 +157,7 @@ $form = new Form($db);
$formadmin = new FormAdmin($db);
$head = member_type_prepare_head($object);
-$titre = $langs->trans("MemberType".$object->type);
+$titre = $langs->trans("MemberType".$object->id);
// Calculate $cnt_trans
$cnt_trans = 0;
diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php
index b3a85d1fe4b..2b2da673202 100644
--- a/htdocs/admin/agenda_reminder.php
+++ b/htdocs/admin/agenda_reminder.php
@@ -226,6 +226,7 @@ if (empty($conf->cron->enabled)) {
// Get the max frequency of reminder
if ($job->id > 0) {
if ($job->status != $job::STATUS_ENABLED) {
+ $langs->load("cron");
print ''.$langs->trans("JobXMustBeEnabled", $langs->transnoentitiesnoconv("sendEmailsReminder")).' ';
} else {
print ''.img_picto($langs->trans('Enabled'), 'switch_on').' ';
diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php
index 25ada4d2d89..09ba880dd33 100644
--- a/htdocs/admin/clicktodial.php
+++ b/htdocs/admin/clicktodial.php
@@ -101,8 +101,8 @@ print ' ';
print $langs->trans("ClickToDialUrlDesc").' ';
print ' ';
print '';
-print $langs->trans("Example").': ';
-print 'http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__ ';
+print $langs->trans("Examples").': ';
+print 'https://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__ ';
print 'sip:__PHONETO__@my.sip.server';
print ' ';
@@ -134,7 +134,7 @@ if (!empty($conf->global->CLICKTODIAL_URL)) {
print ' ';
print $langs->trans("LinkToTestClickToDial", $user->login).' : ';
print ' ';
- print ' ';
+ print ' ';
print '';
$setupcomplete = 1;
@@ -149,7 +149,7 @@ if (!empty($conf->global->CLICKTODIAL_URL)) {
}
if ($setupcomplete) {
- print $langs->trans("LinkToTest", $user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL');
+ print $langs->trans("LinkToTest", $user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL', '', 'mobile');
} else {
$langs->load("errors");
print ''.$langs->trans("WarningClickToDialUserSetupNotComplete").'
';
diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php
index e7983ae4b95..df14ef4c1b0 100644
--- a/htdocs/admin/dav.php
+++ b/htdocs/admin/dav.php
@@ -45,6 +45,11 @@ $arrayofparameters = array(
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
);
+// To fix when dire does not exists
+dol_mkdir($conf->dav->dir_output.'/temp');
+dol_mkdir($conf->dav->dir_output.'/public');
+dol_mkdir($conf->dav->dir_output.'/private');
+
/*
* Actions
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 1ae714afdc5..6835ce82e60 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -202,7 +202,7 @@ $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as lib
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
-$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
+$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
@@ -294,7 +294,7 @@ $tabfield[3] = "code,libelle,country_id,country";
$tabfield[4] = "code,label";
$tabfield[5] = "code,label";
$tabfield[6] = "code,libelle,type,color,position";
-$tabfield[7] = "code,libelle,country,accountancy_code,deductible";
+$tabfield[7] = "code,libelle,country,accountancy_code";
$tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
$tabfield[9] = "code,label,unicode";
$tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
@@ -340,7 +340,7 @@ $tabfieldvalue[3] = "code,libelle,country";
$tabfieldvalue[4] = "code,label";
$tabfieldvalue[5] = "code,label";
$tabfieldvalue[6] = "code,libelle,type,color,position";
-$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
+$tabfieldvalue[7] = "code,libelle,country,accountancy_code";
$tabfieldvalue[8] = "code,libelle,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
$tabfieldvalue[9] = "code,label,unicode";
$tabfieldvalue[10] = "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
@@ -386,7 +386,7 @@ $tabfieldinsert[3] = "code_region,nom,fk_pays";
$tabfieldinsert[4] = "code,label";
$tabfieldinsert[5] = "code,label";
$tabfieldinsert[6] = "code,libelle,type,color,position";
-$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
+$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code";
$tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
$tabfieldinsert[9] = "code_iso,label,unicode";
$tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
@@ -695,7 +695,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
- // Check that all fields are filled
+ // Check that all mandatory fields are filled
$ok = 1;
foreach ($listfield as $f => $value) {
// Discard check of mandatory fields for country for some tables
@@ -1341,6 +1341,9 @@ if ($id) {
if ($value == 'short_label') {
$valuetoshow = $langs->trans("ShortLabel");
}
+ if ($value == 'fk_parent') {
+ $valuetoshow = $langs->trans("ParentID"); $class = 'center';
+ }
if ($value == 'range_account') {
$valuetoshow = $langs->trans("Range");
}
@@ -1683,6 +1686,9 @@ if ($id) {
if ($value == 'short_label') {
$valuetoshow = $langs->trans("ShortLabel");
}
+ if ($value == 'fk_parent') {
+ $valuetoshow = $langs->trans("ParentID"); $cssprefix = 'center ';
+ }
if ($value == 'range_account') {
$valuetoshow = $langs->trans("Range");
}
@@ -1992,10 +1998,7 @@ if ($id) {
if (in_array($value, array('pos', 'position'))) {
$class .= ' right';
}
- if ($value == 'localtax1_type') {
- $class .= ' nowrap';
- }
- if ($value == 'localtax2_type') {
+ if (in_array($value, array('localtax1_type', 'localtax2_type'))) {
$class .= ' nowrap';
}
if (in_array($value, array('use_default', 'fk_parent'))) {
@@ -2265,7 +2268,13 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '';
print $form->selectarray('source', $sourceList, (!empty($obj->{$value}) ? $obj->{$value}:''));
print ' ';
+ } elseif (in_array($value, array('public', 'use_default'))) {
+ // Fields 0/1 with a combo select Yes/No
+ print '';
+ print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value}:''), 1);
+ print ' ';
} elseif ($value == 'private') {
+ // Fields 'no'/'yes' with a combo select Yes/No
print '';
print $form->selectyesno("private", (!empty($obj->{$value}) ? $obj->{$value}:''));
print ' ';
@@ -2361,7 +2370,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print $form->selectExpenseRanges($obj->fk_range);
print '';
} else {
- $fieldValue = isset($obj->{$value}) ? $obj->{$value}:'';
+ $fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';
if ($value == 'sortorder') {
$fieldlist[$field] = 'position';
@@ -2377,12 +2386,18 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if (in_array($fieldlist[$field], array('dayrule', 'day', 'month', 'year', 'use_default', 'affect', 'delay', 'public', 'sortorder', 'sens', 'category_type', 'fk_parent'))) {
$class = 'maxwidth50 center';
}
- if (in_array($fieldlist[$field], array('use_default', 'public'))) {
+ if (in_array($fieldlist[$field], array('use_default', 'public', 'fk_parent'))) {
$classtd = 'center';
}
if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) {
$class = 'quatrevingtpercent';
}
+ // Fields that must be suggested as '0' instead of ''
+ if ($fieldlist[$field] == 'fk_parent') {
+ if (empty($fieldValue)) {
+ $fieldValue = '0';
+ }
+ }
print '';
$transfound = 0;
$transkey = '';
diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php
index 53d27efeba2..d01aece1ca0 100644
--- a/htdocs/admin/eventorganization.php
+++ b/htdocs/admin/eventorganization.php
@@ -34,13 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Translations
$langs->loadLangs(array("admin", "eventorganization"));
-// Access control
-if (!$user->admin) {
- accessforbidden();
-}
-
// Parameters
$action = GETPOST('action', 'aZ09');
+$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha');
@@ -70,11 +66,21 @@ $setupnotempty = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+// Access control
+if (empty($user->admin)) {
+ accessforbidden();
+}
+
+
/*
* Actions
*/
+if ($cancel) {
+ $action ='';
+}
+
if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
@@ -207,7 +213,7 @@ if ($action == 'edit') {
print ' ';
print '';
- print ''.$langs->trans("Parameter").' '.$langs->trans("Value").' ';
+ print ''.$langs->trans("Parameter").' '.$langs->trans("Value").' ';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
@@ -293,7 +299,9 @@ if ($action == 'edit') {
print '
';
print '';
- print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
print '
';
print '';
@@ -301,7 +309,7 @@ if ($action == 'edit') {
} else {
if (!empty($arrayofparameters)) {
print '';
- print ''.$langs->trans("Parameter").' '.$langs->trans("Value").' ';
+ print ''.$langs->trans("Parameter").' '.$langs->trans("Value").' ';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php
index f6ac529466e..c9214742d13 100644
--- a/htdocs/admin/holiday.php
+++ b/htdocs/admin/holiday.php
@@ -274,147 +274,141 @@ print '';
print ' ';
-if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
- print dol_get_fiche_end();
- // End of page
- llxFooter();
- $db->close();
- exit;
-}
-
/*
* Documents models for Holidays
*/
-print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
+if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
+ print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
-// Defined model definition table
-$def = array();
-$sql = "SELECT nom";
-$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
-$sql .= " WHERE type = '".$db->escape($type)."'";
-$sql .= " AND entity = ".$conf->entity;
-$resql = $db->query($sql);
-if ($resql) {
- $i = 0;
- $num_rows = $db->num_rows($resql);
- while ($i < $num_rows) {
- $array = $db->fetch_array($resql);
- array_push($def, $array[0]);
- $i++;
+ // Defined model definition table
+ $def = array();
+ $sql = "SELECT nom";
+ $sql .= " FROM ".MAIN_DB_PREFIX."document_model";
+ $sql .= " WHERE type = '".$db->escape($type)."'";
+ $sql .= " AND entity = ".$conf->entity;
+ $resql = $db->query($sql);
+ if ($resql) {
+ $i = 0;
+ $num_rows = $db->num_rows($resql);
+ while ($i < $num_rows) {
+ $array = $db->fetch_array($resql);
+ array_push($def, $array[0]);
+ $i++;
+ }
+ } else {
+ dol_print_error($db);
}
-} else {
- dol_print_error($db);
-}
-print '';
-print '
';
-print '';
-print ''.$langs->trans("Name").' ';
-print ''.$langs->trans("Description").' ';
-print ''.$langs->trans("Status")." \n";
-print ''.$langs->trans("Default")." \n";
-print ''.$langs->trans("ShortInfo").' ';
-print ''.$langs->trans("Preview").' ';
-print " \n";
+ print '';
+ print '
';
+ print '';
+ print ''.$langs->trans("Name").' ';
+ print ''.$langs->trans("Description").' ';
+ print ''.$langs->trans("Status")." \n";
+ print ''.$langs->trans("Default")." \n";
+ print ''.$langs->trans("ShortInfo").' ';
+ print ''.$langs->trans("Preview").' ';
+ print " \n";
-clearstatcache();
+ clearstatcache();
-foreach ($dirmodels as $reldir) {
- foreach (array('', '/doc') as $valdir) {
- $realpath = $reldir."core/modules/holiday".$valdir;
- $dir = dol_buildpath($realpath);
+ foreach ($dirmodels as $reldir) {
+ foreach (array('', '/doc') as $valdir) {
+ $realpath = $reldir."core/modules/holiday".$valdir;
+ $dir = dol_buildpath($realpath);
- if (is_dir($dir)) {
- $handle = opendir($dir);
- if (is_resource($handle)) {
- while (($file = readdir($handle)) !== false) {
- $filelist[] = $file;
- }
- closedir($handle);
- arsort($filelist);
+ if (is_dir($dir)) {
+ $handle = opendir($dir);
+ if (is_resource($handle)) {
+ while (($file = readdir($handle)) !== false) {
+ $filelist[] = $file;
+ }
+ closedir($handle);
+ arsort($filelist);
- foreach ($filelist as $file) {
- if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
- if (file_exists($dir.'/'.$file)) {
- $name = substr($file, 4, dol_strlen($file) - 16);
- $classname = substr($file, 0, dol_strlen($file) - 12);
+ foreach ($filelist as $file) {
+ if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
+ if (file_exists($dir.'/'.$file)) {
+ $name = substr($file, 4, dol_strlen($file) - 16);
+ $classname = substr($file, 0, dol_strlen($file) - 12);
- require_once $dir.'/'.$file;
- $module = new $classname($db);
+ require_once $dir.'/'.$file;
+ $module = new $classname($db);
- $modulequalified = 1;
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
- $modulequalified = 0;
- }
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
- $modulequalified = 0;
- }
-
- if ($modulequalified) {
- print '';
- print (empty($module->name) ? $name : $module->name);
- print " \n";
- if (method_exists($module, 'info')) {
- print $module->info($langs);
- } else {
- print $module->description;
+ $modulequalified = 1;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
+ $modulequalified = 0;
+ }
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
+ $modulequalified = 0;
}
- print ' ';
- // Active
- if (in_array($name, $def)) {
- print ''."\n";
- print '';
- print img_picto($langs->trans("Enabled"), 'switch_on');
- print ' ';
+ if ($modulequalified) {
+ print ' ';
+ print (empty($module->name) ? $name : $module->name);
+ print " \n";
+ if (method_exists($module, 'info')) {
+ print $module->info($langs);
+ } else {
+ print $module->description;
+ }
print ' ';
- } else {
- print ''."\n";
- print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').' ';
- print " ";
+
+ // Active
+ if (in_array($name, $def)) {
+ print ''."\n";
+ print '';
+ print img_picto($langs->trans("Enabled"), 'switch_on');
+ print ' ';
+ print ' ';
+ } else {
+ print ''."\n";
+ print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').' ';
+ print " ";
+ }
+
+ // Default
+ print '';
+ if ($conf->global->HOLIDAY_ADDON_PDF == $name) {
+ print img_picto($langs->trans("Default"), 'on');
+ } else {
+ print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').' ';
+ }
+ print ' ';
+
+ // Info
+ $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+ $htmltooltip .= ' '.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
+ if ($module->type == 'pdf') {
+ $htmltooltip .= ' '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
+ }
+ $htmltooltip .= ' '.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
+
+ $htmltooltip .= ''.$langs->trans("FeaturesSupported").': ';
+ $htmltooltip .= ' '.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
+ $htmltooltip .= ' '.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
+ $htmltooltip .= ' '.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
+ $htmltooltip .= ' '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
+ $htmltooltip .= ' '.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
+
+
+ print '';
+ print $form->textwithpicto('', $htmltooltip, 1, 0);
+ print ' ';
+
+ // Preview
+ print '';
+ if ($module->type == 'pdf') {
+ print ''.img_object($langs->trans("Preview"), 'pdf').' ';
+ } else {
+ print img_object($langs->trans("PreviewNotAvailable"), 'generic');
+ }
+ print ' ';
+
+ print " \n";
}
-
- // Default
- print '';
- if ($conf->global->HOLIDAY_ADDON_PDF == $name) {
- print img_picto($langs->trans("Default"), 'on');
- } else {
- print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').' ';
- }
- print ' ';
-
- // Info
- $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
- $htmltooltip .= ' '.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
- if ($module->type == 'pdf') {
- $htmltooltip .= ' '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
- }
- $htmltooltip .= ' '.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
-
- $htmltooltip .= ''.$langs->trans("FeaturesSupported").': ';
- $htmltooltip .= ' '.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
- $htmltooltip .= ' '.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
- $htmltooltip .= ' '.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
- $htmltooltip .= ' '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
- $htmltooltip .= ' '.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
-
-
- print '';
- print $form->textwithpicto('', $htmltooltip, 1, 0);
- print ' ';
-
- // Preview
- print '';
- if ($module->type == 'pdf') {
- print ''.img_object($langs->trans("Preview"), 'pdf').' ';
- } else {
- print img_object($langs->trans("PreviewNotAvailable"), 'generic');
- }
- print ' ';
-
- print "\n";
}
}
}
@@ -422,11 +416,11 @@ foreach ($dirmodels as $reldir) {
}
}
}
-}
-print '
';
-print '
';
-print " ";
+ print '
';
+ print '
';
+ print " ";
+}
/*
@@ -446,34 +440,118 @@ print ''.$langs->trans("Parameter").' ';
print ''.$langs->trans("Value").' ';
print "\n";
-$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
-$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach ($substitutionarray as $key => $val) {
- $htmltext .= $key.' ';
+/*var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
+var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
+var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
+var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
+*/
+if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
+ $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
}
-$htmltext .= ' ';
+if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
+ $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
+}
+/*
+var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
+var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
+var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
+var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
+*/
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
-print ' ';
-$variablename = 'HOLIDAY_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
- print '';
+// Set working days
+print ' ';
+print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Monday"))." ";
+print '';
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0);
} else {
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
+ if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) {
+ print ''.img_picto($langs->trans("Enabled"), 'on').' ';
+ } else {
+ print ''.img_picto($langs->trans("Disabled"), 'off').' ';
+ }
}
-print ' '."\n";
+print "";
+print "";
-//Use draft Watermark
+// Set working days
+print '';
+print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Friday"))." ";
+print '';
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0);
+} else {
+ if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) {
+ print ''.img_picto($langs->trans("Enabled"), 'on').' ';
+ } else {
+ print ''.img_picto($langs->trans("Disabled"), 'off').' ';
+ }
+}
+print " ";
+print " ";
-print '';
-print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
-print ' ';
-print ' ';
-print ' '."\n";
+// Set working days
+print '';
+print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Saturday"))." ";
+print '';
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1);
+} else {
+ if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
+ print ''.img_picto($langs->trans("Enabled"), 'on').' ';
+ } else {
+ print ''.img_picto($langs->trans("Disabled"), 'off').' ';
+ }
+}
+print " ";
+print " ";
+
+// Set working days
+print '';
+print "".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Sunday"))." ";
+print '';
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1);
+} else {
+ if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
+ print ''.img_picto($langs->trans("Enabled"), 'on').' ';
+ } else {
+ print ''.img_picto($langs->trans("Disabled"), 'off').' ';
+ }
+}
+print " ";
+print " ";
+
+if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
+ $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
+ $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
+ $htmltext = ''.$langs->trans("AvailableVariables").': ';
+ foreach ($substitutionarray as $key => $val) {
+ $htmltext .= $key.' ';
+ }
+ $htmltext .= ' ';
+
+ print '';
+ print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
+ print ' ';
+ $variablename = 'HOLIDAY_FREE_TEXT';
+ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
+ print '';
+ } else {
+ include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+ $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
+ print $doleditor->Create();
+ }
+ print ' '."\n";
+
+ //Use draft Watermark
+
+ print '';
+ print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
+ print ' ';
+ print ' ';
+ print ' '."\n";
+}
print '
';
print '';
diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php
index 396570b2155..c02ee501d94 100644
--- a/htdocs/admin/index.php
+++ b/htdocs/admin/index.php
@@ -51,6 +51,7 @@ if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/ /i', ' ', $conf->global->MAIN_MOTD_SETUPPAGE);
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
$i = 0;
+ $reg = array();
while (preg_match('/__\(([a-zA-Z|@]+)\)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) {
$tmp = explode('|', $reg[1]);
if (!empty($tmp[1])) {
@@ -81,7 +82,8 @@ print ' ';
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
$setupcompanynotcomplete = 1;
}
-print img_picto('', 'company', 'class="paddingright"').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
+print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
+print ' '.$langs->trans("SetupDescription3b");
if (!empty($setupcompanynotcomplete)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
@@ -92,7 +94,8 @@ print ' ';
print ' ';
// Show info setup module
-print img_picto('', 'cog', 'class="paddingright"').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
+print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
+print ' '.$langs->trans("SetupDescription4b");
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index 8d0fb1165a8..db3c45a0776 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -230,6 +230,9 @@ if (!empty($conf->agenda->enabled)) {
if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) {
$elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
}
+if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) {
+ $elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership'));
+}
$parameters = array('elementList'=>$elementList);
$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index c0c6b45464f..4c1df0fa938 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -47,7 +47,7 @@ $error = 0;
*/
// Action to update or add a constant
-if ($action == 'settemplates') {
+if ($action == 'settemplates' && $user->admin) {
$db->begin();
if (!$error && is_array($_POST)) {
@@ -192,7 +192,8 @@ print "\n";
print ' ';
print $langs->trans("NotificationEMailFrom").' ';
print '';
-print ' ';
+print img_picto('', 'email', 'class="pictofixedwidth"');
+print ' ';
if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) {
print ' '.img_warning($langs->trans("ErrorBadEMail"));
}
@@ -270,7 +271,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
}
$helptext = '';
- form_constantes($constantes, 3, $helptext);
+ form_constantes($constantes, 3, $helptext, 'EmailTemplate');
+
+ print '';
+ print '* '.$langs->trans("GoOntoUserCardToAddMore").' ';
+ if (!empty($conf->societe->enabled)) {
+ print '** '.$langs->trans("GoOntoContactCardToAddMore").' ';
+ }
+ print '
';
print '
';
} else {
@@ -316,15 +324,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print ' ';
print '';
-}
-
-print '';
-print '* '.$langs->trans("GoOntoUserCardToAddMore").'
';
-if (!empty($conf->societe->enabled)) {
- print '** '.$langs->trans("GoOntoContactCardToAddMore").'
';
+ print '
';
+ print '* '.$langs->trans("GoOntoUserCardToAddMore").' ';
+ if (!empty($conf->societe->enabled)) {
+ print '** '.$langs->trans("GoOntoContactCardToAddMore").' ';
+ }
+ print '
';
}
-print '
';
print '';
@@ -335,6 +342,7 @@ print ' ';
print '