From c6ded35d4b5415d99c7f82666a35df86f28082bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 28 Dec 2013 23:13:32 +0100 Subject: [PATCH 01/41] Fixed quality control checks for PR #1357 --- htdocs/core/lib/payments.lib.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index dc40127818e..7aeffdba013 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -18,7 +18,14 @@ * or see http://www.gnu.org/ */ -function payment_prepare_head($object) { +/** + * Returns an array with the tabs for the "Payment" section + * It loads tabs from modules looking for the entity payment + * + * @param Paiement $object + * @return array + */ +function payment_prepare_head(Paiement $object) { global $langs, $conf; @@ -46,6 +53,13 @@ function payment_prepare_head($object) { return $head; } +/** + * Returns an array with the tabs for the "Supplier payment" section + * It loads tabs from modules looking for the entity payment_supplier + * + * @param Paiement $object + * @return array + */ function payment_supplier_prepare_head($object) { global $langs, $conf; From 9b90e93fe5cc9ea98811e99d8883b6f95415be7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 28 Dec 2013 23:24:24 +0100 Subject: [PATCH 02/41] Forgot typehinting for function payment_supplier_prepare_head --- htdocs/core/lib/payments.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 7aeffdba013..2a26cea6efd 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -60,7 +60,7 @@ function payment_prepare_head(Paiement $object) { * @param Paiement $object * @return array */ -function payment_supplier_prepare_head($object) { +function payment_supplier_prepare_head(Paiement $object) { global $langs, $conf; From 808abb6b4ee4fcd0306850c53880b8da3cb1c137 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Dec 2013 16:03:58 +0100 Subject: [PATCH 03/41] Restore correct date --- build/debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/debian/changelog b/build/debian/changelog index 170b8945ffe..f3bf1b1d126 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -17,4 +17,4 @@ dolibarr (3.4.0) unstable; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. - -- Laurent Destailleur (eldy) Mon, 30 Dec 2013 12:00:00 +0100 + -- Laurent Destailleur (eldy) Mon, 22 Apr 2013 12:00:00 +0100 From 5fd47b34b0544fd38ac2578df561a55853df2174 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jan 2014 18:30:32 +0100 Subject: [PATCH 04/41] Fix: Bad link for download file into documents page of supplier invoices --- htdocs/core/class/html.formfile.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 189cec49f80..0559c7b56da 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -762,7 +762,10 @@ class FormFile { // Define relative path used to store the file if (empty($relativepath)) + { $relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/'; + if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2).$relativepath; + } $var=!$var; print ''; From 165f9617e9c5d24809692edd3cc0270d80157975 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jan 2014 10:55:11 +0100 Subject: [PATCH 05/41] Fix: No hard coded data --- build/makepack-dolibarrmodule.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/makepack-dolibarrmodule.pl b/build/makepack-dolibarrmodule.pl index 0babf13e0b1..28220e9df95 100755 --- a/build/makepack-dolibarrmodule.pl +++ b/build/makepack-dolibarrmodule.pl @@ -37,9 +37,9 @@ if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS=' elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; } elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; } if (! $OS) { - print "makepack-dolbarrmodule.pl was not able to detect your OS.\n"; + print "$PROG.$Extension was not able to detect your OS.\n"; print "Can't continue.\n"; - print "makepack-dolibarrmodule.pl aborted.\n"; + print "$PROG.$Extension aborted.\n"; sleep 2; exit 1; } @@ -59,7 +59,7 @@ if ($OS =~ /windows/) { if (! $TEMP || ! -d $TEMP) { print "Error: A temporary directory can not be find.\n"; print "Check that TEMP or TMP environment variable is set correctly.\n"; - print "makepack-dolibarrmodule.pl aborted.\n"; + print "$PROG.$Extension aborted.\n"; sleep 2; exit 2; } From 44ab26698e0442d980e4b14c0d91944363c433d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 2 Jan 2014 16:41:23 +0100 Subject: [PATCH 06/41] Fixed (again) quality code control checks --- htdocs/core/lib/payments.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 2a26cea6efd..f4d3b80ee8c 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -22,8 +22,8 @@ * Returns an array with the tabs for the "Payment" section * It loads tabs from modules looking for the entity payment * - * @param Paiement $object - * @return array + * @param Paiement $object Current payment object + * @return array Tabs for the payment section */ function payment_prepare_head(Paiement $object) { @@ -57,8 +57,8 @@ function payment_prepare_head(Paiement $object) { * Returns an array with the tabs for the "Supplier payment" section * It loads tabs from modules looking for the entity payment_supplier * - * @param Paiement $object - * @return array + * @param Paiement $object Current payment object + * @return array Tabs for the payment section */ function payment_supplier_prepare_head(Paiement $object) { From 0b3dd9d7bb6e43e3296c71509c2b5364889c7ac9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jan 2014 20:49:36 +0100 Subject: [PATCH 07/41] Fix: Call Image on this instead of pdf. Fix: Missing parameter for photo. Conflicts: htdocs/core/modules/member/doc/pdf_standard.class.php htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php --- .../modules/member/doc/pdf_standard.class.php | 8 ++++---- .../doc/pdf_standardlabel.class.php | 17 ++++++++-------- .../modules/printsheet/modules_labels.php | 20 +++++++++---------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 0b0214196d0..94580ff1fad 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -195,8 +195,8 @@ class pdf_standard // Center if ($textright=='') // Only a left part { - if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); else { $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); @@ -230,8 +230,8 @@ class pdf_standard } else // Only a right part { - if ($textright == '%LOGO%' && $logo) $this->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); - else if ($textright == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); else { $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 5ee5c2bd72b..e4c1cb81adf 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -120,9 +120,10 @@ class pdf_standardlabel * @param string $footer Footer * @param Translate $outputlangs Output langs * @param string $textright Text right + * @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text) * @return void */ - function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='') + function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='') { global $mysoc,$conf,$langs; @@ -148,8 +149,6 @@ class pdf_standardlabel $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; } } - // Define photo - $photo=''; // Define background image $backgroundimage=''; @@ -184,8 +183,8 @@ class pdf_standardlabel // Middle if ($textright=='') // Only a left part { - if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); else { $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); @@ -218,8 +217,8 @@ class pdf_standardlabel } else // Only a right part { - if ($textright == '%LOGO%' && $logo) $this->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); - else if ($textright == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); else { $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); @@ -394,7 +393,7 @@ class pdf_standardlabel /** * Function to build PDF on disk, then output on HTTP strem. * - * @param array $arrayofmembers Array of members informations + * @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) * @param Translate $outputlangs Lang object for output language * @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $outputdir Output directory @@ -471,7 +470,7 @@ class pdf_standardlabel foreach($arrayofmembers as $val) { // imprime le texte specifique sur la carte - $this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['id'],$val['photo']); + $this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['photo']); } //$pdf->SetXY(10, 295); diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index 63934cad404..4c4ebad6c3a 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -63,25 +63,25 @@ class ModelePDFLabels * Create a document onto disk accordign to template module * * @param DoliDB $db Database handler - * @param array $arrayofmembers Array of members + * @param array $arrayofrecords Array of records * @param string $modele Force le modele a utiliser ('' to not force) * @param Translate $outputlangs Objet lang a utiliser pour traduction * @param string $outputdir Output directory * @return int <0 if KO, >0 if OK */ -function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir='') +function members_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='') { global $conf,$langs; $langs->load("members"); $error=0; - + // Increase limit for PDF build $err=error_reporting(); error_reporting(0); @set_time_limit(120); error_reporting($err); - + $code=''; $srctemplatepath=''; @@ -99,7 +99,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $ } else $code=$modele; $modele='standardlabel'; - + // If selected modele is a filename template (then $modele="modelname:filename") $tmp=explode(':',$modele,2); if (! empty($tmp[1])) @@ -108,7 +108,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $ $srctemplatepath=$tmp[1]; } else $srctemplatepath=$code; - + // Search template files $file=''; $classname=''; $filefound=0; $dirmodels=array('/'); @@ -118,7 +118,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $ foreach(array('doc','pdf') as $prefix) { $file = $prefix."_".$modele.".class.php"; - + // On verifie l'emplacement du modele $file=dol_buildpath($reldir."core/modules/printsheet/doc/".$file,0); if (file_exists($file)) @@ -130,18 +130,18 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $ } if ($filefound) break; } - + // Charge le modele if ($filefound) { require_once $file; $obj = new $classname($db); - + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($arrayofmembers, $outputlangs, $srctemplatepath, $outputdir) > 0) + if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir) > 0) { $outputlangs->charset_output=$sav_charset_output; return 1; From 76f890b72f49432411b7b56bfff6a5f674608534 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jan 2014 20:49:36 +0100 Subject: [PATCH 08/41] Fix: Call Image on this instead of pdf. Fix: Missing parameter for photo. Conflicts: htdocs/core/modules/member/doc/pdf_standard.class.php htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php --- .../modules/member/doc/pdf_standard.class.php | 8 ++++---- .../doc/pdf_standardlabel.class.php | 17 ++++++++-------- .../modules/printsheet/modules_labels.php | 20 +++++++++---------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 8789c246307..e85e4a7d767 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -195,8 +195,8 @@ class pdf_standard // Center if ($textright=='') // Only a left part { - if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); else { $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); @@ -230,8 +230,8 @@ class pdf_standard } else // Only a right part { - if ($textright == '%LOGO%' && $logo) $this->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); - else if ($textright == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); else { $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 5ee5c2bd72b..e4c1cb81adf 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -120,9 +120,10 @@ class pdf_standardlabel * @param string $footer Footer * @param Translate $outputlangs Output langs * @param string $textright Text right + * @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text) * @return void */ - function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='') + function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='') { global $mysoc,$conf,$langs; @@ -148,8 +149,6 @@ class pdf_standardlabel $logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo; } } - // Define photo - $photo=''; // Define background image $backgroundimage=''; @@ -184,8 +183,8 @@ class pdf_standardlabel // Middle if ($textright=='') // Only a left part { - if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); else { $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); @@ -218,8 +217,8 @@ class pdf_standardlabel } else // Only a right part { - if ($textright == '%LOGO%' && $logo) $this->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); - else if ($textright == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); else { $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); @@ -394,7 +393,7 @@ class pdf_standardlabel /** * Function to build PDF on disk, then output on HTTP strem. * - * @param array $arrayofmembers Array of members informations + * @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) * @param Translate $outputlangs Lang object for output language * @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $outputdir Output directory @@ -471,7 +470,7 @@ class pdf_standardlabel foreach($arrayofmembers as $val) { // imprime le texte specifique sur la carte - $this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['id'],$val['photo']); + $this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['photo']); } //$pdf->SetXY(10, 295); diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index 63934cad404..4c4ebad6c3a 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -63,25 +63,25 @@ class ModelePDFLabels * Create a document onto disk accordign to template module * * @param DoliDB $db Database handler - * @param array $arrayofmembers Array of members + * @param array $arrayofrecords Array of records * @param string $modele Force le modele a utiliser ('' to not force) * @param Translate $outputlangs Objet lang a utiliser pour traduction * @param string $outputdir Output directory * @return int <0 if KO, >0 if OK */ -function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir='') +function members_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='') { global $conf,$langs; $langs->load("members"); $error=0; - + // Increase limit for PDF build $err=error_reporting(); error_reporting(0); @set_time_limit(120); error_reporting($err); - + $code=''; $srctemplatepath=''; @@ -99,7 +99,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $ } else $code=$modele; $modele='standardlabel'; - + // If selected modele is a filename template (then $modele="modelname:filename") $tmp=explode(':',$modele,2); if (! empty($tmp[1])) @@ -108,7 +108,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $ $srctemplatepath=$tmp[1]; } else $srctemplatepath=$code; - + // Search template files $file=''; $classname=''; $filefound=0; $dirmodels=array('/'); @@ -118,7 +118,7 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $ foreach(array('doc','pdf') as $prefix) { $file = $prefix."_".$modele.".class.php"; - + // On verifie l'emplacement du modele $file=dol_buildpath($reldir."core/modules/printsheet/doc/".$file,0); if (file_exists($file)) @@ -130,18 +130,18 @@ function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $ } if ($filefound) break; } - + // Charge le modele if ($filefound) { require_once $file; $obj = new $classname($db); - + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; - if ($obj->write_file($arrayofmembers, $outputlangs, $srctemplatepath, $outputdir) > 0) + if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir) > 0) { $outputlangs->charset_output=$sav_charset_output; return 1; From 4a4084e0962cac4d4178949785075951433ecfc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jan 2014 00:13:16 +0100 Subject: [PATCH 09/41] Fix: doxygen --- .../core/modules/printsheet/doc/pdf_standardlabel.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index e4c1cb81adf..f4fd38b52ad 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -399,7 +399,7 @@ class pdf_standardlabel * @param string $outputdir Output directory * @return int 1=OK, 0=KO */ - function write_file($arrayofmembers,$outputlangs,$srctemplatepath,$outputdir='') + function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='') { global $user,$conf,$langs,$mysoc,$_Avery_Labels; @@ -467,7 +467,7 @@ class pdf_standardlabel // Add each record - foreach($arrayofmembers as $val) + foreach($arrayofrecords as $val) { // imprime le texte specifique sur la carte $this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['photo']); From 68893b205c32e170ad77a052e74cd4a7427e81dd Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 3 Jan 2014 09:58:01 +0100 Subject: [PATCH 10/41] New standard VAT rate for France on january, 1st, 2014 --- htdocs/install/mysql/data/llx_c_tva.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index d96bc2d3f36..253f8cedbe8 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -88,13 +88,13 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (80 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (802,80, '0','0','VAT Rate 0',1); -- FRANCE (id country=1) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1,'19.6','0','VAT standard rate (France hors DOM-TOM)',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 11, 1,'20','0','VAT standard rate (France hors DOM-TOM)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 12, 1, '8.5','0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 13, 1, '8.5','1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 14, 1, '5.5','0','VAT reduced rate (France hors DOM-TOM)',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 15, 1, '0','0','VAT Rate 0 ou non applicable',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 16, 1, '2.1','0','VAT super-reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 17, 1, '7','0','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 17, 1, '10','0','VAT reduced rate',1); -- GERMANY (id country=5) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 51, 5, '19.0','0','allgemeine Ust.',1); From d992d5cb228c0976ba3c9f5283fb2f81115172bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jan 2014 18:16:21 +0100 Subject: [PATCH 11/41] Fix: Bad SQL request when using filter on category. --- htdocs/compta/stats/cabyprodserv.php | 55 ++++++++++++++------------ htdocs/compta/stats/casoc.php | 58 +++++++++++++++++++--------- 2 files changed, 70 insertions(+), 43 deletions(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index ebfe0c4834b..f3e5f746e6b 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2013 Antoine Iauch + * Copyright (C) 2013 Laurent Destailleur * * 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 @@ -171,23 +172,21 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl // SQL request $catotal=0; -if ($modecompta == 'CREANCES-DETTES') { +if ($modecompta == 'CREANCES-DETTES') +{ $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label,"; - $sql.= " sum(DISTINCT l.total_ht) as amount, sum(DISTINCT l.total_ttc) as amount_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - $sql.= " JOIN ".MAIN_DB_PREFIX."facturedet as l"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON l.fk_facture = f.rowid"; - if ($selected_cat === -2) { - $sql.=" LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; - } - if ($selected_cat && $selected_cat !== -2) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = " . $selected_cat; - if ($subcat) { - $sql.=" OR c.fk_parent = " . $selected_cat; + $sql.= " sum(l.total_ht) as amount, sum(l.total_ttc) as amount_ttc"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p"; + if ($selected_cat === -2) // Without any category + { + $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; + } + else if ($selected_cat) // Into a specific category + { + $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; } - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_categorie = c.rowid"; - } $sql.= " WHERE l.fk_product = p.rowid"; + $sql.= " AND l.fk_facture = f.rowid"; $sql.= " AND f.fk_statut in (1,2)"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql.= " AND f.type IN (0,1,2)"; @@ -197,16 +196,21 @@ if ($modecompta == 'CREANCES-DETTES') { if ($date_start && $date_end) { $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - if ($selected_cat === -2) { - $sql.=" AND cp.fk_product is null"; - } - if ($selected_cat && $selected_cat !== -2) { - $sql.= " AND cp.fk_product = p.rowid"; - } + if ($selected_cat === -2) // Without any category + { + $sql.=" AND cp.fk_product is null"; + } + else if ($selected_cat) { // Into a specific category + $sql.= " AND (c.rowid = ".$selected_cat; + if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; + $sql.= ")"; + $sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; + } $sql.= " AND f.entity = ".$conf->entity; - $sql.= " GROUP BY p.rowid "; - $sql.= "ORDER BY p.ref "; + $sql.= " GROUP BY p.rowid"; + $sql.= " ORDER BY p.ref"; + dol_syslog("cabyprodserv sql=".$sql); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -381,7 +385,10 @@ if ($modecompta == 'CREANCES-DETTES') { print ''; } else { // $modecompta != 'CREANCES-DETTES' - // TODO: better message + // TODO: better message, for example: + // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an + // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ? + // Because there is no way to know this, this report is not relevant. print '
' . $langs->trans("WarningNotRelevant") . '
'; } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 63ca148e5c3..bbf03e0865c 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2013 Antoine Iauch @@ -177,18 +177,15 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl $catotal=0; if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name,"; - $sql.= " sum(DISTINCT f.total) as amount, sum(DISTINCT f.total_ttc) as amount_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= " JOIN ".MAIN_DB_PREFIX."facture as f"; - if ($selected_cat === -2) { + $sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; + if ($selected_cat === -2) // Without any category + { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; } - if ($selected_cat && $selected_cat !== -2) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = ".$selected_cat; - if ($subcat) { - $sql.=" OR c.fk_parent = " . $selected_cat; - } - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON cs.fk_categorie = c.rowid"; + else if ($selected_cat) // Into a specific category + { + $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; } $sql.= " WHERE f.fk_statut in (1,2)"; if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -200,34 +197,57 @@ if ($modecompta == 'CREANCES-DETTES') { if ($date_start && $date_end) { $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - if ($selected_cat === -2) { + if ($selected_cat === -2) // Without any category + { $sql.=" AND cs.fk_societe is null"; } - if ($selected_cat && $selected_cat !== -2) { - $sql.= " AND cs.fk_societe = s.rowid"; + else if ($selected_cat) { // Into a specific category + $sql.= " AND (c.rowid = ".$selected_cat; + if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; + $sql.= ")"; + $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_societe = s.rowid"; } - } else { +} else { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) */ $sql = "SELECT s.rowid as socid, s.nom as name, sum(pf.amount) as amount_ttc"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."facture as f"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; - $sql .= " WHERE p.rowid = pf.fk_paiement"; + $sql.= ", ".MAIN_DB_PREFIX."societe as s"; + if ($selected_cat === -2) // Without any category + { + $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; + } + else if ($selected_cat) // Into a specific category + { + $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; + } + $sql.= " WHERE p.rowid = pf.fk_paiement"; $sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND f.fk_soc = s.rowid"; if ($date_start && $date_end) { $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; } + if ($selected_cat === -2) // Without any category + { + $sql.=" AND cs.fk_societe is null"; + } + else if ($selected_cat) { // Into a specific category + $sql.= " AND (c.rowid = ".$selected_cat; + if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; + $sql.= ")"; + $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_societe = s.rowid"; + } } $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY s.rowid, s.nom"; $sql.= " ORDER BY s.rowid"; +dol_syslog("casoc sql=".$sql); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); @@ -248,7 +268,7 @@ if ($result) { // On ajoute les paiements anciennes version, non lies par paiement_facture if ($modecompta != 'CREANCES-DETTES') { - $sql = "SELECT '0' as socid, 'Autres' as name, sum(DISTINCT p.amount) as amount_ttc"; + $sql = "SELECT '0' as socid, 'Autres' as name, sum(p.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; From 8d664973841fde293011104f174f33a7025e351c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jan 2014 18:23:07 +0100 Subject: [PATCH 12/41] Update doc for 3.4.2 --- ChangeLog | 92 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index 151c2e47c7d..7c1d434ea37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,55 +4,59 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.4.2 compared to 3.4.1 ***** -Fix: field's problem into company's page (RIB) -Fix: Document cerfa doesn't contained firstname & lastname from donator +Fix: field's problem into company's page (RIB). +Fix: Document cerfa doesn't contained firstname & lastname from donator. Fix: Bad rounding on margin calculations and display. Fix: Option drop table into backup was broken. -Fix: [ bug #1105 ] Searching Boxes other search option -Fix: wrong buy price update -Fix: [ bug #1142 ] Set paiement on invoice (PGSql) -Fix: [ bug #1145 ] Agenda button list type do not display -Fix: [ bug #1148 ] Product consomation : supplier order bad status -Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists -Fix: [ bug #1174 ] Product translated description not good into PDF -Fix: [ bug #1163 ] SQL Error when searching for supplier orders -Fix: [ bug #1162 ] Translaction for morning and afternoon -Fix: [ bug #1161 ] Search on product label +Fix: [ bug #1105 ] Searching Boxes other search option. +Fix: wrong buy price update. +Fix: [ bug #1142 ] Set paiement on invoice (PGSql). +Fix: [ bug #1145 ] Agenda button list type do not display. +Fix: [ bug #1148 ] Product consomation : supplier order bad status. +Fix: [ bug #1159 ] Commercial search "other" give p.note do not exists. +Fix: [ bug #1174 ] Product translated description not good into PDF. +Fix: [ bug #1163 ] SQL Error when searching for supplier orders. +Fix: [ bug #1162 ] Translaction for morning and afternoon. +Fix: [ bug #1161 ] Search on product label. Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed payment mode. -Fix: [ bug #1171 ] Documents lost in interventions after validating -Fix: fix unsubscribe URL into mailing when sending manually (not by script) -Fix: [ bug #1182 ] ODT company_country tag is htmlencoded -Fix: [ bug #1196 ] Product barcode search does not expect 13th digit on EAN13 type -Fix: [ bug #1202 ] Wrong amount in deposit % invoice from proposal +Fix: [ bug #1171 ] Documents lost in interventions after validating. +Fix: fix unsubscribe URL into mailing when sending manually (not by script). +Fix: [ bug #1182 ] ODT company_country tag is htmlencoded. +Fix: [ bug #1196 ] Product barcode search does not expect 13th digit on EAN13 type. +Fix: [ bug #1202 ] Wrong amount in deposit % invoice from proposal. +Fix: Removed analytics tags into doc page. +Fix: Call Image on this instead of pdf. +Fix: Missing parameter for photo. +Fix: Bad SQL request for turnover report. ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** -Fix: Display buying price on line edit when no supplier price is defined -Fix: Retrieving of margin info when invoice created automatically from order -Fix: Reordering supplier products in list by supplier or supplier ref was crashing -Fix: [ bug #1029 ] Tulip numbering mask -Fix: Supplier invoice and supplier order are not displayed into object link into agenda event card -Fix: [ bug #1033 ] SUPPLIER REF disappeared -Fix: update extrafield do not display immediatly after update -Fix: Fix bug with canvas thirdparty -Fix: [ bug #1037 ] Consumption> Supplier invoices related -Fix: User group name do not display in card (view or edit mode) -Fix: Link "Show all supplier invoice" on suplier card not working -Fix: [ bug #1039 ] Pre-defined invoices conversion -Fix: If only service module is activated, it's impossible to delete service -Fix: [ bug #1043 ] Bad interventions ref numbering -Fix: Mailing module : if an email is already in destinaires list all other email from selector was not inserted -Fix: Localtaxes balance not showing -Fix: Intervention box links to contracts id -Fix: Compatiblity with multicompany module -Fix: Edit propal line was losing product supplier price id -Fix: Delete linked element to supplier invoice when deleted -Fix: [ bug #1061 ] Bad info shipped products -Fix: [ bug #1062 ] Documents lost in propals and contracts validating -Fix: Supplier price displayed on document lines and margin infos didnt take discount -Fix: sorting on qty did not work in supplier product list -Fix: there was no escaping on filter fields in supplier product list -Fix: bugs on margin reports and better margin calculation on credit notes -Qual: Add travis-ci integration +Fix: Display buying price on line edit when no supplier price is defined. +Fix: Retrieving of margin info when invoice created automatically from order. +Fix: Reordering supplier products in list by supplier or supplier ref was crashing. +Fix: [ bug #1029 ] Tulip numbering mask. +Fix: Supplier invoice and supplier order are not displayed into object link into agenda event card. +Fix: [ bug #1033 ] SUPPLIER REF disappeared. +Fix: update extrafield do not display immediatly after update. +Fix: Fix bug with canvas thirdparty. +Fix: [ bug #1037 ] Consumption> Supplier invoices related. +Fix: User group name do not display in card (view or edit mode). +Fix: Link "Show all supplier invoice" on suplier card not working. +Fix: [ bug #1039 ] Pre-defined invoices conversion. +Fix: If only service module is activated, it's impossible to delete service. +Fix: [ bug #1043 ] Bad interventions ref numbering. +Fix: Mailing module : if an email is already in destinaires list all other email from selector was not inserted. +Fix: Localtaxes balance not showing. +Fix: Intervention box links to contracts id. +Fix: Compatiblity with multicompany module. +Fix: Edit propal line was losing product supplier price id. +Fix: Delete linked element to supplier invoice when deleted. +Fix: [ bug #1061 ] Bad info shipped products. +Fix: [ bug #1062 ] Documents lost in propals and contracts validating. +Fix: Supplier price displayed on document lines and margin infos didnt take discount. +Fix: sorting on qty did not work in supplier product list. +Fix: there was no escaping on filter fields in supplier product list. +Fix: bugs on margin reports and better margin calculation on credit notes. +Qual: Add travis-ci integration. ***** ChangeLog for 3.4 compared to 3.3.* ***** For users: From f6cda9deb6047db67c12a2cbb621e31fefa98d3d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jan 2014 12:26:31 +0100 Subject: [PATCH 13/41] Fix: The scale was hardcoded. Comment in english --- .../modules/barcode/phpbarcode.modules.php | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/barcode/phpbarcode.modules.php b/htdocs/core/modules/barcode/phpbarcode.modules.php index f5c8d596c70..2d29405ed9e 100644 --- a/htdocs/core/modules/barcode/phpbarcode.modules.php +++ b/htdocs/core/modules/barcode/phpbarcode.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -20,15 +20,15 @@ /** * \file htdocs/core/modules/barcode/phpbarcode.modules.php * \ingroup barcode - * \brief Fichier contenant la classe du modele de generation code barre phpbarcode + * \brief File with class to generate barcode images using php barcode generator */ require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // This is to include def like $genbarcode_loc and $font_loc -/** \class modPhpbarcode - * \brief Classe du modele de numerotation de generation code barre phpbarcode +/** + * Class to generate barcode images using php barcode generator */ class modPhpbarcode extends ModeleBarCode { @@ -77,7 +77,7 @@ class modPhpbarcode extends ModeleBarCode /** - * Return true if encodinf is supported + * Return true if encoding is supported * * @param string $encoding Encoding norm * @return int >0 if supported, 0 if not @@ -108,9 +108,10 @@ class modPhpbarcode extends ModeleBarCode * @param string $code Value to encode * @param string $encoding Mode of encoding * @param string $readable Code can be read + * @param string $scale Scale * @return int <0 if KO, >0 if OK */ - function buildBarCode($code,$encoding,$readable='Y') + function buildBarCode($code,$encoding,$readable='Y',$scale=1) { global $_GET,$_SERVER; global $conf; @@ -121,7 +122,7 @@ class modPhpbarcode extends ModeleBarCode if ($encoding == 'EAN8' || $encoding == 'EAN13') $encoding = 'EAN'; if ($encoding == 'C39' || $encoding == 'C128') $encoding = substr($encoding,1); - $scale=1; $mode='png'; + $mode='png'; $_GET["code"]=$code; $_GET["encoding"]=$encoding; @@ -147,9 +148,10 @@ class modPhpbarcode extends ModeleBarCode * @param string $code Value to encode * @param string $encoding Mode of encoding * @param string $readable Code can be read + * @param string $scale Scale * @return int <0 if KO, >0 if OK */ - function writeBarCode($code,$encoding,$readable='Y') + function writeBarCode($code,$encoding,$readable='Y',$scale=1) { global $conf,$filebarcode; @@ -159,7 +161,7 @@ class modPhpbarcode extends ModeleBarCode $filebarcode=$file; // global var to be used in barcode_outimage called by barcode_print in buildBarCode - $result=$this->buildBarCode($code,$encoding,$readable); + $result=$this->buildBarCode($code,$encoding,$readable,$scale); return $result; } From ee1e7471ff34bc4b10287be3420bd9c83bb11840 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jan 2014 16:17:47 +0100 Subject: [PATCH 14/41] Fix: A lot of bug into generation of sticker pages or address pages form members module: - Position of element was wrong for non A4 pages. - Removed bugged definition of 5164 sticker template. - Solve problem of image proportions. - Margin of right was wrong. Conflicts: htdocs/core/modules/member/doc/pdf_standard.class.php htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php --- htdocs/core/lib/format_cards.lib.php | 4 +- .../modules/member/doc/pdf_standard.class.php | 66 ++++++++++------ .../doc/pdf_standardlabel.class.php | 79 ++++++++++++------- htdocs/langs/en_US/products.lang | 12 ++- htdocs/langs/fr_FR/products.lang | 9 +++ 5 files changed, 117 insertions(+), 53 deletions(-) diff --git a/htdocs/core/lib/format_cards.lib.php b/htdocs/core/lib/format_cards.lib.php index 13708771e30..5f18cb1a976 100644 --- a/htdocs/core/lib/format_cards.lib.php +++ b/htdocs/core/lib/format_cards.lib.php @@ -77,7 +77,7 @@ $_Avery_Labels = array ( 'width'=>101.6, 'height'=>50.8, 'font-size'=>8), - '5164'=>array('name'=>'5164 (Letter)', + /* Bugged '5164'=>array('name'=>'5164 (Letter)', 'paper-size'=>'letter', 'metric'=>'in', 'marginLeft'=>0.148, @@ -88,7 +88,7 @@ $_Avery_Labels = array ( 'SpaceY'=>0, 'width'=>4.0, 'height'=>3.33, - 'font-size'=>12), + 'font-size'=>12), */ '8600'=>array('name'=>'8600 (Letter)', 'paper-size'=>'letter', 'metric'=>'mm', diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 94580ff1fad..00aba591add 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -51,6 +51,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; @@ -122,12 +123,16 @@ class pdf_standard * @param Translate $outputlangs Output langs * @param string $textright Text right * @param int $idmember Id member - * @param string $photo Photo member + * @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text) * @return void */ function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$idmember=0,$photo='') { global $mysoc,$conf,$langs; + global $forceimgscalewidth,$forceimgscaleheight; + + $imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker) + $imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker) // We are in a new page, then we must add a page if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) { @@ -192,50 +197,67 @@ class pdf_standard $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($header),0,1,'C'); } + + $xleft=2; $ytop=2+(empty($header)?0:1+$this->_Line_Height); + $maxwidthtouse=round(($this->_Width - 2*$xleft)*$imgscalewidth); $maxheighttouse=round(($this->_Height - 2*$ytop)*$imgscaleheight); + $defaultratio=($maxwidthtouse/$maxheighttouse); + + // Define widthtouse and heighttouse + $widthtouse=$maxwidthtouse; $heighttouse=0; // old value for image + $tmp=dol_getImageSize($photo, false); + if ($tmp['height']) + { + $imgratio=$tmp['width']/$tmp['height']; + if ($imgratio >= $defaultratio) { $widthtouse = $maxwidthtouse; $heighttouse = round($widthtouse / $imgratio); } + else { $heightouse = $maxheighttouse; $widthtouse = round($heightouse * $imgratio); } + } + //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit; + // Center if ($textright=='') // Only a left part { - if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + // Output left area + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); else { - $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); } } else if ($textleft!='' && $textright!='') // { if ($textleft == '%LOGO%' || $textleft == '%PHOTO%') { - if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - $pdf->SetXY($_PosX+21, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + $pdf->SetXY($_PosX+$xleft+$widthtouse+1, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$xleft-$xleft-$widthtouse-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } else if ($textright == '%LOGO%' || $textright == '%PHOTO%') { - if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20); - else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20); - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$widthtouse-$xleft-$xleft-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); } - else + else // text on halft left and text on half right { - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell(round($this->_Width/2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); - $pdf->SetXY($_PosX+round($this->_Width/2), $_PosY+3+$this->_Line_Height); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell(round($this->_Width/2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); + $pdf->SetXY($_PosX+round($this->_Width/2), $_PosY+$ytop); $pdf->MultiCell(round($this->_Width/2)-2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } - } else // Only a right part { - if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); - else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + // Output right area + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); else { - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } } diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index f4fd38b52ad..c05f168d2a8 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -51,6 +51,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; @@ -114,20 +115,24 @@ class pdf_standardlabel /** * On imprime une etiquette * - * @param PDF &$pdf PDF - * @param string $textleft Textleft - * @param string $header Header - * @param string $footer Footer - * @param Translate $outputlangs Output langs - * @param string $textright Text right - * @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text) - * @return void + * @param PDF &$pdf PDF + * @param string $textleft Text left + * @param string $header Header + * @param string $footer Footer + * @param Translate $outputlangs Output langs + * @param string $textright Text right + * @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text) + * @return void */ function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='') { global $mysoc,$conf,$langs; + global $forceimgscalewidth,$forceimgscaleheight; - // We are in a new page, then we must add a page + $imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker) + $imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker) + + // We are in a new page, then we must add a page if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) { $pdf->AddPage(); } @@ -180,14 +185,31 @@ class pdf_standardlabel $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($header),0,1,'C'); } - // Middle + + $xleft=2; $ytop=2+(empty($header)?0:1+$this->_Line_Height); + $maxwidthtouse=round(($this->_Width - 2*$xleft)*$imgscalewidth); $maxheighttouse=round(($this->_Height - 2*$ytop)*$imgscaleheight); + $defaultratio=($maxwidthtouse/$maxheighttouse); + + // Define widthtouse and heighttouse + $widthtouse=$maxwidthtouse; $heighttouse=0; // old value for image + $tmp=dol_getImageSize($photo, false); + if ($tmp['height']) + { + $imgratio=$tmp['width']/$tmp['height']; + if ($imgratio >= $defaultratio) { $widthtouse = $maxwidthtouse; $heighttouse = round($widthtouse / $imgratio); } + else { $heightouse = $maxheighttouse; $widthtouse = round($heightouse * $imgratio); } + } + //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit; + + // Center if ($textright=='') // Only a left part { - if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + // Output left area + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); else { - $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); } } @@ -195,34 +217,35 @@ class pdf_standardlabel { if ($textleft == '%LOGO%' || $textleft == '%PHOTO%') { - if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - $pdf->SetXY($_PosX+21, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + $pdf->SetXY($_PosX+$xleft+$widthtouse+1, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$xleft-$xleft-$widthtouse-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } else if ($textright == '%LOGO%' || $textright == '%PHOTO%') { - if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20); - else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20); - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$widthtouse-$xleft-$xleft-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); } - else + else // text on halft left and text on half right { - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); $pdf->MultiCell(round($this->_Width/2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); - $pdf->SetXY($_PosX+round($this->_Width/2), $_PosY+3+$this->_Line_Height); + $pdf->SetXY($_PosX+round($this->_Width/2), $_PosY+$ytop); $pdf->MultiCell(round($this->_Width/2)-2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } } else // Only a right part { - if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); - else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + // Output right area + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); else { - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } } diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 48f6b8489e6..806c3a4d083 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -203,4 +203,14 @@ ServiceSellByQuarterHT=Services turnover quarterly VWAP Quarter1=1st. Quarter Quarter2=2nd. Quarter Quarter3=3rd. Quarter -Quarter4=4th. Quarter \ No newline at end of file +Quarter4=4th. Quarter +BarCodePrintsheet=Imprimer code barre +PageToGenerateBarCodeSheets=With this tool, you can print sheets of bar code stickers. Choose format of your sticker page, type of barcode and value of barcode, then click on button %s. +NumberOfStickers=Number of stickers to print on page +PrintsheetForOneBarCode=Print several stickers for one barcode +BuildPageToPrint=Generate page to print +FillBarCodeTypeAndValueManually=Fill barcode type and value manually +FillBarCodeTypeAndValueFromProduct=Fill barcode type and value from a product +FillBarCodeTypeAndValueFromThirdParty=Fill barcode type and value from a thirdparty +BarcodeStickersMask=xxx + \ No newline at end of file diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 942eb67897f..df987ff22d3 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -204,3 +204,12 @@ Quarter1=1er trimestre Quarter2=2eme trimestre Quarter3=3eme trimestre Quarter4=4eme trimestre +BarCodePrintsheet=Imprimer code barre +PageToGenerateBarCodeSheets=Avec cet outils, vous pouvez imprimer une planche d'étiquette de code-barres. Sélectionner votre format de planche d'étiquette, le type de code-barre et la valeur du code-barre puis cliquer sur le bouton %s. +NumberOfStickers=Nombre d'étiquettes à imprimer sur la/les planches +PrintsheetForOneBarCode=Imprimer des étiquettes d'un code barre particulier +BuildPageToPrint=Générer la page à imprimer +FillBarCodeTypeAndValueManually=Remplir le type et la valeur du code barre manuellement +FillBarCodeTypeAndValueFromProduct=Remplir le type et la valeur du code barre depuis un produit +FillBarCodeTypeAndValueFromThirdParty=Remplir le type et la valeur du code barre depuis un tiers +BarcodeStickersMask=xxx \ No newline at end of file From 2ee50769705265aa0a3539bbf5eda07b321d638c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jan 2014 18:57:57 +0100 Subject: [PATCH 15/41] Problem of key of language into auguria menu --- htdocs/core/menus/init_menu_auguria.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index eeeb699a844..6dbb9e1119d 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -70,9 +70,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/fiche.php?leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=p', 'Prospects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=c', 'Customers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=f', 'Suppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=p', 'ThirdPartyProspects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=c', 'ThirdPartyCustomers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=f', 'ThirdPartySuppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__); -- Third parties - Category customer insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', 'cat', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__); From 5a7fe6b4a7bc31285a0ef39cf396218a36fa2f9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Jan 2014 01:17:38 +0100 Subject: [PATCH 16/41] Fix: Change to make debian package ok despite removal of ckeditor package. --- htdocs/admin/modules.php | 3 ++- htdocs/core/modules/modFckeditor.class.php | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 7411c315304..72147693bd3 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -154,7 +154,8 @@ foreach ($modulesdir as $dir) $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0; if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0; - //if ($mode == 'expdev' && ($objMod->version != 'experimental' && $objMod->version != 'development')) $modulequalified=0; + // We discard modules according to property disabled + if (! empty($objMod->hidden)) $modulequalified=false; // Define array $categ with categ with at least one qualified module if ($modulequalified) diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 10bd7414722..917d15a852c 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -62,6 +62,8 @@ class modFckeditor extends DolibarrModules $this->config_page_url = array("fckeditor.php"); // Dependances + global $dolibarr_js_CKEDITOR; + $this->hidden = ($dolibarr_js_CKEDITOR == 'disabled'?1:0); // A condition to disable module (used for native debian packages) $this->depends = array(); $this->requiredby = array(); From 555a49d66ef8176e2053c5c5c0080a79857a5376 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Jan 2014 01:20:27 +0100 Subject: [PATCH 17/41] Update doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 654a5287bfe..eb58f849be4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.3.5 compared to 3.3.4 ***** +- Fix: Change to make debian package ok despite removal of ckeditor. - Fix: jcrop file to match debian rules - Fix: Add missing country UK. - Fix: Minor fix into package. From eccfa7ec21ad00687c0c7292778d4e1596660d2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Jan 2014 12:54:29 +0100 Subject: [PATCH 18/41] Fix: Wrong prerequisite on PHP version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bad4d47ffc2..a5560af54f2 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ See ChangeLog file found into package. - Several skins. - Code is highly customizable (a lot of use of modules and submodules). - Works with Mysql 4.1 or higher, or PostgreSql 8.14 or higher. -- Works with PHP 5.0 or higher. +- Works with PHP 5.2.1 or higher. - An easy to understand and maintain code (PHP with no heavy frameworks). - A trigger architecture to allow you to make Dolibarr business events run PHP code to update your own information system. - "NPR VAT Rate" (French particularity for managing VAT in DOM-TOM called "Non Perçue Récupérable"). From e09a16b427b1ee547ca9611525e5794c76b65bb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Jan 2014 13:16:18 +0100 Subject: [PATCH 19/41] Update doc --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a5560af54f2..34e515a2ccc 100644 --- a/README.md +++ b/README.md @@ -110,17 +110,18 @@ See ChangeLog file found into package. ### Miscellaneous: - Multi-user, with several permissions levels for each feature. -- Serveral menu managers (can be used by internal users, as a back-office, with a particular menu, or by external users, as a front-office, with another menu and permissions). - Very user friendly and easy to use. -- Optional WYSIWYG forms, optional Ajax forms. -- Several skins. -- Code is highly customizable (a lot of use of modules and submodules). -- Works with Mysql 4.1 or higher, or PostgreSql 8.14 or higher. -- Works with PHP 5.2.1 or higher. -- An easy to understand and maintain code (PHP with no heavy frameworks). -- A trigger architecture to allow you to make Dolibarr business events run PHP code to update your own information system. -- "NPR VAT Rate" (French particularity for managing VAT in DOM-TOM called "Non Perçue Récupérable"). - +- Highly customizable: Enable only modules you need, user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one). +- Works with PHP 5.2.1, MySql 4.1 or PostgreSQL 8.1. +- Compatible with all Cloud solutions that match MySql, PHP or PotgreSQL prerequisites. +- An easy to understand, maintain and code interfaces with your own system information (PHP with no heavy frameworks, trigger and hook architecture). +- Support countries specific features: + Spanish Tax RE and ISPF. + French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM). + Canadian double taxes (federal/province) and other countries using cumulative VAT. + Tunisian tax stamp. + Compatible with European directives (2006/112/CE ... 2010/45/UE) (http://europa.eu/legislation_summaries/taxation/l31057_en.htm) + ... ## WHAT DOLIBARR CAN'T DO YET (TODO LIST) From 36aedf618c15279c028e56a072fadbb127a1621b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Jan 2014 13:31:19 +0100 Subject: [PATCH 20/41] Fix: typo --- README.md | 61 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 34e515a2ccc..574e74da85c 100644 --- a/README.md +++ b/README.md @@ -76,36 +76,37 @@ See ChangeLog file found into package. ### Main modules/features: -- Customers, Prospects or Suppliers directory -- Products and services catalog -- Bank accounts management -- Orders management -- Commercial proposals management -- Contracts management -- Invoices management -- Payments management -- Standing orders management -- Stock management -- Shipping management +- Customers, Prospects or Suppliers directory. +- Products and services catalog. +- Bank accounts management. +- Orders management. +- Commercial proposals management. +- Contracts management. +- Invoices management. +- Payments management. +- Standing orders management. +- Stock management. +- Shipping management. - PDF or ODT generation for invoice, proposals, orders... -- Agenda with ical,vcal export for third tools integration -- EDM (Electronic Document Management) -- Foundations members management -- Employee's holidays management -- Mass Emailing -- Realize surveys -- Point of Sale +- Agenda with ical,vcal export for third tools integration. +- EDM (Electronic Document Management). +- Foundations members management. +- Employee's holidays management. +- Mass Emailing. +- Realize surveys. +- Point of Sale. ### Other modules: -- Bookmarks management -- Donations management -- Reporting -- Data export/import -- LDAP connectivity -- Third parties or products categories -- ClickToDial integration -- RSS integration +- Bookmarks management. +- Donations management. +- Reporting. +- Data export/import. +- Third parties or products categories. +- LDAP connectivity. +- ClickToDial integration. +- RSS integration. +- Can be extended with a lot of other external modules available onto DoliStore.com. ### Miscellaneous: @@ -113,7 +114,7 @@ See ChangeLog file found into package. - Very user friendly and easy to use. - Highly customizable: Enable only modules you need, user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one). - Works with PHP 5.2.1, MySql 4.1 or PostgreSQL 8.1. -- Compatible with all Cloud solutions that match MySql, PHP or PotgreSQL prerequisites. +- Compatible with all Cloud solutions that match MySql, PHP or PostgreSQL prerequisites. - An easy to understand, maintain and code interfaces with your own system information (PHP with no heavy frameworks, trigger and hook architecture). - Support countries specific features: Spanish Tax RE and ISPF. @@ -128,10 +129,10 @@ See ChangeLog file found into package. This is features that Dolibarr does not support completely yet: -- No double party accountancy (only bank management). +- No double party accountancy (only bank and treasury management). - Dolibarr manage one currency at once (mono-currency). -- Dolibarr manage one master company/foundation (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas). -- Dolibarr does not contains Payroll module. +- Dolibarr manage one master activity (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas). - Tasks on module project can't have dependencies between each other. +- Dolibarr does not contains Payroll module. - Dolibarr does not include any Webmail. - Dolibarr can't do coffee (not yet). From 67220a15caa5d6dc08430ffa127f2c7baa727a5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Jan 2014 14:13:40 +0100 Subject: [PATCH 21/41] Fix: Bad translation key --- htdocs/societe/soc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 864b42b86a9..4655c04fc8e 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1826,7 +1826,7 @@ else else { $langs->load("mails"); - print ''; + print ''; } if ($user->rights->societe->creer) From 9a6f22a86e15832bcaa3aa78c588a25d61afc4ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Jan 2014 15:46:39 +0100 Subject: [PATCH 22/41] Fix: W3C no form into table. Fix: Css style overflowwithjm has been superseded by maxwidthonsmartphone Fix: Style button disabled was not visible with jmobile Fix: Rounding corner with jmobile --- htdocs/core/lib/company.lib.php | 64 ++++++++++++++-------------- htdocs/product/composition/fiche.php | 4 +- htdocs/public/test/test_arrays.php | 2 +- htdocs/societe/consumption.php | 11 ++--- htdocs/theme/eldy/style.css.php | 23 +++++----- 5 files changed, 55 insertions(+), 49 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c08be97cac4..58ad856a62b 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -523,16 +523,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') global $bc; $form= new Form($db); - + $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $search_status = GETPOST("search_status",'int'); if ($search_status=='') $search_status=1; // always display activ customer first $search_name = GETPOST("search_name",'alpha'); - + if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="p.lastname"; - + $i=-1; $contactstatic = new Contact($db); @@ -556,18 +556,17 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ContactsForCompany") : $langs->trans("ContactsAddressesForCompany")); print_fiche_titre($title,$buttoncreate,''); - print "\n".''."\n"; - - - $param="socid=".$object->id; - if ($search_status != '') $param.='&search_status='.$search_status; - if ($search_name != '') $param.='&search_name='.urlencode($search_name); - print ''; print ''; print ''; print ''; - + + print "\n".'
'."\n"; + + $param="socid=".$object->id; + if ($search_status != '') $param.='&search_status='.$search_status; + if ($search_name != '') $param.='&search_name='.urlencode($search_name); + $colspan=8; print ''; print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); @@ -576,8 +575,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email","",$param,'',$sortfield,$sortorder); - if (! empty($conf->skype->enabled)) - { + if (! empty($conf->skype->enabled)) + { $colspan++; print ''; } @@ -594,44 +593,45 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; } print ""; - - + + print ''; print ''; - + print ''; - print ''; - print ''; - + print ''; - - print ''; - if (! empty($conf->skype->enabled)) - { + + print ''; + + print ''; + if (! empty($conf->skype->enabled)) + { $colspan++; print ''; } - print ''; - + print ""; if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; print ''; } - - + + print ''; - + print ""; - + $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut "; $sql .= ", p.civilite, p.address, p.zip, p.town"; @@ -681,12 +681,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; - if (! empty($conf->skype->enabled)) + if (! empty($conf->skype->enabled)) { print ''; - } + } print ''; @@ -761,6 +761,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') } print "\n
'.$langs->trans("Skype").' 
'; print ''; print '        '; + // Status + print ''; print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print '  '; print ''; print '
'; print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL'); print ''; print dol_print_skype($obj->skype,$obj->rowid,$object->id,'AC_SKYPE'); print ''.$contactstatic->getLibStatut(5).'
\n"; + print ''."\n"; + print "
\n"; ?> '; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index c5ca713f9f5..ca83d9e0a53 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1576,12 +1576,12 @@ else // Country print ''.$langs->trans("Country").''; - if ($object->country_code) - { - $img=picto_from_langcode($object->country_code); - if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$object->country; - } + if (! empty($object->country_code)) + { + $img=picto_from_langcode($object->country_code); + if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); + else print ($img?$img.' ':'').$object->country; + } print ''; // State From 0e3184c436c69716bcf457e44f9084992aa42db9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Jan 2014 17:17:57 +0100 Subject: [PATCH 31/41] Fix: W3C. Fix: Permission on a button. Conflicts: htdocs/core/lib/company.lib.php htdocs/societe/soc.php Fix: Some menu entry not visible. --- htdocs/comm/fiche.php | 9 ++-- htdocs/core/lib/company.lib.php | 28 ++++++---- htdocs/core/menus/standard/eldy.lib.php | 70 +++++-------------------- htdocs/societe/agenda.php | 9 +++- htdocs/societe/soc.php | 12 ++--- 5 files changed, 51 insertions(+), 77 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 29ee792c738..67e6fb1d17a 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -250,9 +250,12 @@ if ($id > 0) // Country print ''.$langs->trans("Country").''; - $img=picto_from_langcode($object->country_code); - if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$object->country; + if (! empty($object->country_code)) + { + $img=picto_from_langcode($object->country_code); + if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); + else print ($img?$img.' ':'').$object->country; + } print ''; // EMail diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 58ad856a62b..bcd6c53d489 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -567,7 +567,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if ($search_status != '') $param.='&search_status='.$search_status; if ($search_name != '') $param.='&search_name='.urlencode($search_name); - $colspan=8; + $colspan=9; print ''; print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); @@ -581,17 +581,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''.$langs->trans("Skype").''; } print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); + // Copy to clipboard print " "; + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; print ' '; } - if ($user->rights->societe->contact->creer) - { - $colspan++; - print ' '; - } + // Edit + print ' '; print ""; @@ -613,19 +612,23 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $colspan++; print ' '; } + // Status print ''; print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print ''; + // Copy to clipboard print " "; + + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; print ' '; } - + // Edit print ''; print ''; print ''; @@ -688,9 +691,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; } + // Status print ''.$contactstatic->getLibStatut(5).''; - // copy in clipboard + // Copy to clipboard $coords = ''; if (!empty($object->name)) $coords .= addslashes($object->name)."
"; @@ -721,10 +725,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if (!empty($object->country)) $coords .= "
".addslashes($object->country); } + print ''; print img_picto($langs->trans("Address"), 'object_address.png'); print ''; + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print ''; @@ -738,8 +744,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print img_object($langs->trans("Event"),"action"); print ''; } - - + + // Edit if ($user->rights->societe->contact->creer) { print ''; @@ -747,7 +753,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print img_edit(); print ''; } - + else print ' '; print "\n"; $i++; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 230287420b5..954cdc1c2d1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -613,11 +613,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("suppliers"); $newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); - - if (empty($user->societe_id)) - { - $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); - } + $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); //$newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire); //$newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire); } @@ -640,25 +636,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { // Categories prospects/customers $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } // Categories Contact $newmenu->add("/categories/index.php?leftmenu=cat&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); // Categories suppliers if (! empty($conf->fournisseur->enabled)) { $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } @@ -752,10 +739,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); - if (empty($user->societe_id)) - { - $newmenu->add("/compta/facture.php?action=create&leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer); - } + $newmenu->add("/compta/facture.php?action=create&leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer); $newmenu->add("/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),1,$user->rights->facture->lire); $newmenu->add("/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),1,$user->rights->facture->lire); @@ -778,10 +762,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); - if (empty($user->societe_id)) - { - $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); - } + $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire); $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire); @@ -959,11 +940,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->product->enabled)) { $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product'); - if (empty($user->societe_id)) - { - $newmenu->add("/product/fiche.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); - $newmenu->add("/product/liste.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); - } + $newmenu->add("/product/fiche.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); + $newmenu->add("/product/liste.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); if (! empty($conf->propal->enabled)) { $newmenu->add("/product/popuprop.php?leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); @@ -978,10 +956,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->service->enabled)) { $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); - if (empty($user->societe_id)) - { - $newmenu->add("/product/fiche.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); - } + $newmenu->add("/product/fiche.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); $newmenu->add("/product/liste.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); if (! empty($conf->propal->enabled)) { @@ -994,10 +969,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } @@ -1039,10 +1011,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/fourn/index.php?leftmenu=suppliers", $langs->trans("Suppliers"), 0, $user->rights->societe->lire && $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); // Security check - if (empty($user->societe_id)) - { - $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire); - } + $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire); $newmenu->add("/fourn/liste.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); $newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire); $newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); @@ -1052,12 +1021,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/fourn/facture/list.php?leftmenu=orders", $langs->trans("Bills"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'orders'); - - if (empty($user->societe_id)) - { - $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer); - } - + $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer); $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire); } @@ -1073,10 +1037,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } @@ -1196,10 +1157,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index ec258dda9d8..a1c2d641b71 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -158,7 +158,14 @@ if ($socid) if (! empty($conf->agenda->enabled)) { - print ''.$langs->trans("AddAction").''; + if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } } print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 4655c04fc8e..5e1a6ed40d7 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1576,12 +1576,12 @@ else // Country print ''.$langs->trans("Country").''; - if ($object->country_code) - { - $img=picto_from_langcode($object->country_code); - if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$object->country; - } + if (! empty($object->country_code)) + { + $img=picto_from_langcode($object->country_code); + if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); + else print ($img?$img.' ':'').$object->country; + } print ''; // State From b8550bb9859507cff7131e7eaba15b2f54eb811c Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 7 Jan 2014 12:16:16 +0100 Subject: [PATCH 32/41] Fix: Bad get of localtaxes into contracts add lines --- ChangeLog | 3 +++ htdocs/contrat/fiche.php | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c9701182bcd..c976fe08a27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -135,6 +135,9 @@ parameter. All methods addline in this case were modified to remove this paramet +***** ChangeLog for 3.4.3 compared to 3.4.2 ***** +Fix: Bad get of localtaxes into contracts add lines + ***** ChangeLog for 3.4.2 compared to 3.4.1 ***** Fix: field's problem into company's page (RIB). Fix: Document cerfa doesn't contained firstname & lastname from donator. diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index f045fb30cc3..06b408d4fa2 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -3,8 +3,8 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2012 Juanjo Menent - * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -448,8 +448,8 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $desc=$product_desc; } - $localtax1_tx=get_localtax($tva_tx,1,$object->societe); - $localtax2_tx=get_localtax($tva_tx,2,$object->societe); + $localtax1_tx=get_localtax($tva_tx,1,$object->thirdparty); + $localtax2_tx=get_localtax($tva_tx,2,$object->thirdparty); // ajout prix achat $fk_fournprice = $_POST['fournprice']; From 035670dce36624f44ffa1ba7f3dbe0b9d3cbdf44 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 7 Jan 2014 12:16:16 +0100 Subject: [PATCH 33/41] Fix: Bad get of localtaxes into contracts add lines --- ChangeLog | 3 +++ htdocs/contrat/fiche.php | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63c19ea52e6..4e6616c604f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -153,6 +153,9 @@ parameter. All methods addline in this case were modified to remove this paramet +***** ChangeLog for 3.4.3 compared to 3.4.2 ***** +Fix: Bad get of localtaxes into contracts add lines + ***** ChangeLog for 3.4.2 compared to 3.4.1 ***** Fix: field's problem into company's page (RIB) Fix: Document cerfa doesn't contained firstname & lastname from donator diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index f045fb30cc3..06b408d4fa2 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -3,8 +3,8 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2012 Juanjo Menent - * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -448,8 +448,8 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $desc=$product_desc; } - $localtax1_tx=get_localtax($tva_tx,1,$object->societe); - $localtax2_tx=get_localtax($tva_tx,2,$object->societe); + $localtax1_tx=get_localtax($tva_tx,1,$object->thirdparty); + $localtax2_tx=get_localtax($tva_tx,2,$object->thirdparty); // ajout prix achat $fk_fournprice = $_POST['fournprice']; From 89c772459fb0b6537cd20aba242c046f3a02fbed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2014 14:55:03 +0100 Subject: [PATCH 34/41] Fix: Bugs into permissions for module category --- htdocs/categories/class/categorie.class.php | 4 ++-- htdocs/categories/viewcat.php | 2 ++ htdocs/core/class/conf.class.php | 2 +- htdocs/core/lib/security.lib.php | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 4ab19b7f915..9f4be55eb40 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -528,13 +528,13 @@ class Categorie } /** - * Return list of contents of a category + * Return list of id of elements having this category * * @param string $field Field name for select in table. Full field name will be fk_field. * @param string $classname PHP Class of object to store entity * @param string $category_table Table name for select in table. Full table name will be PREFIX_categorie_table. * @param string $object_table Table name for select in table. Full table name will be PREFIX_table. - * @return void + * @return mixed -1 if KO, array of instance of object if OK */ function get_type($field,$classname,$category_table='',$object_table='') { diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 6316436f69a..7aa9aa0b964 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -365,6 +365,8 @@ if($object->type == 2) $var=true; foreach ($socs as $key => $soc) { + if ($user->societe_id > 0 && $soc->id != $user->societe_id) continue; // External user always see only themself + $i++; $var=!$var; print "\t\n"; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 2ed38d94e4a..64dd4c8b9fa 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -403,7 +403,7 @@ class Conf $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); // Define list of limited modules - if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later. + if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later. // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 24227832370..b9dcda4b55a 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -341,7 +341,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature $sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; } } - else if (in_array($feature,$checksoc)) + else if (in_array($feature,$checksoc)) // We check feature = checksoc { // If external user: Check permission for external users if ($user->societe_id > 0) @@ -450,7 +450,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature } } - //print $sql."
"; + //print "sql=".$sql."
"; if ($sql) { $resql=$db->query($sql); From 4d379e572a32a28434f1468ab2c465555ad39ce8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2014 14:55:03 +0100 Subject: [PATCH 35/41] Fix: Bugs into permissions for module category --- htdocs/categories/class/categorie.class.php | 4 ++-- htdocs/categories/viewcat.php | 2 ++ htdocs/core/class/conf.class.php | 2 +- htdocs/core/lib/security.lib.php | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 4ab19b7f915..9f4be55eb40 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -528,13 +528,13 @@ class Categorie } /** - * Return list of contents of a category + * Return list of id of elements having this category * * @param string $field Field name for select in table. Full field name will be fk_field. * @param string $classname PHP Class of object to store entity * @param string $category_table Table name for select in table. Full table name will be PREFIX_categorie_table. * @param string $object_table Table name for select in table. Full table name will be PREFIX_table. - * @return void + * @return mixed -1 if KO, array of instance of object if OK */ function get_type($field,$classname,$category_table='',$object_table='') { diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 6316436f69a..7aa9aa0b964 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -365,6 +365,8 @@ if($object->type == 2) $var=true; foreach ($socs as $key => $soc) { + if ($user->societe_id > 0 && $soc->id != $user->societe_id) continue; // External user always see only themself + $i++; $var=!$var; print "\t\n"; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 2ed38d94e4a..64dd4c8b9fa 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -403,7 +403,7 @@ class Conf $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); // Define list of limited modules - if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later. + if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later. // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 24227832370..b9dcda4b55a 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -341,7 +341,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature $sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; } } - else if (in_array($feature,$checksoc)) + else if (in_array($feature,$checksoc)) // We check feature = checksoc { // If external user: Check permission for external users if ($user->societe_id > 0) @@ -450,7 +450,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature } } - //print $sql."
"; + //print "sql=".$sql."
"; if ($sql) { $resql=$db->query($sql); From 1df18f1e93f3e6fd10405b0fe95d24a70c6019da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2014 16:11:08 +0100 Subject: [PATCH 36/41] Fix: Function GETPOST not found --- htdocs/public/paypal/paymentko.php | 10 +++++----- htdocs/public/paypal/paymentok.php | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 012880f817a..5a59e288662 100644 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -29,16 +29,16 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. -// For MultiCompany module. This should be useless. Because entity must be retreive from object ref and not from url. -$entity=GETPOST('entity')?GETPOST('entity','int'):1; -if (is_int($entity)) define("DOLENTITY", $entity); - - require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +// For MultiCompany module. +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=GETPOST('entity')?GETPOST('entity','int'):1; +if (is_int($entity)) define("DOLENTITY", $entity); + // Security check if (empty($conf->paypal->enabled)) accessforbidden('',1,1,1); diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 47fd55dc5d6..d4aed404597 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -29,16 +29,16 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. -// For MultiCompany module. This should be useless. Because entity must be retreive from object ref and not from url. -$entity=GETPOST('entity')?GETPOST('entity','int'):1; -if (is_int($entity)) define("DOLENTITY", $entity); - - require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +// For MultiCompany module +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=GETPOST('entity')?GETPOST('entity','int'):1; +if (is_int($entity)) define("DOLENTITY", $entity); + // Security check if (empty($conf->paypal->enabled)) accessforbidden('',1,1,1); From 6e5f3b8bddf39371f0d72847e4e3f15facc91171 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2014 16:29:25 +0100 Subject: [PATCH 37/41] Fix: entity into public pages not set at correct place --- htdocs/public/members/new.php | 9 ++++----- htdocs/public/members/public_card.php | 11 +++++------ htdocs/public/members/public_list.php | 11 +++++------ htdocs/public/paybox/newpayment.php | 6 ++++++ htdocs/public/paybox/paymentko.php | 6 ++++++ htdocs/public/paybox/paymentok.php | 6 ++++++ htdocs/public/paypal/newpayment.php | 9 ++++----- htdocs/public/paypal/paymentko.php | 11 ++++++----- htdocs/public/paypal/paymentok.php | 11 ++++++----- 9 files changed, 48 insertions(+), 32 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 3e3082cc981..34a96f7bcb6 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -38,12 +38,11 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. -// For MultiCompany module +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); -if (is_int($entity)) -{ - define("DOLENTITY", $entity); -} +if (is_int($entity)) define("DOLENTITY", $entity); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index 0fc725c8ed4..2a9b3465543 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -27,12 +27,11 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. -// For MultiCompany module -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : 1); -if (is_int($entity)) -{ - define("DOLENTITY", $entity); -} +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_int($entity)) define("DOLENTITY", $entity); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index d186467ee04..1b6d23d946c 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -27,12 +27,11 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. -// For MultiCompany module -$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : 1); -if (is_int($entity)) -{ - define("DOLENTITY", $entity); -} +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_int($entity)) define("DOLENTITY", $entity); require '../../main.inc.php'; diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index 77437c110d2..b8bad33c08f 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -27,6 +27,12 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_int($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index f01628324bb..a9da81d0e68 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -26,6 +26,12 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_int($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index e204b6d6697..350d409735c 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -26,6 +26,12 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_int($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paybox/lib/paybox.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 81c362633ed..91d1f67a3b9 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -29,12 +29,11 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. -// For MultiCompany module +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); -if (is_int($entity)) -{ - define("DOLENTITY", $entity); -} +if (is_int($entity)) define("DOLENTITY", $entity); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 5a59e288662..3427f6a9b82 100644 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -29,16 +29,17 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_int($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -// For MultiCompany module. -// TODO This should be useless. Because entity must be retreive from object ref and not from url. -$entity=GETPOST('entity')?GETPOST('entity','int'):1; -if (is_int($entity)) define("DOLENTITY", $entity); - // Security check if (empty($conf->paypal->enabled)) accessforbidden('',1,1,1); diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index d4aed404597..68420f3bbd8 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -29,16 +29,17 @@ define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOCSRFCHECK",1); // We accept to go on this page from external web site. +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retreive from object ref and not from url. +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_int($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -// For MultiCompany module -// TODO This should be useless. Because entity must be retreive from object ref and not from url. -$entity=GETPOST('entity')?GETPOST('entity','int'):1; -if (is_int($entity)) define("DOLENTITY", $entity); - // Security check if (empty($conf->paypal->enabled)) accessforbidden('',1,1,1); From 267716b557e1ad161d22ab2414e9ca19ccc2bb5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2014 16:53:07 +0100 Subject: [PATCH 38/41] Just a space between default message and setup message --- htdocs/public/paybox/paymentko.php | 2 +- htdocs/public/paybox/paymentok.php | 2 +- htdocs/public/paypal/paymentko.php | 2 +- htdocs/public/paypal/paymentok.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index a9da81d0e68..b1639ec379e 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -101,7 +101,7 @@ llxHeaderPayBox($langs->trans("PaymentForm")); print ''."\n"; print '
'."\n"; -print $langs->trans("YourPaymentHasNotBeenRecorded")."
\n"; +print $langs->trans("YourPaymentHasNotBeenRecorded")."

