From 2448b9ee55ed0eef1844aba8383e63842c600a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 30 Mar 2017 14:52:26 +0200 Subject: [PATCH 01/12] FIX #6619 Template invoices list do not respect restricted thirdparty user rights --- htdocs/compta/facture/fiche-rec.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index c7bf362ab7d..3a55c8b57c2 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1384,8 +1384,14 @@ else $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,"; $sql.= " f.date_last_gen, f.date_when"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; + if (! $user->rights->societe->client->voir && ! $socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; + if (! $user->rights->societe->client->voir && ! $socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + } if ($search_ref) $sql .= natural_search('f.titre', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency); From cd5b074a4829abf1bcaa32d1f1dfe925d8aaca19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 30 Mar 2017 15:21:20 +0200 Subject: [PATCH 02/12] FIX #6621 Documents tab shows greyed out upload form even if the option to show actions not available is disabled --- htdocs/core/class/html.formfile.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c117417e428..0821b9b2d2b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -89,6 +89,11 @@ class FormFile } else { + //If there is no permission and the option to hide unauthorized actions is enabled, then nothing is printed + if (!$perm && !empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { + return 1; + } + $maxlength=$size; $out = "\n\n\n"; From 4d7b059eb33ecf74c8443f125d735c2df8c8767a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Apr 2017 18:50:34 +0200 Subject: [PATCH 03/12] Release 4.0.5 --- ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/ChangeLog b/ChangeLog index cc6f1364f17..5fe3c741499 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,42 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. +***** ChangeLog for 4.0.5 to 4.0.4 ***** +FIX: #6234 +FIX: #6259 +FIX: #6330 +FIX: #6360 +FIX: #6411 +FIX: #6443 +FIX: #6444 +FIX: #6453 +FIX: #6503: SQL error in "Last pending payment invoices" +FIX: #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled +FIX: #6507: Statistics counter show wrong total Contract numbers when the user does not have full access +FIX: #6533 #6590 +FIX: #6619 Template invoices list do not respect restricted thirdparty user rights +FIX: #6621 Documents tab shows greyed out upload form even if the option to show actions not available is disabled +FIX: add entity param to document link +FIX: Can use quote into supplier ref on order line add +FIX: Change the customer code only if error on duplicate +FIX: Creation of credit note on invoice with deposit stole the discount. +FIX: delete bank class lines when we delete bank_categ +FIX: deletion of bank tag +FIX: detail of deposit and credit not was not visible into final invoice +FIX: Error management during bank account creation +FIX: error management in bank account deletion. +FIX: event status is not modified when assign an user +FIX: forgotten fk_facture_fourn attribute on supplierinvoice line object +FIX: If bank module on, field must be required to register payment of expense report. +FIX: load multicurrency informations on supplier order and bill lines fetch +FIX: Missing total on project overview. +FIX: multicurrency_subprice +FIX: param billed when we change page +FIX: protection against infinite loop on hierarchy +FIX: Supplier Order list filter by project +FIX: the dolCopyDir fails if target dir does not exists. +FIX: use param for http links + ***** ChangeLog for 4.0.4 to 4.0.3 ***** FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish FIX: #6230 From 00d485b2c5eff2416d621bb3ebf4c4791f0f5f14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Apr 2017 22:09:06 +0200 Subject: [PATCH 04/12] Start 4.0.6 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index c0f95fe76f7..d2ca04278ff 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.5'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.6'); if (! defined('EURO')) define('EURO',chr(128)); From 5b5380659e1be3b2512a99a897afce05edb221fa Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Mon, 3 Apr 2017 15:58:48 +0200 Subject: [PATCH 05/12] ERROR Categories Bank vs categories transactions PB since 4.0, present in 5.0 and develop version There is a confusion between the categorization function of bank accounts and the categorization function of the records. The categorization of the entries has been removed or it is not replaced by the categorization of the bank accounts. I propose for the moment to restore the old category of writings but to envisage the creation of a new type of category "bank records" (or if it is not necessary with the new account) to leave so --- htdocs/core/menus/standard/eldy.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 748a4532cb5..eab8f5a8c19 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1071,10 +1071,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->categorie->enabled)) { $langs->load("categories"); - //$newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer); $newmenu->add("/categories/index.php?type=5",$langs->trans("Rubriques"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags'); $newmenu->add("/categories/card.php?action=create&type=5",$langs->trans("NewCategory"),1,$user->rights->categorie->creer); - } + $newmenu->add("/compta/bank/categ.php",$langs->trans("RubriquesTransactions"),1,$user->rights->banque->configurer); + + } // Prelevements if (! empty($conf->prelevement->enabled)) From 4f292d124737decc420f248f1b1c3761c7d0a8d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Apr 2017 13:01:53 +0200 Subject: [PATCH 06/12] Prepare 5.0.2 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index f385fa2a524..427f428d652 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); From 7c868888a50b74b351998072df11ec9882be7a93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2017 01:01:43 +0200 Subject: [PATCH 07/12] FIX Add option MAIN_MAIL_USE_MULTI_PART to include text content into HTML email and add option MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS to restore the inline images feature. --- htdocs/core/class/CMailFile.class.php | 83 ++++++++++++++++----------- htdocs/core/class/smtps.class.php | 50 +++++++++++++--- 2 files changed, 92 insertions(+), 41 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 396952ace9c..878e0372ab3 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -55,7 +55,6 @@ class CMailFile var $eol; var $eol2; - var $atleastonefile=0; var $error=''; var $smtps; // Contains SMTPs object (if this method is used) @@ -74,7 +73,7 @@ class CMailFile // Image var $html; var $image_boundary; - var $atleastoneimage=0; + var $atleastoneimage=0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). var $html_images=array(); var $images_encoded=array(); var $image_types = array('gif' => 'image/gif', @@ -108,7 +107,7 @@ class CMailFile */ function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='') { - global $conf; + global $conf, $dolibarr_main_data_root; // We define end of line (RFC 821). $this->eol="\r\n"; @@ -160,8 +159,12 @@ class CMailFile if ($this->msgishtml) { $this->html = $msg; - $findimg = $this->findHtmlImages($conf->fckeditor->dir_output); + if (! empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) + { + $findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias'); + } + // Define if there is at least one file if ($findimg) { @@ -231,17 +234,6 @@ class CMailFile // Define body in text_body $text_body = $this->write_body($msg); - // Encode images - $images_encoded = ''; - if ($this->atleastoneimage) - { - $images_encoded.= $this->write_images($this->images_encoded); - // always end related and end alternative after inline images - $images_encoded.= "--" . $this->related_boundary . "--" . $this->eol; - $images_encoded.= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol; - $images_encoded.= $this->eol; - } - // Add attachments to text_encoded if ($this->atleastonefile) { @@ -255,8 +247,8 @@ class CMailFile // comme des injections mail par les serveurs de messagerie. $this->headers = preg_replace("/([\r\n]+)$/i","",$this->headers); - $this->message = 'This is a message with multiple parts in MIME format.'.$this->eol; - $this->message.= $text_body . $images_encoded . $files_encoded; + $this->message = $this->eol.'This is a message with multiple parts in MIME format.'.$this->eol; + $this->message.= $text_body . $files_encoded; $this->message.= "--" . $this->mixed_boundary . "--" . $this->eol; } else if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps') @@ -917,7 +909,7 @@ class CMailFile $out.= "Content-Type: multipart/mixed; boundary=\"".$this->mixed_boundary."\"".$this->eol2; $out.= "Content-Transfer-Encoding: 8bit".$this->eol2; - + dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out); return $out; } @@ -973,23 +965,23 @@ class CMailFile $out.= "--" . $this->alternative_boundary . $this->eol; } - if ($this->msgishtml) - { - // Check if html header already in message - $strContent = $this->checkIfHTML($msgtext); - } - else - { - $strContent = $msgtext; - } - // Make RFC821 Compliant, replace bare linefeeds - $strContent = preg_replace("/(?global->MAIN_FIX_FOR_BUGGED_MTA)) { $strContent = preg_replace("/\r\n/si", "\n", $strContent); } + $strContentAltText = ''; + if ($this->msgishtml) + { + $strContentAltText = html_entity_decode(strip_tags($strContent)); + $strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n")); + + // Check if html header already in message, if not complete the message + $strContent = $this->checkIfHTML($strContent); + } + // Make RFC2045 Compliant, split lines //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content $strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content. @@ -999,14 +991,30 @@ class CMailFile if ($this->atleastoneimage) { $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; - $out.= $this->eol.strip_tags($strContent).$this->eol; // Add plain text message + $out.= $this->eol.($strContentAltText?$strContentAltText:strip_tags($strContent)).$this->eol; // Add plain text message $out.= "--" . $this->alternative_boundary . $this->eol; $out.= "Content-Type: multipart/related; boundary=\"".$this->related_boundary."\"".$this->eol; $out.= $this->eol; $out.= "--" . $this->related_boundary . $this->eol; } + + if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part + { + $out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol; + $out.= $this->eol; + $out.= "--" . $this->alternative_boundary . $this->eol; + $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; + $out.= $this->eol.$strContentAltText.$this->eol; + $out.= "--" . $this->alternative_boundary . $this->eol; + } + $out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol; $out.= $this->eol.$strContent.$this->eol; + + if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part + { + $out.= "--" . $this->alternative_boundary . "--". $this->eol; + } } else { @@ -1016,6 +1024,16 @@ class CMailFile $out.= $this->eol; + // Encode images + if ($this->atleastoneimage) + { + $out .= $this->write_images($this->images_encoded); + // always end related and end alternative after inline images + $out .= "--" . $this->related_boundary . "--" . $this->eol; + $out .= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol; + $out .= $this->eol; + } + return $out; } @@ -1184,14 +1202,15 @@ class CMailFile $extensions = array_keys($this->image_types); - preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); + preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found if ($matches) { $i=0; foreach ($matches[1] as $full) { - if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs)) + + if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs)) // If xxx is 'file=aaa' { $img = $regs[1]; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index e7c7b343ac9..c99ca2c4850 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1283,15 +1283,23 @@ class SMTPs // Make RFC821 Compliant, replace bare linefeeds $strContent = preg_replace("/(?_msgContent[$strType] = array(); $this->_msgContent[$strType]['mimeType'] = $strMimeType; $this->_msgContent[$strType]['data'] = $strContent; - + $this->_msgContent[$strType]['dataText'] = $strContentAltText; + if ( $this->getMD5flag() ) $this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3); //} @@ -1304,6 +1312,8 @@ class SMTPs */ function getBodyContent() { + global $conf; + // Generate a new Boundary string $this->_setBoundary(); @@ -1318,7 +1328,7 @@ class SMTPs die ("Sorry, no content"); // If we have ONE, we can use the simple format - else if( $keyCount === 1 ) + else if( $keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { $_msgData = $this->_msgContent; $_msgData = $_msgData[$_types[0]]; @@ -1336,7 +1346,7 @@ class SMTPs } // If we have more than ONE, we use the multi-part format - else if( $keyCount > 1 ) + else if( $keyCount >= 1 || ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { // Since this is an actual multi-part message // We need to define a content message Boundary @@ -1351,14 +1361,18 @@ class SMTPs $content .= "\r\n"; $content .= "--" . $this->_getBoundary('mixed') . "\r\n"; - - if (key_exists('image', $this->_msgContent)) + + if (key_exists('image', $this->_msgContent)) // If inline image found { $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n"; $content .= "\r\n"; $content .= "--" . $this->_getBoundary('alternative') . "\r\n"; } + + // $this->_msgContent must be sorted with key 'text' or 'html' first then 'image' then 'attachment' + + // Loop through message content array foreach ($this->_msgContent as $type => $_content ) { @@ -1409,13 +1423,24 @@ class SMTPs if (key_exists('image', $this->_msgContent)) { $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n"; - $content.= "\r\n" . strip_tags($_content['data']) . "\r\n"; // Add plain text message + $content.= "\r\n" . ($_content['dataText']?$_content['dataText']:strip_tags($_content['data'])) . "\r\n"; // Add plain text message $content.= "--" . $this->_getBoundary('alternative') . "\r\n"; $content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n"; $content.= "\r\n"; $content.= "--" . $this->_getBoundary('related') . "\r\n"; } - + + if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part + { + $content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n"; + $content .= "\r\n"; + $content .= "--" . $this->_getBoundary('alternative') . "\r\n"; + + $content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n"; + $content.= "\r\n". $_content['dataText'] . "\r\n"; + $content.= "--" . $this->_getBoundary('alternative') . "\r\n"; + } + $content .= 'Content-Type: ' . $_content['mimeType'] . '; ' // . 'charset="' . $this->getCharSet() . '"'; . 'charset=' . $this->getCharSet() . ''; @@ -1431,7 +1456,14 @@ class SMTPs if ( $this->getMD5flag() ) $content .= 'Content-MD5: ' . $_content['md5'] . "\r\n"; - $content .= "\r\n" . $_content['data'] . "\r\n\r\n"; + $content .= "\r\n" . $_content['data'] . "\r\n"; + + if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part + { + $content.= "--" . $this->_getBoundary('alternative') . "--". "\r\n"; + } + + $content .= "\r\n"; } } From a6c60e4a9a84f413f19651a99bfcf1cf0a41469d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2017 11:14:02 +0200 Subject: [PATCH 08/12] FIX shared bank account with multicompany not visible in invoice setup --- htdocs/admin/facture.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 21ddabc1b65..b9c994fba28 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -638,7 +638,7 @@ if (! empty($conf->banque->enabled)) $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE clos = 0"; $sql.= " AND courant = 1"; - $sql.= " AND entity IN (".getEntity('bank', 1).")"; + $sql.= " AND entity IN (".getEntity('bank_account', 1).")"; $resql=$db->query($sql); if ($resql) { @@ -683,7 +683,7 @@ $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE clos = 0"; $sql.= " AND courant = 1"; -$sql.= " AND entity IN (".getEntity('bank', 1).")"; +$sql.= " AND entity IN (".getEntity('bank_account', 1).")"; $var=True; $resql=$db->query($sql); if ($resql) From e2b96abd0bfcaa5198cbeb2fd4f545885f102a33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2017 13:34:52 +0200 Subject: [PATCH 09/12] Fix translation --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7cd29345e98..d305eb5e540 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -208,7 +208,7 @@ MainDbPasswordFileConfEncrypted=Database password encrypted in conf.php (Activat InstrucToEncodePass=To have password encoded into the conf.php file, replace the line
$dolibarr_main_db_pass="...";
by
$dolibarr_main_db_pass="crypted:%s"; InstrucToClearPass=To have password decoded (clear) into the conf.php file, replace the line
$dolibarr_main_db_pass="crypted:...";
by
$dolibarr_main_db_pass="%s"; ProtectAndEncryptPdfFiles=Protection of generated pdf files (Activated NOT recommended, breaks mass pdf generation) -ProtectAndEncryptPdfFilesDesc=Protection of a PDF document keeps it available to read and print with any PDF browser. However, editing and copying is not possible anymore. Note that using this feature make building of a global cumulated pdf not working (like unpaid invoices). +ProtectAndEncryptPdfFilesDesc=Protection of a PDF document keeps it available to read and print with any PDF browser. However, editing and copying is not possible anymore. Note that using this feature makes building of a global merged PDFs not working. Feature=Feature DolibarrLicense=License Developpers=Developers/contributors From dc14268ac6699d8ea0ee8ab2b6cdd6758914dcbf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Apr 2017 15:24:41 +0200 Subject: [PATCH 10/12] FIX complete hourly rate when not defined into table of time spent --- htdocs/install/repair.php | 76 ++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index cdaa0b22b7f..0338945df0f 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -76,6 +76,7 @@ print 'Option restore_thirdparties_logos is '.(GETPOST('restore_thirdparties_log print 'Option clean_linked_elements is '.(GETPOST('clean_linked_elements')?GETPOST('clean_linked_elements'):'0').'
'."\n"; print 'Option clean_orphelin_dir (1 or confirmed) is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'
'."\n"; print 'Option clean_product_stock_batch (1 or confirmed) is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'
'."\n"; +print 'Option set_empty_time_spent_amount (1 or confirmed) is '.(GETPOST('set_empty_time_spent_amount')?GETPOST('set_empty_time_spent_amount'):'0').'
'."\n"; print '
'; print ''; @@ -151,7 +152,7 @@ if ($ok) } // Show wait message -print ''; +print ''; flush(); @@ -190,7 +191,7 @@ if ($ok) // Loop on each file foreach($filelist as $file) { - print ''; $name = substr($file, 0, dol_strlen($file) - 4); @@ -210,7 +211,7 @@ if ($ok) 'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture', 'commande_fournisseur'=>'commande_fournisseur', 'actioncomm'=>'actioncomm', 'adherent_type'=>'adherent_type','user'=>'user','projet'=>'projet', 'projet_task'=>'projet_task'); - print ''; + print ''; foreach($listofmodulesextra as $tablename => $elementtype) { // Get list of fields @@ -324,7 +325,7 @@ if ($ok && GETPOST('restore_thirdparties_logos')) $ext=''; - print ''; + print ''; // propal => order print '\n"; @@ -435,7 +436,7 @@ if ($ok && GETPOST('clean_orphelin_dir')) if (empty($upload_dir)) continue; - print ''; + print ''; $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview\.png)$','^temp$','^payments$','^CVS$','^thumbs$'),'',SORT_DESC,1,true); @@ -546,7 +547,7 @@ if ($ok && GETPOST('clean_orphelin_dir')) // clean_linked_elements: Check and clean linked elements if ($ok && GETPOST('clean_product_stock_batch')) { - print ''; + print ''; $sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch"; $sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb"; @@ -636,12 +637,69 @@ if ($ok && GETPOST('clean_product_stock_batch')) { dol_print_error($db); } - - } +// clean_linked_elements: Check and clean linked elements +if ($ok && GETPOST('set_empty_time_spent_amount')) +{ + print ''; + + $sql ="SELECT COUNT(ptt.rowid) as nb, u.rowid as user_id, u.login, u.thm as user_thm"; + $sql.=" FROM ".MAIN_DB_PREFIX."projet_task_time as ptt, ".MAIN_DB_PREFIX."user as u"; + $sql.=" WHERE ptt.fk_user = u.rowid"; + $sql.=" AND ptt.thm IS NULL and u.thm > 0"; + $sql.=" GROUP BY u.rowid, u.login, u.thm"; + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + + if ($num) + { + $i = 0; + while ($i < $num) + { + $obj=$db->fetch_object($resql); + print ''; + + if ($error) break; + + $i++; + } + } + else + { + print ''; + } + } + else + { + dol_print_error($db); + } + + +} + + print '
'.$langs->trans("PleaseBePatient").'
'.$langs->trans("PleaseBePatient").'

'; + print '
*** '; print $langs->trans("Script").''.$file.'

Check fields into extra table structure match table of definition. If not add column into table

*** Check fields into extra table structure match table of definition. If not add column into table

'; + print '

*** Restore thirdparties logo
'; //foreach($exts as $ext) //{ $sql="SELECT s.rowid, s.nom as name, s.logo FROM ".MAIN_DB_PREFIX."societe as s ORDER BY s.nom"; @@ -395,7 +396,7 @@ if ($ok && GETPOST('restore_thirdparties_logos')) // clean_linked_elements: Check and clean linked elements if ($ok && GETPOST('clean_linked_elements')) { - print '

Check table of linked elements and delete orphelins links

*** Check table of linked elements and delete orphelins links
'.checkLinkedElements('propal', 'commande')."

Clean orphelins files into files '.$upload_dir.'

*** Clean orphelins files into files '.$upload_dir.'

Clean table product_batch

*** Clean table product_batch

*** Set value of time spent without amount
'.$obj->login.'-'.$obj->user_id.' ('.$obj->nb.' lines to fix) -> '.$obj->user_thm; + + $db->begin(); + + $sql2 ="UPDATE ".MAIN_DB_PREFIX."projet_task_time"; + $sql2.=" SET thm = ".$obj->user_thm." WHERE thm IS NULL AND fk_user = ".$obj->user_id; + $resql2=$db->query($sql2); + if (! $resql2) + { + $error++; + dol_print_error($db); + } + + if (!$error) $db->commit(); + else $db->rollback(); + + print'
No time spent with empty line on users with a hourly rate defined
'; From 18fc5bec9b143276c09df9b50ff8497d61b60a8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2017 10:56:37 +0200 Subject: [PATCH 11/12] Better log --- htdocs/product/stock/class/mouvementstock.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 631f6697c33..6088c14ed60 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -176,8 +176,8 @@ class MouvementStock extends CommonObject if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility { // If found and eatby/sellby defined into table and provided and differs, return error - $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)); - dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR); + $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatby, 'dayhour')); + dol_syslog("ThisSerialAlreadyExistWithDifferentDate batch=".$batch.", eatby found into product_lot = ".$obj->eatby." = ".dol_print_date($this->db->jdate($obj->eatby), 'dayhourrfc')." so eatbywithouthour = ".$eatbywithouthour." = ".dol_print_date($eatbywithouthour)." - eatby provided = ".$eatby." = ".dol_print_date($eatby, 'dayhourrfc'), LOG_ERR); $this->db->rollback(); return -3; } From fe4f71296f13a2231bfbe603d8ed9dd256026cfd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2017 21:55:23 +0200 Subject: [PATCH 12/12] FIX #6636 Complete fix --- htdocs/compta/bank/categ.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- htdocs/langs/en_US/categories.lang | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 51030242fce..ae35eee80fa 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -80,7 +80,7 @@ if ($categid) { llxHeader(); -print load_fiche_titre($langs->trans("Rubriques"), '', 'title_bank.png'); +print load_fiche_titre($langs->trans("RubriquesTransactions"), '', 'title_bank.png'); print '
'; print ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index eab8f5a8c19..aa98f23b2ad 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1073,8 +1073,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("categories"); $newmenu->add("/categories/index.php?type=5",$langs->trans("Rubriques"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags'); $newmenu->add("/categories/card.php?action=create&type=5",$langs->trans("NewCategory"),1,$user->rights->categorie->creer); - $newmenu->add("/compta/bank/categ.php",$langs->trans("RubriquesTransactions"),1,$user->rights->banque->configurer); - + $newmenu->add("/compta/bank/categ.php",$langs->trans("RubriquesTransactions"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags'); + $newmenu->add("/compta/bank/categ.php",$langs->trans("NewCategory"),1,$user->rights->categorie->creer, '', $mainmenu, 'tags'); } // Prelevements diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 976c8a50d93..b8a1e5ef58b 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -1,6 +1,7 @@ # Dolibarr language file - Source file is en_US - categories Rubrique=Tag/Category Rubriques=Tags/Categories +RubriquesTransactions=Tags/Categories of transactions categories=tags/categories NoCategoryYet=No tag/category of this type created In=In