From 0a0c7fdeb151cc1e63a06cde5250d84b67048695 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 21:15:40 +0100 Subject: [PATCH 01/18] FIX hourglass and hide button to pay --- htdocs/public/payment/newpayment.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 8672fa1c2bf..8f3bb23a362 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2089,6 +2089,10 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment } else { + /* Disable button to pay and show hourglass cursor */ + jQuery('#hourglasstopay').show(); + jQuery('#buttontopay').hide(); + stripe.handleCardPayment( clientSecret, cardElement, { payment_method_data: { From 5406de13eefa70a10ca1690a7150966a5f51076c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 21:33:13 +0100 Subject: [PATCH 02/18] css --- htdocs/adherents/subscription/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 05a0567a8d9..eeeafea5d6a 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -418,7 +418,7 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['d.ref']['checked'])) { - print ''.$subscription->getNomUrl(1).''; + print ''.$subscription->getNomUrl(1).''; if (!$i) $totalarray['nbfield']++; } // Type From de241eced3dbf36dc7f8bec1b03835dcf85a7a98 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 28 Feb 2021 22:22:20 +0100 Subject: [PATCH 03/18] FIX: Total_ht not show in contract link element --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7f8831bec96..30225e45baa 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7133,7 +7133,7 @@ class Form 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'), 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'), 'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract', - 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'), From 490faec547f92172e49b0d8bfdfb4649d4fbdff2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 22:44:11 +0100 Subject: [PATCH 04/18] FIX Timezone problems Conflicts: htdocs/core/lib/date.lib.php test/phpunit/DateLibTest.php --- htdocs/core/lib/date.lib.php | 64 +++++++-------------------------- test/phpunit/DateLibTest.php | 68 ++++++++++++++++++++---------------- 2 files changed, 49 insertions(+), 83 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 74b091865ff..4117249a66c 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -620,7 +620,7 @@ function dol_get_first_day_week($day, $month, $year, $gm = false) */ function getGMTEasterDatetime($year) { - $base = new DateTime("$year-03-21"); + $base = new DateTime("$year-03-21", new DateTimeZone("UTC")); $days = easter_days($year); // Return number of days between 21 march and easter day. $tmp = $base->add(new DateInterval("P{$days}D")); return $tmp->getTimestamp(); @@ -628,11 +628,11 @@ function getGMTEasterDatetime($year) /** * Return the number of non working days including saturday and sunday (or not) between 2 dates in timestamp. - * Dates must be UTC with hour, day, min to 0. + * Dates must be UTC with hour, min, sec to 0. * Called by function num_open_day() * - * @param int $timestampStart Timestamp de debut - * @param int $timestampEnd Timestamp de fin + * @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0) + * @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0) * @param string $country_code Country code * @param int $lastday Last day is included, 0: no, 1:yes * @param int $includesaturday Include saturday as non working day (-1=use setup, 0=no, 1=yes) @@ -721,32 +721,20 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Calculation for the monday of easter date $date_paques = getGMTEasterDatetime($annee); - $date_lundi_paques = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 1, - gmdate("Y", $date_paques) - ); + //print 'PPP'.$date_paques.' '.dol_print_date($date_paques, 'dayhour', 'gmt')." "; + $date_lundi_paques = $date_paques + (3600 * 24); $jour_lundi_paques = gmdate("d", $date_lundi_paques); $mois_lundi_paques = gmdate("m", $date_lundi_paques); if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) $ferie = true; // Easter (monday) + //print 'annee='.$annee.' $jour='.$jour.' $mois='.$mois.' $jour_lundi_paques='.$jour_lundi_paques.' $mois_lundi_paques='.$mois_lundi_paques."\n"; } if (in_array('ascension', $specialdayrule)) { // Calcul du jour de l'ascension (39 days after easter day) $date_paques = getGMTEasterDatetime($annee); - $date_ascension = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 39, - gmdate("Y", $date_paques) - ); + $date_ascension = $date_paques + (3600 * 24 * 39); $jour_ascension = gmdate("d", $date_ascension); $mois_ascension = gmdate("m", $date_ascension); if ($jour_ascension == $jour && $mois_ascension == $mois) $ferie = true; @@ -757,14 +745,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Calculation of "Pentecote" (49 days after easter day) $date_paques = getGMTEasterDatetime($annee); - $date_pentecote = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 49, - gmdate("Y", $date_paques) - ); + $date_pentecote = $date_paques + (3600 * 24 * 49); $jour_pentecote = gmdate("d", $date_pentecote); $mois_pentecote = gmdate("m", $date_pentecote); if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true; @@ -774,14 +755,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Calculation of "Pentecote" (49 days after easter day) $date_paques = getGMTEasterDatetime($annee); - $date_pentecote = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 50, - gmdate("Y", $date_paques) - ); + $date_pentecote = $date_paques + (3600 * 24 * 50); $jour_pentecote = gmdate("d", $date_pentecote); $mois_pentecote = gmdate("m", $date_pentecote); if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true; @@ -792,14 +766,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Viernes Santo $date_paques = getGMTEasterDatetime($annee); - $date_viernes = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) - 2, - gmdate("Y", $date_paques) - ); + $date_viernes = $date_paques - (3600 * 24 * 2); $jour_viernes = gmdate("d", $date_viernes); $mois_viernes = gmdate("m", $date_viernes); if ($jour_viernes == $jour && $mois_viernes == $mois) $ferie = true; @@ -810,14 +777,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Fronleichnam (60 days after easter sunday) $date_paques = getGMTEasterDatetime($annee); - $date_fronleichnam = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 60, - gmdate("Y", $date_paques) - ); + $date_fronleichnam = $date_paques + (3600 * 24 * 60); $jour_fronleichnam = gmdate("d", $date_fronleichnam); $mois_fronleichnam = gmdate("m", $date_fronleichnam); if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) $ferie = true; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 2d5598f49b3..c9ed3be64aa 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -69,7 +69,13 @@ class DateLibTest extends PHPUnit\Framework\TestCase $this->savlangs=$langs; $this->savdb=$db; + $langs->load("admin"); + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + + print "\n".$langs->trans("CurrentTimeZone").' : '.getServerTimeZoneString(); + print "\n".$langs->trans("CurrentHour").' : '.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver'); + //print " - db ".$db->db; print "\n"; } @@ -139,8 +145,8 @@ class DateLibTest extends PHPUnit\Framework\TestCase $db=$this->savdb; // With same hours - $date1=dol_mktime(0, 0, 0, 1, 1, 2012); - $date2=dol_mktime(0, 0, 0, 1, 2, 2012); + $date1=dol_mktime(0, 0, 0, 1, 1, 2012, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 2, 2012, 'gmt'); $result=num_between_day($date1, $date2, 1); print __METHOD__." result=".$result."\n"; @@ -151,8 +157,8 @@ class DateLibTest extends PHPUnit\Framework\TestCase $this->assertEquals(1, $result); // With different hours - $date1=dol_mktime(0, 0, 0, 1, 1, 2012); - $date2=dol_mktime(12, 0, 0, 1, 2, 2012); + $date1=dol_mktime(0, 0, 0, 1, 1, 2012, 'gmt'); + $date2=dol_mktime(12, 0, 0, 1, 2, 2012, 'gmt'); $result=num_between_day($date1, $date2, 1); print __METHOD__." result=".$result."\n"; @@ -190,26 +196,27 @@ class DateLibTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - // With same hours - Tuesday/Wednesday jan 2013 - $date1=dol_mktime(0, 0, 0, 1, 1, 2013); - $date2=dol_mktime(0, 0, 0, 1, 2, 2013); - $date3=dol_mktime(0, 0, 0, 1, 3, 2013); + // With same hours - Tuesday/Wednesday jan 2013 + $date1=dol_mktime(0, 0, 0, 1, 1, 2013, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 2, 2013, 'gmt'); + $date3=dol_mktime(0, 0, 0, 1, 3, 2013, 'gmt'); - $result=num_public_holiday($date1, $date2, 'FR', 1); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 closed days (country france) + $result=num_public_holiday($date1, $date2, 'FR', 1); + print __METHOD__." for Tuesday 1 - Wednesday 2 jan 2013 for FR result=".$result."\n"; + $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 closed days (country france) - $result=num_public_holiday($date1, $date2, 'XX', 1); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 closed days (country unknown) + $result=num_public_holiday($date1, $date2, 'XX', 1); + print __METHOD__." for Tuesday 1 - Wednesday 2 jan 2013 for XX result=".$result."\n"; + $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 closed days (country unknown) - $result=num_public_holiday($date2, $date3, 'FR', 1); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(0, $result, 'NumPublicHoliday for Wednesday 2 - Thursday 3 jan 2013 for FR'); // no closed days + print '----'."\n"; + $result=num_public_holiday($date2, $date3, 'FR', 1); + print __METHOD__." for Wednesday 2 - Thursday 3 jan 2013 for FR result=".$result."\n"; + $this->assertEquals(0, $result, 'NumPublicHoliday for Wednesday 2 - Thursday 3 jan 2013 for FR'); // no closed days - // Check with easter monday - $date1=dol_mktime(0, 0, 0, 4, 21, 2019); - $date2=dol_mktime(0, 0, 0, 4, 23, 2019); + // Check with easter monday + $date1=dol_mktime(0, 0, 0, 4, 21, 2019, 'gmt'); + $date2=dol_mktime(0, 0, 0, 4, 23, 2019, 'gmt'); $result=num_public_holiday($date1, $date2, 'XX', 1); print __METHOD__." result=".$result."\n"; @@ -219,9 +226,9 @@ class DateLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals(2, $result, 'NumPublicHoliday including eastermonday for FR'); // 1 opened day, 2 closed days (sunday + easter monday) - // Check for sunday/saturday - Friday 4 - Sunday 6 jan 2013 - $date1=dol_mktime(0, 0, 0, 1, 4, 2013); - $date2=dol_mktime(0, 0, 0, 1, 6, 2013); + // Check for sunday/saturday - Friday 4 - Sunday 6 jan 2013 + $date1=dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 6, 2013, 'gmt'); $result=num_public_holiday($date1, $date2, 'FR', 1); print __METHOD__." result=".$result."\n"; @@ -257,10 +264,10 @@ class DateLibTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - // With same hours - Tuesday/Wednesday jan 2013 - $date1=dol_mktime(0, 0, 0, 1, 1, 2013); - $date2=dol_mktime(0, 0, 0, 1, 2, 2013); - $date3=dol_mktime(0, 0, 0, 1, 3, 2013); + // With same hours - Tuesday/Wednesday jan 2013 + $date1=dol_mktime(0, 0, 0, 1, 1, 2013, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 2, 2013, 'gmt'); + $date3=dol_mktime(0, 0, 0, 1, 3, 2013, 'gmt'); $result=num_open_day($date1, $date2, 0, 1, 0, 'FR'); print __METHOD__." result=".$result."\n"; @@ -274,9 +281,9 @@ class DateLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals(2, $result, 'NumOpenDay Wednesday 2 - Thursday 3 jan 2013 for FR'); // 2 opened days - // With same hours - Friday/Sunday jan 2013 - $date1=dol_mktime(0, 0, 0, 1, 4, 2013); - $date2=dol_mktime(0, 0, 0, 1, 6, 2013); + // With same hours - Friday/Sunday jan 2013 + $date1=dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 6, 2013, 'gmt'); $result=num_open_day($date1, $date2, 0, 1, 0, 'FR'); print __METHOD__." result=".$result."\n"; @@ -328,7 +335,6 @@ class DateLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertSame('1 '.$langs->trans("Day"), $result); - return $result; } From 3e52c33bde45bad0ab401aa08f68aa57f0011e20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 22:52:41 +0100 Subject: [PATCH 05/18] Fix manual phpunit --- test/phpunit/DateLibTzFranceTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php index 7e96e39030e..b77d13fd0c0 100644 --- a/test/phpunit/DateLibTzFranceTest.php +++ b/test/phpunit/DateLibTzFranceTest.php @@ -83,8 +83,8 @@ class DateLibTzFranceTest extends PHPUnit\Framework\TestCase { global $conf,$user,$langs,$db; - if (getServerTimeZoneString() != 'Europe/Paris') { - print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(); + if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') { + print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. From bcdfdae10c74aae5900c39c87917dfe9ce630d45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 23:43:07 +0100 Subject: [PATCH 06/18] FIX #16480 --- .../societe/canvas/company/tpl/card_create.tpl.php | 4 ++-- htdocs/societe/canvas/company/tpl/card_edit.tpl.php | 4 ++-- .../canvas/individual/tpl/card_create.tpl.php | 4 ++-- .../societe/canvas/individual/tpl/card_edit.tpl.php | 4 ++-- htdocs/societe/card.php | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/societe/canvas/company/tpl/card_create.tpl.php b/htdocs/societe/canvas/company/tpl/card_create.tpl.php index e79c1cea177..039f4c4b9e7 100644 --- a/htdocs/societe/canvas/company/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_create.tpl.php @@ -74,7 +74,7 @@ if (empty($conf) || !is_object($conf)) - +
control->tpl['help_customercode']; ?>
@@ -89,7 +89,7 @@ if (empty($conf) || !is_object($conf)) - +
control->tpl['help_suppliercode']; ?>
diff --git a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php index 57b8a06b019..e03d0fa7b6e 100644 --- a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php @@ -75,7 +75,7 @@ $contact = $GLOBALS['objcanvas']->control->object; control->tpl['ismodifiable_customercode']) { ?> - + control->tpl['customercode']; ?> @@ -96,7 +96,7 @@ $contact = $GLOBALS['objcanvas']->control->object; control->tpl['ismodifiable_suppliercode']) { ?> - + control->tpl['suppliercode']; ?> diff --git a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php index 649d1bf8aca..389b36e50f5 100644 --- a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php @@ -84,7 +84,7 @@ if (empty($conf) || !is_object($conf)) - +
control->tpl['help_customercode']; ?>
@@ -99,7 +99,7 @@ if (empty($conf) || !is_object($conf)) - +
control->tpl['help_suppliercode']; ?>
diff --git a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php index b5f57544c5f..ffdbe2c3016 100644 --- a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php @@ -73,7 +73,7 @@ if (empty($conf) || !is_object($conf)) control->tpl['ismodifiable_customercode']) { ?> - + control->tpl['customercode']; ?> @@ -94,7 +94,7 @@ if (empty($conf) || !is_object($conf)) control->tpl['ismodifiable_suppliercode']) { ?> - + control->tpl['suppliercode']; ?> diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 21f4f4e78fb..4afb596fbda 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1253,7 +1253,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''; + // Gender + print ''; + print ''; + // Company print ''; @@ -460,6 +466,15 @@ if ($rowid > 0) { // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''; } - print '
'; $tmpcode = $object->code_client; if (empty($tmpcode) && !empty($modCodeClient->code_auto)) $tmpcode = $modCodeClient->getNextValue($object, 0); - print ''; + print ''; print ''; $s = $modCodeClient->getToolTip($langs, $object, 0); print $form->textwithpicto('', $s, 1); @@ -1285,7 +1285,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; + print '
'; $tmpcode = $object->code_fournisseur; if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) $tmpcode = $modCodeFournisseur->getNextValue($object, 1); - print ''; + print ''; print ''; $s = $modCodeFournisseur->getToolTip($langs, $object, 1); print $form->textwithpicto('', $s, 1); @@ -1840,10 +1840,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $tmpcode = $object->code_client; if (empty($tmpcode) && !empty($object->oldcopy->code_client)) $tmpcode = $object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && !empty($modCodeClient->code_auto)) $tmpcode = $modCodeClient->getNextValue($object, 0); - print ''; + print ''; } elseif ($object->codeclient_modifiable()) { - print ''; + print ''; } else { print $object->code_client; print ''; @@ -1878,10 +1878,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $tmpcode = $object->code_fournisseur; if (empty($tmpcode) && !empty($object->oldcopy->code_fournisseur)) $tmpcode = $object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) $tmpcode = $modCodeFournisseur->getNextValue($object, 1); - print ''; + print ''; } elseif ($object->codefournisseur_modifiable()) { - print ''; + print ''; } else { print $object->code_fournisseur; print ''; From 77151bd560e93fbc1b9be61bbc394c2aa1dd1ec0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 23:53:20 +0100 Subject: [PATCH 07/18] Standardize tabs --- htdocs/adherents/card.php | 64 +++++++++++++++-------------- htdocs/adherents/subscription.php | 67 +++++++++++++++++++------------ 2 files changed, 75 insertions(+), 56 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 94904d877e7..a3fe601ae6e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1490,10 +1490,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print '
'.$langs->trans("Password").''.preg_replace('/./i', '*', $object->pass); - if ($object->pass) print preg_replace('/./i', '*', $object->pass); - else { - if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; - else print $langs->trans("Hidden"); + if ($object->pass) { + print preg_replace('/./i', '*', $object->pass); + } else { + if ($user->admin) { + print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; + } else { + print $langs->trans("Hidden"); + } } if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) { $langs->load("errors"); @@ -1523,6 +1527,32 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print '
'; + + print ''; + + print '
'; + print '
'; + + print ''; + + // Birth Date + print ''; + + // Public + print ''; + + // Categories + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + print ''; + print ''; + } + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Third party Dolibarr if (!empty($conf->societe->enabled)) { print ''; - print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); + print '
'; @@ -1571,29 +1601,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print '
'; - - print '
'; - - print '
'; - print '
'; - - print ''; - - // Birth Date - print ''; - - // Public - print ''; - - // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { - print ''; - print ''; - } - //VCard print ''; - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print "
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); - print '
'; print $langs->trans("VCard").''; @@ -1603,9 +1610,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print '
\n"; print "
\n"; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index a00c52b88e5..799f043c4df 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -450,6 +450,12 @@ if ($rowid > 0) { print '
'.$langs->trans("MemberNature").''.$object->getmorphylib().'
'.$langs->trans("Gender").''; + if ($object->gender) print $langs->trans("Gender".$object->gender); + print '
'.$langs->trans("Company").''.$object->company.'
'.$langs->trans("Password").''.preg_replace('/./i', '*', $object->pass); + if ($object->pass) { + print preg_replace('/./i', '*', $object->pass); + } else { + if ($user->admin) { + print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; + } else { + print $langs->trans("Hidden"); + } + } if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) { $langs->load("errors"); $htmltext = $langs->trans("WarningPasswordSetWithNoAccount"); @@ -468,32 +483,6 @@ if ($rowid > 0) { print '
'; - - print ''; - print '
'; - - print '
'; - print ''; - - // Birthday - print ''; - - // Public - print ''; - - // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { - print ''; - print ''; - } - - // Other attributes - $cols = 2; - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - // Date end subscription print ''; + print '
'.$langs->trans("Birthday").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); - print '
'.$langs->trans("SubscriptionEndDate").''; if ($object->datefin) { @@ -512,6 +501,32 @@ if ($rowid > 0) { } print '
'; + + print '
'; + print '
'; + + print '
'; + print ''; + + // Birthday + print ''; + + // Public + print ''; + + // Categories + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + print ''; + print ''; + } + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Third party Dolibarr if (!empty($conf->societe->enabled)) { print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; $i++; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 453651f1708..3b519458cbc 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1115,3 +1115,4 @@ EventReminder=Event Reminder UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility +InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into account. From 3b1a9cd668d76f9ee4758b23b97a205f59975af5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Mar 2021 03:18:14 +0100 Subject: [PATCH 09/18] FIX: Total_ht not show in contract link element --- htdocs/langs/en_US/main.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 3b519458cbc..7a666acc146 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1115,4 +1115,4 @@ EventReminder=Event Reminder UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility -InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into account. +InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. From 0abe576fdc9324b7aad904edabe925fb6858b547 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Mar 2021 04:49:06 +0100 Subject: [PATCH 10/18] FIX: Various payment - Missing fields for check transmitter & bank name --- .../bank/class/paymentvarious.class.php | 10 ++- htdocs/compta/bank/various_payment/card.php | 75 +++++++++++++++---- 2 files changed, 67 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index d05e2d339a6..edb030ff912 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2021 Alexandre Spangaro * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -70,6 +70,8 @@ class PaymentVarious extends CommonObject public $amount; public $type_payment; public $num_payment; + public $chqemetteur; + public $chqbank; public $category_transaction; /** @@ -424,7 +426,7 @@ class PaymentVarious extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount")); return -6; } - if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0)) + if (!empty($conf->banque->enabled) && (empty($this->type_payment))) { $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); return -7; @@ -499,8 +501,8 @@ class PaymentVarious extends CommonObject $this->num_payment, ($this->category_transaction > 0 ? $this->category_transaction : 0), $user, - '', - '', + $this->chqemetteur, + $this->chqbank, '', $this->datev ); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 0c2db362e75..94f671c6dd5 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -49,7 +49,7 @@ $accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; $label = GETPOST("label", "alpha"); $sens = GETPOST("sens", "int"); $amount = price2num(GETPOST("amount", "alpha")); -$paymenttype = GETPOST("paymenttype", "int"); +$paymenttype = GETPOST("paymenttype", "aZ09"); $accountancy_code = GETPOST("accountancy_code", "alpha"); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { @@ -113,8 +113,10 @@ if (empty($reshook)) $object->amount = price2num(GETPOST("amount", 'alpha')); $object->label = GETPOST("label", 'restricthtml'); $object->note = GETPOST("note", 'restricthtml'); - $object->type_payment = GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0; + $object->type_payment = dol_getIdFromCode($db, GETPOST('paymenttype'), 'c_paiement', 'code', 'id', 1); $object->num_payment = GETPOST("num_payment", 'alpha'); + $object->chqemetteur = GETPOST("chqemetteur", 'alpha'); + $object->chqbank = GETPOST("chqbank", 'alpha'); $object->fk_user_author = $user->id; $object->category_transaction = GETPOST("category_transaction", 'alpha'); @@ -345,6 +347,43 @@ foreach ($bankcateg->fetchAll() as $bankcategory) { /* ************************************************************************** */ if ($action == 'create') { + // Update fields properties in realtime + if (!empty($conf->use_javascript_ajax)) + { + print "\n".''."\n"; + } + print '
'; print ''; print ''; @@ -390,20 +429,28 @@ if ($action == 'create') } // Type payment - print '
'; + print '\n"; + print ''; // Number - if (!empty($conf->banque->enabled)) - { - // Number - print ''; - print ''."\n"; - } + print ''; + print ''."\n"; + + // Check transmitter + print ''; + print ''; + + // Bank name + print ''; + print ''; // Accountancy account if (!empty($conf->accounting->enabled)) { From 0796bc45b14bd244526b7672d72c5fb5fd5c35a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 10:39:27 +0100 Subject: [PATCH 11/18] Fix amount for some language on public payment page --- htdocs/public/payment/newpayment.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 8f3bb23a362..bda79d7d97d 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -869,7 +869,7 @@ if (!$source) print '\n"; print ''; print "\n"; +if (!empty($conf->societe->enabled)) { + print ''; + print ''; + print '\n"; + print "\n"; +} + print ''; print ''; print ''; -print ''; -print ''; -print '\n"; -print "\n"; - print ''; print ''; // Ref - print ''; + print ''; // Company if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { // Thirdparty - print ''; - if ($soc->id > 0 && !GETPOST('fac_rec', 'alpha')) + if ($soc->id > 0) { - print ''; + print ''; } else { - print ''; + print ''; } print ''."\n"; @@ -545,11 +549,15 @@ if (!empty($id) && $action == 'edit') print ""; print "\n"; - if ($object->socid && !empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { + if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { $company = new Societe($db); - $result = $company->fetch($object->socid); - print ''; + print ''; } else { $langs->load("companies"); print ''; @@ -707,11 +715,15 @@ if (!empty($id) && $action != 'edit') print yn($object->public); print ''; - if ($object->socid) { + if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { $company = new Societe($db); - $result = $company->fetch($object->socid); - print ''; + print ''; } else { print ''; print ''; diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 2f897556d5c..d512abb2eea 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -32,4 +32,4 @@ DONATION_ART238=Show article 238 from CGI if you are concerned DONATION_ART885=Show article 885 from CGI if you are concerned DonationPayment=Donation payment DonationValidated=Donation %s validated -DonationUseThirdparties=Ask a thirdparty on each donation record +DonationUseThirdparties=Use an existing thirdparty as coordinates of donators From 5cddd0465c4dfd6089154ea4224398fe046e4133 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 13:25:54 +0100 Subject: [PATCH 15/18] Fix trans --- htdocs/langs/en_US/dict.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index ec315d97142..0524cf1ca18 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -21,7 +21,7 @@ CountryNL=Netherlands CountryHU=Hungary CountryRU=Russia CountrySE=Sweden -CountryCI=Ivoiry Coast +CountryCI=Ivory Coast CountrySN=Senegal CountryAR=Argentina CountryCM=Cameroon From bc5c762b8f4a20ae65d7e44d8a8a47e8e7b6452e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 21:00:44 +0100 Subject: [PATCH 16/18] Add DCO file. --- DCO | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 DCO diff --git a/DCO b/DCO new file mode 100644 index 00000000000..aefad374602 --- /dev/null +++ b/DCO @@ -0,0 +1,34 @@ +Developer Certificate of Origin +Version 1.1 + +Copyright (C) 2002 - Today The Dolibarr team and its contributors. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + + +Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. From b2cb087013915b04059e0b3efd6f8e0351e7ba3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 21:01:07 +0100 Subject: [PATCH 17/18] Add DCO file. --- DCO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DCO b/DCO index aefad374602..d54f007a8c5 100644 --- a/DCO +++ b/DCO @@ -1,7 +1,7 @@ Developer Certificate of Origin Version 1.1 -Copyright (C) 2002 - Today The Dolibarr team and its contributors. +Copyright (C) 2002 - Today, The Dolibarr team and its contributors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. From d4512c48cde579cc6ebab8ed2ffd7b75e3fa9fcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 21:11:55 +0100 Subject: [PATCH 18/18] Fix regression --- htdocs/public/payment/newpayment.php | 134 +++------------------------ 1 file changed, 14 insertions(+), 120 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 85ad11bb74b..16cea8746c3 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -914,13 +914,9 @@ if ($source == 'order') { if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment $amount = $order->total_ttc; -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } -======= - if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git $amount = price2num($amount); } @@ -969,14 +965,8 @@ if ($source == 'order') { print ' ('.$langs->trans("ToComplete").')'; } print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); + print '
'; From 0d954cb1c7b995c4886d714a5ad122775ba6b6a5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Mar 2021 03:09:36 +0100 Subject: [PATCH 08/18] FIX: Total_ht not show in contract link element --- htdocs/core/class/html.form.class.php | 7 ++++++- htdocs/langs/en_US/main.lang | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 30225e45baa..b7912e93dc4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7206,7 +7206,12 @@ class Form print ''.$objp->ref.''.$objp->ref_client.''.price($objp->total_ht).''; + if ($possiblelink[label] == 'LinkToContract') { + $form = new Form($db); + print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; + } + print price($objp->total_ht).''.$objp->name.'
'; - print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).''; - $form->select_types_paiements($paymenttype, "paymenttype"); - print '
'.$langs->trans('PaymentMode').''; + $form->select_types_paiements($paymenttype, 'paymenttype', '', 2); + print "
'; if (empty($amount) || !is_numeric($amount)) { - print ''; + print ''; print ''; } else { print ''.price($amount).''; @@ -915,7 +915,7 @@ if ($source == 'order') if ($action != 'dopayment') // Do not change amount if we just click on first dopayment { $amount = $order->total_ttc; - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount); } @@ -961,7 +961,7 @@ if ($source == 'order') print ''; if (empty($amount) || !is_numeric($amount)) { - print ''; + print ''; print ''; } else { print ''.price($amount).''; @@ -1033,7 +1033,7 @@ if ($source == 'invoice') if ($action != 'dopayment') // Do not change amount if we just click on first dopayment { $amount = price2num($invoice->total_ttc - ($invoice->getSommePaiement() + $invoice->getSumCreditNotesUsed() + $invoice->getSumDepositsUsed())); - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount); } @@ -1082,7 +1082,7 @@ if ($source == 'invoice') } elseif (empty($object->paye)) { if (empty($amount) || !is_numeric($amount)) { - print ''; + print ''; print ''; } else { print ''.price($amount).''; @@ -1198,7 +1198,7 @@ if ($source == 'contractline') } } - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount); } @@ -1286,7 +1286,7 @@ if ($source == 'contractline') print ''; if (empty($amount) || !is_numeric($amount)) { - print ''; + print ''; print ''; } else { print ''.price($amount).''; @@ -1359,8 +1359,8 @@ if ($source == 'membersubscription') if ($action != 'dopayment') // Do not change amount if we just click on first dopayment { $amount = $subscription->total_ttc; - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); - $amount = price2num($amount); + if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); + $amount = price2num($amount, 'MT'); } if (GETPOST('fulltag', 'alpha')) { @@ -1448,8 +1448,8 @@ if ($source == 'membersubscription') { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); - print ''; - print ''; + print ''; + print 'global->MEMBER_NEWFORM_EDITAMOUNT)?' disabled':' ').'>'; } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); @@ -1521,7 +1521,7 @@ if ($source == 'donation') if ($action != 'dopayment') // Do not change amount if we just click on first dopayment { $amount = $subscription->total_ttc; - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount); } @@ -1587,7 +1587,7 @@ if ($source == 'donation') { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); - print ''; + print ''; print ''; } else { $valtoshow = $amount; From c80151717e242eff919672be9bc20a0f4ee9e03a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 10:45:37 +0100 Subject: [PATCH 12/18] Fix set of payment --- htdocs/public/payment/newpayment.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index bda79d7d97d..641c791f1c1 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1449,7 +1449,12 @@ if ($source == 'membersubscription') //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''; - print 'global->MEMBER_NEWFORM_EDITAMOUNT)?' disabled':' ').'>'; + if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + print ''; + print ''; + } else { + print ''; + } } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); From a68721c5b4143806fd6ad5ba7132d4caba0f09fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 10:58:06 +0100 Subject: [PATCH 13/18] Fix missing translation --- htdocs/don/admin/donation.php | 30 +++++++++++++++------------- htdocs/langs/en_US/donations.lang | 1 + htdocs/public/payment/newpayment.php | 10 ++++++++-- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 7b0896134e0..6b4588536c9 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -322,24 +322,26 @@ print ''.$langs->trans("Value")."
'; + print $langs->trans("DonationUseThirdparties"); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('DONATION_USE_THIRDPARTIES'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES); + } + print "
'; -print $form->textwithpicto($langs->trans("DonationUserThirdparties"), $langs->trans("DonationUserThirdpartiesDesc")); -print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('DONATION_USE_THIRDPARTIES'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES); -} -print "
'; $label = $langs->trans("AccountAccounting"); diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index de4bdf68f03..2f897556d5c 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -32,3 +32,4 @@ DONATION_ART238=Show article 238 from CGI if you are concerned DONATION_ART885=Show article 885 from CGI if you are concerned DonationPayment=Donation payment DonationValidated=Donation %s validated +DonationUseThirdparties=Ask a thirdparty on each donation record diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 641c791f1c1..e16355d902e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1457,7 +1457,10 @@ if ($source == 'membersubscription') } } else { $valtoshow = $amount; - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { + $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + $amount = $valtoshow; + } print ''.price($valtoshow).''; print ''; print ''; @@ -1596,7 +1599,10 @@ if ($source == 'donation') print ''; } else { $valtoshow = $amount; - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { + $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + $amount = $valtoshow; + } print ''.price($valtoshow).''; print ''; print ''; From 81f1bee10ce5e6ef224e074d24c016aefd71f03f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 11:18:14 +0100 Subject: [PATCH 14/18] Fix option DONATION_USE_THIRDPARTIES --- htdocs/don/card.php | 46 +++++++++++++++++++------------ htdocs/langs/en_US/donations.lang | 2 +- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index c55751e913f..dd7de85430e 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -44,7 +44,7 @@ if (!empty($conf->projet->enabled)) { } require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -$langs->loadLangs(array("bills", "companies", "donations")); +$langs->loadLangs(array("bills", "companies", "donations", "users")); $id = GETPOST('rowid') ?GETPOST('rowid', 'int') : GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); @@ -179,15 +179,18 @@ if ($action == 'add') $error = 0; - if (empty($donation_date)) - { + if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors'); + $action = "create"; + $error++; + } + if (empty($donation_date)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = "create"; $error++; } - if (empty($amount)) - { + if (empty($amount)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); $action = "create"; $error++; @@ -347,16 +350,16 @@ if ($action == 'create') print '
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Customer').''; + print ''.$langs->trans('ThirdParty').''; print $soc->getNomUrl(1); print ''; // Outstanding Bill @@ -372,7 +375,8 @@ if ($action == 'create') print ')'; print ''; + print ''.$langs->trans('ThirdParty').''; print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer informations. Note, this clear other input if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) @@ -389,7 +393,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '; print '
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'.$langs->trans("ThirdParty").''; + if ($object->socid > 0) { + $result = $company->fetch($object->socid); + print $company->getNomUrl(1); + } + print '
'.$langs->trans("Company").'
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'.$langs->trans("ThirdParty").''; + if ($object->socid > 0) { + $result = $company->fetch($object->socid); + print $company->getNomUrl(1); + } + print '
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("Lastname").''.$object->lastname.'
'; -<<<<<<< HEAD if (empty($amount) || !is_numeric($amount)) { - print ''; -======= - if (empty($amount) || !is_numeric($amount)) - { print ''; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git print ''; } else { print ''.price($amount).''; @@ -1048,13 +1038,9 @@ if ($source == 'invoice') { if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment $amount = price2num($invoice->total_ttc - ($invoice->getSommePaiement() + $invoice->getSumCreditNotesUsed() + $invoice->getSumDepositsUsed())); -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } -======= - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'alpha'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git $amount = price2num($amount); } @@ -1106,14 +1092,8 @@ if ($source == 'invoice') { if ($object->type == $object::TYPE_CREDIT_NOTE) { print ''.$langs->trans("CreditNote").''; } elseif (empty($object->paye)) { -<<<<<<< HEAD if (empty($amount) || !is_numeric($amount)) { - print ''; -======= - if (empty($amount) || !is_numeric($amount)) - { print ''; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git print ''; } else { print ''.price($amount).''; @@ -1224,13 +1204,9 @@ if ($source == 'contractline') { } } -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } -======= - if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git $amount = price2num($amount); } @@ -1320,14 +1296,8 @@ if ($source == 'contractline') { print ' ('.$langs->trans("ToComplete").')'; } print ''; -<<<<<<< HEAD if (empty($amount) || !is_numeric($amount)) { - print ''; -======= - if (empty($amount) || !is_numeric($amount)) - { print ''; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git print ''; } else { print ''.price($amount).''; @@ -1400,15 +1370,10 @@ if ($source == 'membersubscription') { if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment $amount = $subscription->total_ttc; -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } - $amount = price2num($amount); -======= - if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount, 'MT'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git } if (GETPOST('fulltag', 'alpha')) { @@ -1505,14 +1470,9 @@ if ($source == 'membersubscription') { } if (empty($amount) || !is_numeric($amount)) { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); -<<<<<<< HEAD if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); } - print ''; - print ''; -======= - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''; if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { print ''; @@ -1520,15 +1480,11 @@ if ($source == 'membersubscription') { } else { print ''; } ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); -<<<<<<< HEAD -======= $amount = $valtoshow; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git } print ''.price($valtoshow).''; print ''; @@ -1598,13 +1554,9 @@ if ($source == 'donation') { if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment $amount = $subscription->total_ttc; -<<<<<<< HEAD - if (GETPOST("amount", 'int')) { - $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) { + $amount = GETPOST("amount", 'alpha'); } -======= - if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git $amount = price2num($amount); } @@ -1678,24 +1630,16 @@ if ($source == 'donation') { } if (empty($amount) || !is_numeric($amount)) { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); -<<<<<<< HEAD if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); } - print ''; -======= - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git print ''; } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); -<<<<<<< HEAD -======= $amount = $valtoshow; ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git } print ''.price($valtoshow).''; print ''; @@ -2181,7 +2125,6 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme console.log("We click on buttontopay"); event.preventDefault(); -<<<<<<< HEAD if (cardholderName.value == '') { console.log("Field Card holder is empty"); @@ -2190,6 +2133,10 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme } else { + /* Disable button to pay and show hourglass cursor */ + jQuery('#hourglasstopay').show(); + jQuery('#buttontopay').hide(); + stripe.handleCardPayment( clientSecret, cardElement, { payment_method_data: { @@ -2240,59 +2187,6 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme }); } }); -======= - if (cardholderName.value == '') - { - console.log("Field Card holder is empty"); - var displayError = document.getElementById('card-errors'); - displayError.textContent = 'trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardOwner"))); ?>'; - } - else - { - /* Disable button to pay and show hourglass cursor */ - jQuery('#hourglasstopay').show(); - jQuery('#buttontopay').hide(); - - stripe.handleCardPayment( - clientSecret, cardElement, { - payment_method_data: { - billing_details: { - name: cardholderName.value - thirdparty) && !empty($object->thirdparty->email))) { ?>, email: 'thirdparty->email); ?>' - thirdparty) && !empty($object->thirdparty->phone)) { ?>, phone: 'thirdparty->phone); ?>' - thirdparty)) { ?>, address: { - city: 'thirdparty->town); ?>', - thirdparty->country_code) { ?>country: 'thirdparty->country_code); ?>', - line1: 'thirdparty->address)); ?>', - postal_code: 'thirdparty->zip); ?>' - } - - } - }, - save_payment_method: /* true when a customer was provided when creating payment intent. true ask to save the card */ - } - ).then(function(result) { - console.log(result); - if (result.error) { - console.log("Error on result of handleCardPayment"); - jQuery('#buttontopay').show(); - jQuery('#hourglasstopay').hide(); - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // The payment has succeeded. Display a success message. - console.log("No error on result of handleCardPayment, so we submit the form"); - // Submit the form - jQuery('#buttontopay').hide(); - jQuery('#hourglasstopay').show(); - // Send form (action=charge that will do nothing) - jQuery('#payment-form').submit(); - } - }); - } - }); ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git