\n"; if (! empty($conf->global->PAYBOX_MESSAGE_KO)) print $conf->global->PAYBOX_MESSAGE_KO; diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index 350d409735c..159d29bb78c 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -124,7 +124,7 @@ if (! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) } -print $langs->trans("YourPaymentHasBeenRecorded")."
\n"; +print $langs->trans("YourPaymentHasBeenRecorded")."

\n"; if (! empty($conf->global->PAYBOX_MESSAGE_OK)) print $conf->global->PAYBOX_MESSAGE_OK; diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index 3427f6a9b82..6076c54bd03 100644 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -101,7 +101,7 @@ llxHeaderPaypal($langs->trans("PaymentForm")); // Show ko message print ''."\n"; print '
'."\n"; -print $langs->trans("YourPaymentHasNotBeenRecorded")."
"; +print $langs->trans("YourPaymentHasNotBeenRecorded")."

"; $PAYPALTOKEN=GETPOST('TOKEN'); if (empty($PAYPALTOKEN)) $PAYPALTOKEN=GETPOST('token'); diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 68420f3bbd8..631aa922eda 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -184,7 +184,7 @@ if ($PAYPALTOKEN) $NOTE=urldecode($resArray["NOTE"]); print $langs->trans("YourPaymentHasBeenRecorded")."
\n"; - print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."
\n"; + print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."

