diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 6ff9a5087f6..26ac9e8930f 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -506,7 +506,8 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) /** * Create a thumbnail from an image file (Supported extensions are gif, jpg, png and bmp). - * If file is myfile.jpg, new file may be myfile_small.jpg + * If file is myfile.jpg, new file may be myfile_small.jpg. But extension may differs if original file has a format and an extension + * of another one, like a.jpg file when real format is png. * * @param string $file Path of source file to resize * @param int $maxWidth Maximum width of the thumbnail (-1=unchanged, 160 by default) @@ -514,7 +515,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) * @param string $extName Extension to differentiate thumb file name ('_small', '_mini') * @param int $quality Quality of compression (0=worst, 100=best) * @param string $outdir Directory where to store thumb - * @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep old format) + * @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep original format) * @return string|int<0,0> Full path of thumb or '' if it fails or 'Error...' if it fails, or 0 if it fails to detect the type of image */ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $quality = 50, $outdir = 'thumbs', $targetformat = 0) @@ -551,9 +552,9 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image - $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image - $imgWidth = $infoImg[0]; // Largeur de l'image - $imgHeight = $infoImg[1]; // Hauteur de l'image + $infoImg = getimagesize($filetoread); // Get information like size and real format of image. Warning real format may be png when extension is .jpg + $imgWidth = $infoImg[0]; // Width of image + $imgHeight = $infoImg[1]; // Height of image $ort = false; if (function_exists('exif_read_data')) { diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index b839978b0a9..1f4dea08683 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -304,6 +304,7 @@ lastUpdate=Last update contactSupport=How to contact support noProductToDisplay=Error, No product to display yourCompanyInformation=Your company information +yourBillingInformation=Your billing information emailAlreadyRegistered=This email is already registered. firstnameContainsLettersOnly=Firstname must contain letters and spaces only lastnameContainsLettersOnly=Lastname must contain letters and spaces only @@ -360,6 +361,6 @@ LoginCheckout=Login & Proceed to checkout paymentSuccessProcessed=Your payment has been successfully processed. youWillBeRedirectedToOrderPage=You will be redirected to the order details page shortly. WebPortalSetupNotComplete=Web portal setup is not complete -DeleteWebsiteaccount=Delete website account +DeleteWebsiteAccount=Delete website account ConfirmDeleteWebsiteAccount=Are you sure you want to delete this account. ConfirmDeleteWebsiteAccount2=If this account was used to login on the public portal or any otherweb site powered by Dolibarr, the login may be no more possible. diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index add72341158..2a6447d6ca1 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -269,7 +269,6 @@ class SocieteAccount extends CommonObject */ public function createFromClone(User $user, $fromid) { - global $hookmanager, $langs; $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -345,18 +344,25 @@ class SocieteAccount extends CommonObject * * @param int $id Id of third party * @param string $site Site (example: 'stripe', '...') - * @param int $status Status (0=test, 1=live) + * @param int $status Status (0=test, 1=live, -1=we don't mind) * @param string $site_account Value to use to identify with account to use on site when site can offer several accounts. For example: 'pk_live_123456' when using Stripe service. + * @param string $fk_website Id website * @return string Stripe customer ref 'cu_xxxxxxxxxxxxx' or '' * @see getThirdPartyID() */ - public function getCustomerAccount($id, $site, $status = 0, $site_account = '') + public function getCustomerAccount($id, $site, $status = 0, $site_account = '', $fk_website = 0) { $sql = "SELECT sa.key_account as key_account, sa.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_account as sa"; $sql .= " WHERE sa.fk_soc = ".((int) $id); $sql .= " AND sa.entity IN (".getEntity('societe').")"; - $sql .= " AND sa.site = '".$this->db->escape($site)."' AND sa.status = ".((int) $status); + $sql .= " AND sa.site = '".$this->db->escape($site)."'"; + if ($fk_website > 0) { + $sql .= " AND sa.fk_website = ".((int) $fk_website); + } + if ($status >= 0) { + $sql .= " AND sa.status = ".((int) $status); + } $sql .= " AND sa.key_account IS NOT NULL AND sa.key_account <> ''"; $sql .= " AND (sa.site_account = '' OR sa.site_account IS NULL OR sa.site_account = '".$this->db->escape($site_account)."')"; $sql .= " ORDER BY sa.site_account DESC, sa.rowid DESC"; // To get the entry with a site_account defined in priority @@ -442,7 +448,7 @@ class SocieteAccount extends CommonObject */ public function getTooltipContentArray($params) { - global $langs, $user; + global $langs; $langs->loadLangs(['companies, commercial', 'website']); @@ -467,7 +473,7 @@ class SocieteAccount extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { - global $db, $conf, $langs; + global $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index edd8ff48472..61fadf541b6 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -629,12 +629,22 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac if ($action == 'editaccountancycodeusergeneral' && $user->hasRight('user', 'user', 'creer')) { print $formaccounting->formAccountingAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->accountancy_code_user_general, 'accountancycodeusergeneral', 0, 1, '', 1); } else { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch(0, $object->accountancy_code_user_general, 1); - print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + if (!empty($object->accountancy_code_user_general) && $object->accountancy_code_user_general != '-1') { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(0, $object->accountancy_code_user_general, 1); + print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + } } - $accountingAccountByDefault = " (" . $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT')) . ")"; + print ''; + if (!empty($object->accountancy_code_user_general) && $object->accountancy_code_user_general != '-1') { + print ' ('; + } + $accountingAccountByDefault = $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT')); print (getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') ? $accountingAccountByDefault : ''); + if (!empty($object->accountancy_code_user_general) && $object->accountancy_code_user_general != '-1') { + print ')'; + } + print ''; print ''; // Accountancy code