From 01279edfc82213a4b875d709c5e452a44bfc791f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Nov 2014 16:36:32 +0100 Subject: [PATCH 1/6] Fixed: [ bug #1570 ] Negative supplier invoices do not appear in bank planned transactions. --- htdocs/compta/bank/treso.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index f6c59530605..b9274c34eb5 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -164,7 +164,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $sql.= " ORDER BY dlr ASC"; // Supplier invoices - $sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref_supplier as ref, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; + $sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; $sql2.= " s.rowid as socid, s.nom, s.fournisseur"; $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; @@ -260,12 +260,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($obj->family == 'invoice_supplier') { - // TODO This code is to avoid to count suppliers credit note (ff.type = 2) - // Ajouter gestion des avoirs fournisseurs, champ - if (($obj->total_ttc < 0 && $obj->type != 2) - || ($obj->total_ttc > 0 && $obj->type == 2)) + $showline=1; + // Uncomment this line to avoid to count suppliers credit note (ff.type = 2) + //$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2)) + if ($showline) { - $facturefournstatic->ref=$obj->ref; + $ref=$obj->ref; + $facturefournstatic->ref=$ref; $facturefournstatic->id=$obj->objid; $facturefournstatic->type=$obj->type; $ref = $facturefournstatic->getNomUrl(1,''); @@ -304,7 +305,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($paiement) $total_ttc = $obj->total_ttc - $paiement; $solde += $total_ttc; - // We discard with a remain to pay to 0 + // We discard lines with a remainder to pay to 0 if (price2num($total_ttc) != 0) { $var=!$var; From 31f987706ca4abe415b856daca088be85627f2a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Nov 2014 15:09:52 +0100 Subject: [PATCH 2/6] Fix: bugs reported by scrutinizer --- htdocs/accountancy/class/bookkeeping.class.php | 1 + htdocs/core/class/extrafields.class.php | 7 +++---- htdocs/install/mysql/migration/repair.sql | 10 ++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 861de271dab..6291790d008 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -31,6 +31,7 @@ class BookKeeping { var $db; var $error; + var $errors; var $id; var $doc_date; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5448df14010..a4396624f86 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -535,8 +535,7 @@ class ExtraFields $array_name_label=array(); // For avoid conflicts with external modules - if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) - return $array_name_label; + if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; @@ -569,13 +568,13 @@ class ExtraFields $this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable; } } - - return $array_name_label; } else { print dol_print_error($this->db); } + + return $array_name_label; } diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 4083ba2f7b9..9b81f0ca78d 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -204,3 +204,13 @@ UPDATE llx_projet_task_time set task_datehour = task_date where task_datehour IS -- GRANT ALL ON *.* TO 'myuser'@'%'; -- flush privileges; +-- Fix type of product 2 does not exists +update llx_propaldet set product_type = 1 where product_type = 2; +update llx_commandedet set product_type = 1 where product_type = 2; +update llx_facturedet set product_type = 1 where product_type = 2; +--update llx_propaldet as d set d.product_type = 1 where d.fk_product = 22 and d.product_type = 0; +--update llx_commandedet as d set d.product_type = 1 where d.fk_product = 22 and d.product_type = 0; +--update llx_facturedet as d set d.product_type = 1 where d.fk_product = 22 and d.product_type = 0; + + + From c077998ff8decdf4fbfdc79f136495045a7060fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Nov 2014 14:26:06 +0100 Subject: [PATCH 3/6] Fix: Line not visible when there is a lot of lines. --- htdocs/comm/action/peruser.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index b6c3054f3a8..ddda7333947 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -659,10 +659,12 @@ while ($obj = $db->fetch_object($resql)) $todayarray=dol_getdate($now,'fast'); $sav = $tmpday; $showheader = true; +$var = false; foreach ($usernames as $username) { + $var = ! $var; echo ""; - echo '' . $username->getNomUrl(1). ''; + echo '' . $username->getNomUrl(1). ''; $tmpday = $sav; // Lopp on each day of week @@ -688,7 +690,7 @@ foreach ($usernames as $username) if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1; if ($today) $style='cal_today_peruser'; - show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype); + show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var); $i++; } @@ -785,9 +787,10 @@ $db->close(); * @param int $minheight Minimum height for each event. 60px by default. * @param boolean $showheader Show header * @param array $colorsbytype Array with colors by type + * @param string $var true or false for alternat style on tr/td * @return void */ -function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array()) +function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false) { global $db; global $user, $conf, $langs, $hookmanager, $action; @@ -989,8 +992,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } - if ($h == $begin_h) echo ''; - else echo ''; + if ($h == $begin_h) echo ''; + else echo ''; if (count($cases1[$h]) == 1) // 1 seul evenement { $ids=array_keys($cases1[$h]); From c8fe538de202bf53552d335cde51fc8964ab5da3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Nov 2014 14:36:16 +0100 Subject: [PATCH 4/6] Fix: Filter were lost --- htdocs/comm/action/peruser.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index ddda7333947..dcebefbcbb7 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -201,6 +201,7 @@ if ($filter) $param.="&filter=".$filter; if ($filtera) $param.="&filtera=".$filtera; if ($filtert) $param.="&filtert=".$filtert; if ($filterd) $param.="&filterd=".$filterd; +if ($usergroup) $param.="&usergroup=".$usergroup; if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; @@ -242,6 +243,20 @@ $nav.="   ('; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; +$nav.=''; + $nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); $nav.=' '; $nav.=''; From 1b24356e0f9b7b4cfd8a19464096c788d2cc2560 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Nov 2014 17:13:08 +0100 Subject: [PATCH 5/6] ssl option is set to CURL_SSLVERSION_TLSv1. Some site disabled ssl v1 to 3 (ex: paypal). --- htdocs/paypal/lib/paypal.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 02a16c68b1f..7b161ac30be 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -683,7 +683,8 @@ function hash_call($methodName,$nvpStr) exit;*/ curl_setopt($ch, CURLOPT_URL, $API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); - curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3 + //curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3 + curl_setopt($ch, CURLOPT_SSLVERSION, 1); // Force TLSv1 //turning off the server and peer verification(TrustManager Concept). curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); From 8b0a9d78bb946a7373d3d27b76f8cef79e0abec5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Nov 2014 19:03:02 +0100 Subject: [PATCH 6/6] Fix: CRLF --- htdocs/core/actions_sendmails.inc.php | 8 ++++---- htdocs/fichinter/card.php | 8 ++++---- htdocs/install/upgrade.php | 14 +++++++------- htdocs/install/upgrade2.php | 28 +++++++++++++-------------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 51744775d9f..40e177404f9 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -146,10 +146,10 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO if ($message) { $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); } } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 77c7e17ffb5..4ffc31c9cab 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -748,10 +748,10 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; if ($message) { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); } $actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); } diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 396c9f96b01..e93b27ab6e9 100755 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -75,21 +75,21 @@ if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initial * View */ -if (! $versionfrom && ! $versionto) -{ +if (! $versionfrom && ! $versionto) +{ print 'Error: Parameter versionfrom or versionto missing.'."\n"; print 'Upgrade must be ran from cmmand line with parameters or called from page install/index.php (like a first install) instead of page install/upgrade.php'."\n"; // Test if batch mode $sapi_type = php_sapi_name(); - $script_file = basename(__FILE__); + $script_file = basename(__FILE__); $path=dirname(__FILE__).'/'; if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n"; - } - exit; -} - + } + exit; +} + pHeader('',"upgrade2",GETPOST('action'),'versionfrom='.$versionfrom.'&versionto='.$versionto); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 3a02a78f9e8..09f0d507a39 100755 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -83,20 +83,20 @@ if (! is_object($conf)) dolibarr_install_syslog("upgrade2: conf file not initial * View */ -if (! $versionfrom && ! $versionto) -{ - print 'Error: Parameter versionfrom or versionto missing.'."\n"; - print 'Upgrade must be ran from cmmand line with parameters or called from page install/index.php (like a first install) instead of page install/upgrade.php'."\n"; - // Test if batch mode - $sapi_type = php_sapi_name(); - $script_file = basename(__FILE__); - $path=dirname(__FILE__).'/'; - if (substr($sapi_type, 0, 3) == 'cli') - { - print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n"; - } - exit; -} +if (! $versionfrom && ! $versionto) +{ + print 'Error: Parameter versionfrom or versionto missing.'."\n"; + print 'Upgrade must be ran from cmmand line with parameters or called from page install/index.php (like a first install) instead of page install/upgrade.php'."\n"; + // Test if batch mode + $sapi_type = php_sapi_name(); + $script_file = basename(__FILE__); + $path=dirname(__FILE__).'/'; + if (substr($sapi_type, 0, 3) == 'cli') + { + print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n"; + } + exit; +} pHeader('','etape5',GETPOST("action")?GETPOST("action"):'upgrade','versionfrom='.$versionfrom.'&versionto='.$versionto);