\n"; if (! empty($conf->global->PAYPAL_MESSAGE_OK)) print $conf->global->PAYPAL_MESSAGE_OK; // Appel des triggers From 58bc3b14579223c087e3fbeb2123569cbb0e7ec1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2014 17:34:25 +0100 Subject: [PATCH 39/41] New: For paypal payment confirmation, send email ok only if payment is confirmed. Otherwise send ko email. --- htdocs/public/paypal/paymentok.php | 77 +++++++++++++++++++----------- 1 file changed, 50 insertions(+), 27 deletions(-) diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 631aa922eda..28ddd1a4efc 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -129,33 +129,6 @@ if ($PAYPALTOKEN) dol_syslog("Call paymentok with token=".$token." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType." payerID=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt." fulltag=".$fulltag, LOG_DEBUG, 0, '_paypal'); - // Send an email - //if (! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL) && preg_match('/MEM=/',$fulltag)) - if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) - { - //$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; - $sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL; - $from=$conf->global->MAILING_EMAIL_FROM; - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile( - '['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentReceived"), - $sendto, - $from, - $langs->transnoentitiesnoconv("NewPaypalPaymentReceived")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt - ); - - $result=$mailfile->sendfile(); - if ($result) - { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paypal'); - } - else - { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paypal'); - } - } - - // Validate record if (! empty($paymentType)) { @@ -193,6 +166,31 @@ if ($PAYPALTOKEN) $result=$interface->run_triggers('PAYPAL_PAYMENT_OK',$object,$user,$langs,$conf); if ($result < 0) { $error++; $errors=$interface->errors; } // Fin appel triggers + + // Send an email + if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) + { + //$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; + $sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL; + $from=$conf->global->MAILING_EMAIL_FROM; + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile( + '['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("NewPaypalPaymentReceived"), + $sendto, + $from, + $langs->transnoentitiesnoconv("NewPaypalPaymentReceived")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt + ); + + $result=$mailfile->sendfile(); + if ($result) + { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paypal'); + } + else + { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paypal'); + } + } } else { @@ -209,6 +207,31 @@ if ($PAYPALTOKEN) echo "Error Severity Code: " . $ErrorSeverityCode; if ($mysoc->email) echo "\nPlease, send a screenshot of this page to ".$mysoc->email; + + // Send an email + if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) + { + //$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; + $sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL; + $from=$conf->global->MAILING_EMAIL_FROM; + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile( + '['.$conf->global->MAIN_APPLICATION_TITLE.'] '.$langs->transnoentitiesnoconv("ValidationOfPaypalPaymentFailed"), + $sendto, + $from, + $langs->transnoentitiesnoconv("PaypalConfirmPaymentPageWasCalledButFailed")."\ntag=".$fulltag."\ntoken=".$token." paymentType=".$paymentType." currencycodeType=".$currencyCodeType." payerId=".$payerID." ipaddress=".$ipaddress." FinalPaymentAmt=".$FinalPaymentAmt."\nErrorCode=".$ErrorCode."\nErrorLongMsg=".$ErrorLongMsg + ); + + $result=$mailfile->sendfile(); + if ($result) + { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_paypal'); + } + else + { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_paypal'); + } + } } } else From bc51065ff1088482953e44364c73852b9b19621f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2014 17:35:33 +0100 Subject: [PATCH 40/41] New: For paypal payment confirmation, send email ok only if payment is confirmed. Otherwise send ko email. --- htdocs/public/paypal/paymentok.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 28ddd1a4efc..32aa3fd4b49 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -170,7 +170,6 @@ if ($PAYPALTOKEN) // Send an email if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) { - //$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; $sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -211,7 +210,6 @@ if ($PAYPALTOKEN) // Send an email if (! empty($conf->global->PAYPAL_PAYONLINE_SENDEMAIL)) { - //$sendto=$conf->global->MEMBER_PAYONLINE_SENDEMAIL; $sendto=$conf->global->PAYPAL_PAYONLINE_SENDEMAIL; $from=$conf->global->MAILING_EMAIL_FROM; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; From 0876e2cf3fddec52fd166e4fb18c755215eb0412 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2014 17:48:01 +0100 Subject: [PATCH 41/41] Qual: Add phpunit test for paypal module --- test/phpunit/PaypalTest.php | 146 ++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 test/phpunit/PaypalTest.php diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php new file mode 100644 index 00000000000..017f4affbc6 --- /dev/null +++ b/test/phpunit/PaypalTest.php @@ -0,0 +1,146 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file test/phpunit/PaypalTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/core/lib/geturl.lib.php'; +require_once dirname(__FILE__).'/../../htdocs/paypal/lib/paypal.lib.php'; + +if (empty($user->id)) +{ + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class PaypalTest extends PHPUnit_Framework_TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return ProductTest + */ + function __construct() + { + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + + if (empty($conf->paypal->enabled)) { print __METHOD__." Module Paypal must be enabled.\n"; die(); } + + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + /** + * testProductCreate + * + * @return void + */ + public function testPaypalOk() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $urltotest=getPaypalPaymentUrl(1,'free'); + print "urltotest=".$urltotest."\n"; + + $result=getURLContent($urltotest, 'GET'); + + print __METHOD__." result=".$result."\n"; + $this->assertLessThanOrEqual($result, 0); + + return $result; + } + +} +?> \ No newline at end of file