From 57ee8b7991be9fec477cf497ec9d8b5ccfceecd7 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 24 Feb 2019 21:15:11 +0100 Subject: [PATCH 01/21] Fix no JPG images in TakePOS and other image improvements. --- htdocs/takepos/css/pos.css | 12 +++++ htdocs/takepos/genimg/add.jpg | Bin 5419 -> 0 bytes htdocs/takepos/genimg/empty.jpg | Bin 2239 -> 0 bytes htdocs/takepos/genimg/empty.png | Bin 0 -> 156 bytes htdocs/takepos/genimg/index.php | 87 +++++++++----------------------- htdocs/takepos/takepos.php | 34 ++++++++----- 6 files changed, 57 insertions(+), 76 deletions(-) delete mode 100644 htdocs/takepos/genimg/add.jpg delete mode 100644 htdocs/takepos/genimg/empty.jpg create mode 100644 htdocs/takepos/genimg/empty.png diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 87c74c8952d..cac9a23a8d9 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -110,6 +110,18 @@ div.description{ text-align:center; } +div.catwatermark{ + position:absolute; + top:3%; + left:3%; + width:20%; + background-color:black; + color:white; + text-align:center; + font-size: 20px; + display: none; +} + @media only screen and (max-aspect-ratio: 6/4) { div.description{ min-height:20%; diff --git a/htdocs/takepos/genimg/add.jpg b/htdocs/takepos/genimg/add.jpg deleted file mode 100644 index 976fd10697d47e06cc9d74f7efed36ab17d95ed7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5419 zcmeHL4OA0X7QRCW2>}g3z`xd@Kt-T>s!)GR01XNrgn$bE)KnDtJ1(^qLB$N>A7U*< zMYri9KPrf#DL*bA*117Cuv;;C3&)y~- zL^jWL(}#!$=JbnJ2Udw}f7VU?0Na`eP@0MEz;rOfFw^~GV=x(}W?^p5V6rS&ER(P; ztt{DW4x7c|4B&9Atm($G9LODDJ_g=$=LwOYrCD+u1`ioJ%;mk&u4CLhy*`{cY4VimGlc## zX9Wa?&7C(tJYvDZWy_;hM90L&eZD$zO;YmOb(=PC*}5%#d&aKad$RZL`|H=zf&&K+ z6&4*XK2la*apLcl-~Hp{`Ksy*7cYH(x#q^ry82rUw;P*U+wR?O|KUN$!%lV26U|d? zuTI}*!i53jIjk4Reuaxi<1(Yyz?@~mg_$MM!r+-RM}A;o>nma{T{URb_>F8kzpVVy zbCymMLRI#WpUF86&YrCl%>|>|Rss`|}-< zK7~>UT6PmXJH|B@QJ2HFAkfI;efT~ip&k4r;c6BFW+Z|=h13m&c3z4ILDBjnl)_!N ziC(x;ye15fO)$8faYb> zsR&%lNGYz&P8K5wa;U&GOgoX!3&Cx0)%%5k!Sw;P)k+ly&vI_2*lE{_gk` z%afEs1Qr>Rt3*YSQmoq6_TfM8C4A{1Rb(3N4%C3`KMForEdS+7d>FsATm%1X*2qd+9-LxA5{Q|M9E`)Xe4YnNKnWTKG z3Y$$zDJ+@adTq<9!yk9-2Nk((t47~_*ZHKh`C8M|+Zd@Aij88ke}6nWwXD$HGIdFugAK~%GNwc{9@V{b`wg$ zx^!A@U8gIfhxH0CWcJ4hq@*BK;E2D<3v`D2HPy%(-e|+_dO2As;l$$Q;;wx4`WK#8 zA1`k`?Y+J?U~FM!`59^R=d?HBhWe3 zBhW{Szxp3A-k|x|z)Oj*$76$U6Rq6pm1`8i6}OBVT8<5`mTq?7oqACMAHVi!$l4*U z(UCATa;@Ne4&GlF=W+91F5#c;c)aB?(KK5dPgZ!3OPO4IYLLpidxna;Gck9-!zYT4 zzJvS17Bwn@5(d>=K3w3r#VPcH$k(~mrv(?*_ZPmY-V~kr>WR37J{vq5fsxlqKgthK zPV>oPqQjTWMWC8_6hY55!Z9X~+t97sxky_`7uqZ>PVa^hG6Ywq2->_7n!cen^BYae zYrc*^;PI%(A_GXt8*klMO6E(vI_XN_lH#2d|Av(sLr}t{W=BH(UOsbk!n-9C2k#rd zI55k-{N%+E{+yw=Q!OI)2lIbh!Tz>5e|y+@d)WCy4v)o(@&@C(4Tb>8RUA%nRS*1B z!DkJp2c7lif2(TF{fNpu5|HS1I;UcddRmDz!)aEim&ZIi+c|avS?xRRus*UsR+-rk zSxJ24K75&?KgwGDDp@t$AMghmPt-3n_!*y(N9LJHx}C@GJk-)Bl2gwMV0QD=h`)>* ZyZpQCQQ^@qmB0JF|GfWsej+2(_-~uMLm2=7 diff --git a/htdocs/takepos/genimg/empty.jpg b/htdocs/takepos/genimg/empty.jpg deleted file mode 100644 index 8883f7c9957bf151875278b6ded394d9594c8b25..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2239 zcmex=}T+5Ri6|E+FFJVCMj-APxLK zz#z!MsL5!;%&5e`B*@4t$oT&VgFMistiX@}1qKu_GBLBTvH_jM#SK)jRRHLGW@aX! zV_8{%-es%>$}_MCvI;30I#U-U>$dGXcJ4ZK_{h;?$4{I*b?NeztJkjIxOwa0 zqsLF4K70P+<*SdMK7aZ8?fZ|Pzd-(CWMGDP3+^*Ce+dHp#RQB47Iu)o7@5j}m|2j8 zRnd@5$T5&Tu~1masF6d&Y2w0-2RW6EgFc8R6KQ!#m{`Vr(cu+NC|SQA-3gL@3& ruUiZ}z=X*p$SlZU&+zxpqAm@FQ9K$3qiJ9?4UDFNVV?$=|K9`vEy2T8 diff --git a/htdocs/takepos/genimg/empty.png b/htdocs/takepos/genimg/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..63163e9f86953a5a1b1ef0a16f5e8189e63b8f1e GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|!aQ9ZLn>~) qJ!r@Xfetch($id); + $upload_dir = $conf->categorie->multidir_output[$object->entity]; $pdir = get_exdir($object->id, 2, 0, 0, $object, 'category') . $object->id ."/photos/"; $dir = $upload_dir.'/'.$pdir; + foreach ($object->liste_photos($dir) as $key => $obj) - { - $filename=$obj['photo']; - } - - // The file - $filename = $dir.$filename; - if (!file_exists($filename)) $filename="empty.jpg"; - - // Dimensions - list($width, $height) = getimagesize($filename); - $new_width = $w; - $new_height = $h; - - // Resample - $image_p = imagecreatetruecolor($new_width, $new_height); - $image = imagecreatefromjpeg($filename); - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - - // Add icon - $icon = imagecreatefromjpeg('add.jpg'); - list($width, $height) = getimagesize('add.jpg'); - $new_width = $w*0.3; - $new_height = $h*0.3; - $icon_p = imagecreatetruecolor($new_width, $new_height); - imagecopyresampled($icon_p, $icon, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - imagecopymerge($image_p, $icon_p, 0, 0, 0, 0, $new_width, $new_height, 100); - - // Output - imagejpeg($image_p, null, 100); + { + if ($obj['photo_vignette']) + { + $filename=$obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } + $viewfilename=$obj['photo']; + $file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); + header('Location: '.$file); + exit; + } + header('Location: ../../public/theme/common/nophoto.png'); } elseif ($query=="pro") { @@ -89,39 +76,13 @@ elseif ($query=="pro") $objProd = new Product($db); $objProd->fetch($id); - - $dir .= get_exdir(0, 0, 0, 0, $objProd, 'product').$objProd->ref.'/'; - $pdir .= get_exdir(0, 0, 0, 0, $objProd, 'product').$objProd->ref.'/'; - - foreach ($objProd->liste_photos($dir) as $key => $obj) - { - $filename=$obj['photo']; - } - $filename = $dir.$filename; - - if (!file_exists($filename)){ - $dir = $conf->product->multidir_output[$objProd->entity].'/'.$pdir; - foreach ($objProd->liste_photos($dir) as $key => $obj) - { - $filename=$obj['photo']; - } - $filename = $dir.$filename; - } - - if (!file_exists($filename)) $filename="empty.jpg"; - - // Dimensions - list($width, $height) = getimagesize($filename); - $new_width = $w; - $new_height = $h; - - // Resample - $image_p = imagecreatetruecolor($new_width, $new_height); - $image = imagecreatefromjpeg($filename); - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - - // Output - imagejpeg($image_p, null, 100); + $image=$objProd->show_photos('product', $conf->product->multidir_output[$entity], 'small', 1); + + preg_match( '@src="([^"]+)"@' , $image, $match ); + $file = array_pop($match); + if ($file=="") header('Location: ../../public/theme/common/nophoto.png'); + else header('Location: '.$file); + } else { diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 4edab6c9bee..4b36bbbdd81 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -93,8 +93,9 @@ function PrintCategories(first){ for (i = 0; i < 14; i++) { if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined") break; $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']); - $("#catimg"+i).attr("src","genimg/?query=cat&w=55&h=50&id="+categories[parseInt(i)+parseInt(first)]['rowid']); + $("#catimg"+i).attr("src","genimg/?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']); $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']); + $("#catwatermark"+i).show(); } } @@ -117,12 +118,14 @@ function MoreCategories(moreorless){ for (i = 0; i < 14; i++) { if (typeof (categories[i+(14*pagecategories)]) == "undefined"){ $("#catdesc"+i).text(""); - $("#catimg"+i).attr("src",""); + $("#catimg"+i).attr("src","genimg/empty.png"); + $("#catwatermark"+i).hide(); continue; } $("#catdesc"+i).text(categories[i+(14*pagecategories)]['label']); - $("#catimg"+i).attr("src","genimg/?query=cat&w=55&h=50&id="+categories[i+(14*pagecategories)]['rowid']); + $("#catimg"+i).attr("src","genimg/?query=cat&id="+categories[i+(14*pagecategories)]['rowid']); $("#catdiv"+i).data("rowid",categories[i+(14*pagecategories)]['rowid']); + $("#catwatermark"+i).show(); } } @@ -131,16 +134,17 @@ function LoadProducts(position, issubcat=false){ $('#catimg'+position).animate({opacity: '1'}, 100); if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid'); else currentcat=$('#catdiv'+position).data('rowid'); - if (currentcat=="") return; + if (currentcat==undefined) return; pageproducts=0; ishow=0; //product to show counter jQuery.each(subcategories, function(i, val) { if (currentcat==val.fk_parent){ $("#prodesc"+ishow).text(val.label); - $("#proimg"+ishow).attr("src","genimg/?query=cat&w=55&h=50&id="+val.rowid); + $("#proimg"+ishow).attr("src","genimg/?query=cat&id="+val.rowid); $("#prodiv"+ishow).data("rowid",val.rowid); $("#prodiv"+ishow).data("iscat",1); + $("#prowatermark"+ishow).show(); ishow++; } }); @@ -150,18 +154,19 @@ function LoadProducts(position, issubcat=false){ while (idata < 30 && ishow < 30) { if (typeof (data[idata]) == "undefined") { $("#prodesc"+ishow).text(""); - $("#proimg"+ishow).attr("src",""); + $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); - $("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']); + $("#proimg"+ishow).attr("src","genimg/?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); ishow++; //Next product to show after print data product } + $("#prowatermark"+ishow).hide(); idata++; //Next data everytime } }); @@ -189,18 +194,19 @@ function MoreProducts(moreorless){ while (idata < (30*pageproducts)+30) { if (typeof (data[idata]) == "undefined") { $("#prodesc"+ishow).text(""); - $("#proimg"+ishow).attr("src",""); + $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); - $("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']); + $("#proimg"+ishow).attr("src","genimg/?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); ishow++; //Next product to show after print data product } + $("#prowatermark"+ishow).hide(); idata++; //Next data everytime } }); @@ -261,12 +267,12 @@ function Search2(){ for (i = 0; i < 30; i++) { if (typeof (data[i]) == "undefined"){ $("#prodesc"+i).text(""); - $("#proimg"+i).attr("src",""); + $("#proimg"+i).attr("src","genimg/empty.png"); $("#prodiv"+i).data("rowid",""); continue; } $("#prodesc"+i).text(data[parseInt(i)]['label']); - $("#proimg"+i).attr("src","genimg/?query=pro&w=55&h=50&id="+data[i]['rowid']); + $("#proimg"+i).attr("src","genimg/?query=pro&id="+data[i]['rowid']); $("#prodiv"+i).data("rowid",data[i]['rowid']); $("#prodiv"+i).data("iscat",0); } @@ -491,10 +497,11 @@ foreach($menus as $menu) { { ?>
id='catdiv'> - width="98%" id='catimg'/> + width="100%" height="85%" id='catimg'/>
+
+
onclick="MoreProducts('less');" onclick="MoreProducts('more');" > - width="95%" id='proimg'/> + width="100%" height="85%" id='proimg'/>
+
+
Date: Sun, 24 Feb 2019 23:40:32 +0100 Subject: [PATCH 02/21] phpcs fix --- htdocs/datapolicy/class/datapolicy.class.php | 92 ++++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index b3cb0ce3cd9..b9ff3e8b6bd 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -219,68 +219,68 @@ Class DataPolicy */ function sendMailDataPolicyCompany($societe) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $societe->email; + $sendto = $societe->email; - $code= md5($societe->email); - if (!empty($societe->default_lang)) { - $l = $societe->default_lang; - } else { - $l = $langs->defaultlang; - } - $s = "DATAPOLICIESSUBJECT_" . $l; - $ma = "DATAPOLICIESCONTENT_" . $l; - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $code= md5($societe->email); + if (!empty($societe->default_lang)) { + $l = $societe->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( + $substitutionarray = array( '__LINKACCEPT__' => ''.$linka.'', '__LINKREFUSED__' => ''.$linkr.'', - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) { - $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) { + $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); } $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg .= dol_concatdesc($actionmsg, $message); } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { - $resultmasssend .= '
' . $mailfile->error . '
'; - } else { - $result4 = $mailfile->sendfile(); + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); - if (!$error) { - $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; - $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $societe->update($societe->id); - } else { - dol_print_error($db); - } - } - setEventMessage($resultmasssend); + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); + $societe->update($societe->id); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); } /** From dde18e803dd692d361002b2ab958ffc6a7c4644c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 15:09:56 +0100 Subject: [PATCH 03/21] Fix transaction --- .../facture/class/api_invoices.class.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index afecfd33b45..9bbb155eb60 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -372,7 +372,7 @@ class Invoices extends DolibarrApi throw new RestException(304, $this->invoice->error); } } - + /** * Add a contact type of given invoice * @@ -939,9 +939,8 @@ class Invoices extends DolibarrApi if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); } - - $this->db->begin(); - + + $result = $this->invoice->fetch($id); if( ! $result ) { throw new RestException(404, 'Invoice not found'); @@ -958,8 +957,12 @@ class Invoices extends DolibarrApi if (! $this->invoice->paye) // protection against multiple submit { + $this->db->begin(); + $this->invoice->fetch_lines(); - + + $amount_ht = $amount_tva = $amount_ttc = array(); + // Loop on each vat rate $i=0; foreach($this->invoice->lines as $line) @@ -1009,14 +1012,14 @@ class Invoices extends DolibarrApi } else { - throw new RestException(500, 'Could not set paid'); - $this->db->rollback(); + $this->db->rollback(); + throw new RestException(500, 'Could not set paid'); } } else { - throw new RestException(500, 'Discount creation error'); - $this->db->rollback(); + $this->db->rollback(); + throw new RestException(500, 'Discount creation error'); } } From 8234c094124be615378169927406e50934bac647 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 15:15:17 +0100 Subject: [PATCH 04/21] Try some fixes --- htdocs/stripe/class/stripe.class.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 8cc5b0218b1..646e5c19b12 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -243,13 +243,13 @@ class Stripe extends CommonObject /** * Get the Stripe payment intent * - * @param Societe $object Object tp pay on Stripe - * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() - * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect - * @param int $status Status (0=test, 1=live) - * @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email fpr receipt - * @param int $mode automatic=automatic payment, manual=need confirmation - * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found + * @param Societe $object Object to pay with Stripe + * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() + * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect + * @param int $status Status (0=test, 1=live) + * @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email for receipt + * @param int $mode automatic=automatic payment, manual=need confirmation + * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found */ public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic') { @@ -284,7 +284,7 @@ class Stripe extends CommonObject $obj = $this->db->fetch_object($resql); $intent = $obj->ext_payment_id; - dol_syslog(get_class($this) . "::customerStripe found stripe customer key_account = ".$tiers); + dol_syslog(get_class($this) . "::customerStripe found record"); // Force to use the correct API key global $stripearrayofkeysbyenv; @@ -308,7 +308,7 @@ class Stripe extends CommonObject if (! in_array($object->multicurrency_code, $arrayzerounitcurrency)) $stripeamount=$object->multicurrency_total_ttc * 100; else $stripeamount = $object->multicurrency_total_ttc; - $fee = round(($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); + $fee = round(($object->total_ttc * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); if ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100); } @@ -328,9 +328,9 @@ class Stripe extends CommonObject { $dataforintent["application_fee"] = $fee; } - if ($societe->email && $usethirdpartyemailforreceiptemail) + if ($usethirdpartyemailforreceiptemail && $object->thirdparty->email) { - $dataforintent["receipt_email"] = $societe->email; + $dataforintent["receipt_email"] = $object->thirdparty->email; } try { From 5ffc1822d92825988192c053ee02bd1b535b3fc0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 19:01:51 +0100 Subject: [PATCH 05/21] Translation --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8b3a5a6600b..a54ba98a7e5 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -150,7 +150,7 @@ ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal ACCOUNTING_SOCIAL_JOURNAL=Social journal ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal -ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transfer +ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of bank transfer ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions From 25d277acebdab803abbefb88842d578cfc28c112 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 19:02:41 +0100 Subject: [PATCH 06/21] More complete translation --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index a54ba98a7e5..e613d38ab05 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -150,7 +150,7 @@ ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal ACCOUNTING_SOCIAL_JOURNAL=Social journal ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal -ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of bank transfer +ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transitional bank transfer ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions From fc1d0b2dd5a13d1982772e4ebeeff5292f5e9343 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 19:07:29 +0100 Subject: [PATCH 07/21] Add missing translation --- htdocs/langs/en_US/accountancy.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index e613d38ab05..472e2166f6b 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -207,6 +207,7 @@ DescThirdPartyReport=Consult here the list of third-party customers and vendors ListAccounts=List of the accounting accounts UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error +ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service From f6fc9190f373c14ad4f5bcf60ff2d4f83c44c870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Mon, 25 Feb 2019 19:41:40 +0100 Subject: [PATCH 08/21] Add no_email field in contact list Add no_email field in contact list --- htdocs/contact/list.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index aa27e43ee71..783c887efda 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -10,6 +10,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Josep Lluís Amador * * 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 @@ -68,6 +69,7 @@ $search_phone_pro=GETPOST("search_phone_pro", 'alpha'); $search_phone_mobile=GETPOST("search_phone_mobile", 'alpha'); $search_fax=GETPOST("search_fax", 'alpha'); $search_email=GETPOST("search_email", 'alpha'); +$search_no_email=GETPOST("search_no_email",'int'); $search_skype=GETPOST("search_skype", 'alpha'); $search_twitter=GETPOST("search_twitter", 'alpha'); $search_facebook=GETPOST("search_facebook", 'alpha'); @@ -159,6 +161,7 @@ $arrayfields=array( 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1), 'p.fax'=>array('label'=>"Fax", 'checked'=>0), 'p.email'=>array('label'=>"EMail", 'checked'=>1), + 'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(! empty($conf->mailing->enabled))), 'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), @@ -222,6 +225,7 @@ if (empty($reshook)) $search_phone_mobile=""; $search_fax=""; $search_email=""; + $search_no_email=-1; $search_skype=""; $search_twitter=""; $search_facebook=""; @@ -258,7 +262,7 @@ $contactstatic=new Contact($db); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $sql = "SELECT s.rowid as socid, s.nom as name,"; -$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,"; +$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email, p.skype,"; $sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; $sql.= " co.code as country_code"; // Add fields from extrafields @@ -325,6 +329,7 @@ if (strlen($search_email)) $sql.= natural_search('p.email', $search_ema if (strlen($search_zip)) $sql.= natural_search("p.zip", $search_zip); if (strlen($search_town)) $sql.= natural_search("p.town", $search_town); +if ($search_no_email != '' && $search_no_email >= 0) $sql.= " AND p.no_email = ".$db->escape($search_no_email); if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status); if ($search_import_key) $sql.= natural_search("p.import_key", $search_import_key); if ($type == "o") // filtre sur type @@ -422,6 +427,7 @@ if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($sea if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($search_phone_mobile); if ($search_fax != '') $param.='&search_fax='.urlencode($search_fax); if ($search_email != '') $param.='&search_email='.urlencode($search_email); +if ($search_no_email != '') $param.='&search_no_email='.urlencode($search_no_email); if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key); @@ -607,6 +613,12 @@ if (! empty($arrayfields['p.email']['checked'])) print ''; print ''; } +if (! empty($arrayfields['p.no_email']['checked'])) +{ + print ''; + print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'),'1'=>$langs->trans('Yes')),$search_no_email); + print ''; +} if (! empty($arrayfields['p.skype']['checked'])) { print ''; @@ -696,6 +708,7 @@ if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'],$_SERVER["PHP_SELF"],"p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder); @@ -839,7 +852,12 @@ while ($i < min($num, $limit)) print ''.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18).''; if (! $i) $totalarray['nbfield']++; } - + // No EMail + if (! empty($arrayfields['p.no_email']['checked'])) + { + print ''.yn($obj->no_email).''; + if (! $i) $totalarray['nbfield']++; + } // Skype if (! empty($arrayfields['p.skype']['checked'])) { From 1e6ed94c5ea09efede8448a288a009f7da1e9c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Feb 2019 21:39:45 +0100 Subject: [PATCH 09/21] Update extrafields.class.php The property $errno was declared of type integer, but $this->db->lasterrno() is of type string --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 0ef7f8d295b..c23f40a0283 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -148,7 +148,7 @@ class ExtraFields public $errors = array(); /** - * @var integer DB Error number + * @var string DB Error number */ public $errno; From 528bfca690cc6fbf9986a97b1ee411c25cc93bef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Feb 2019 11:44:16 +0100 Subject: [PATCH 10/21] Fix preselection when key is '0' --- 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 2fb4e4ca228..0f8969cdace 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6178,7 +6178,7 @@ class Form foreach ($array as $key => $value) { $out.= '