diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index c37587dadc3e5..aa17090174e18 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -562,9 +562,9 @@ $resultmid = $db->query($sqlmid); if ($resultmid) { $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_account_capital] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_capital]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_capital] - $objmid->amount_capital : $amounttouse; - $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_insurance]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] - $objmid->amount_insurance : $amounttouse; - $tabtp[$obj->rowid][$objmid->accountancy_account_interest] = isset($tabtp[$obj->rowid][$objmid->accountancy_account_interest]) ? $tabtp[$obj->rowid][$objmid->accountancy_account_interest] - $objmid->amount_interes : $amounttouse; + $tabtp[$obj->rowid][$objmid->accountancy_account_capital] = isset($objmid->amount_capital) ? $tabtp[$obj->rowid][$objmid->accountancy_account_capital] - $objmid->amount_capital : 0; + $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] = isset($objmid->amount_insurance) ? $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] - $objmid->amount_insurance : 0; + $tabtp[$obj->rowid][$objmid->accountancy_account_interest] = isset($objmid->amount_interest) ? $tabtp[$obj->rowid][$objmid->accountancy_account_interest] - $objmid->amount_interest : 0; } } elseif ($links[$key]['type'] == 'banktransfert') { $accountLinestatic->fetch($links[$key]['url_id']); diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index e5bf314225909..c25d024099548 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -413,7 +413,7 @@ } else { $keyforprovider = ''; } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; if (!empty($supportedoauth2array)) { diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 88cd966913045..6f96506cc3130 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2024 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011-2023 Juanjo Menent @@ -277,6 +277,30 @@ } } + /* + if (!$error) { + if (GETPOST('checkforcompliance')) { + $dir = $dirins; + $file = $modulenameval; + // $installedmodule + try { + $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. + $modName = substr($file, 0, dol_strlen($file) - 10); + if ($modName) { + if (class_exists($modName)) { + $objMod = new $modName($db); + '@phan-var-force DolibarrModules $objMod'; + + //var_dump($objMod); + } + } + } catch(Exception $e) { + // Nothing done + } + } + } + */ + if (!$error) { $message = $langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")); setEventMessages($message, null, 'warnings'); @@ -861,7 +885,7 @@ || getDolGlobalString('CHECKLASTVERSION_EXTERNALMODULE') ) ) { - $checkRes = $objMod->checkForUpdate(); + $checkRes = $objMod->checkForUpdate(); // Check for update version if ($checkRes > 0) { setEventMessages($objMod->getName().' : '.preg_replace('/[^a-z0-9_\.\-\s]/i', '', $versiontrans).' -> '.preg_replace('/[^a-z0-9_\.\-\s]/i', '', $objMod->lastVersion), null, 'mesgs'); } elseif ($checkRes < 0) { @@ -869,6 +893,14 @@ } } + if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { + $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law + if (!is_numeric($checkRes) && $checkRes != '') { + $langs->load("errors"); + setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors'); + } + } + // Define imginfo $imginfo = "info"; if ($objMod->isCoreOrExternalModule() == 'external') { @@ -1331,7 +1363,7 @@ $(document).ready(function() { jQuery("#fileinstall").on("change", function() { if(this.files[0].size > '.($maxmin * 1024).') { - alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'"); + alert("'.dol_escape_js($langs->transnoentitiesnoconv("ErrorFileSizeTooLarge")).'"); this.value = ""; } }); diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 08f98cebad58f..8471f14da08d0 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; use OAuth\Common\Storage\DoliStorage; +use OAuth\Common\Consumer\Credentials; $supportedoauth2array = getSupportedOauth2Array(); @@ -114,6 +115,101 @@ $action = ''; } +// Test a refresh of a token using the refresh token +if ($action == 'refreshtoken' && $user->admin) { + $keyforprovider = GETPOST('keyforprovider'); + $OAUTH_SERVICENAME = GETPOST('service'); + + // Show value of token + $tokenobj = null; + // Load OAUth libraries + require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; + + $keyforsupportedoauth2array = $OAUTH_SERVICENAME; + if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { + $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); + } else { + $keyforprovider = ''; + } + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); + $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; + + $keyforparamtenant = 'OAUTH_'.strtoupper(empty($supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']).($keyforprovider ? '-'.$keyforprovider : '').'_TENANT'; + + // Dolibarr storage + $storage = new DoliStorage($db, $conf, $keyforprovider, getDolGlobalString($keyforparamtenant)); + try { + // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' + print ''."\n"; + + dol_syslog("oauthlogintokens.php: Read token for service ".$OAUTH_SERVICENAME); + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + + $expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30)); + // We have to save the refresh token in a memory variable because Google give it only once + $refreshtoken = $tokenobj->getRefreshToken(); + print ''; + + //print $tokenobj->getExtraParams()['id_token'].'
'; + //print $tokenobj->getAccessToken().'
'; + //print $tokenobj->getRefreshToken().'
'; + + //var_dump($expire); + + // We do the refresh even if not expired, this is the goal of action. + $oauthname = explode('-', $OAUTH_SERVICENAME); + $keyforoauthservice = strtoupper($oauthname[0]).(empty($oauthname[1]) ? '' : '-'.$oauthname[1]); + $credentials = new Credentials( + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_ID'), + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_SECRET'), + getDolGlobalString('OAUTH_'.$keyforoauthservice.'_URLCALLBACK') + ); + + $serviceFactory = new \OAuth\ServiceFactory(); + $httpClient = new \OAuth\Common\Http\Client\CurlClient(); + // TODO Set options for proxy and timeout + // $params=array('CURLXXX'=>value, ...) + //$httpClient->setCurlParameters($params); + $serviceFactory->setHttpClient($httpClient); + + $scopes = array(); + if (preg_match('/^Microsoft/', $OAUTH_SERVICENAME)) { + //$extraparams = $tokenobj->getExtraParams(); + $tmp = explode('-', $OAUTH_SERVICENAME); + $scopes = explode(',', getDolGlobalString('OAUTH_'.strtoupper($tmp[0]).(empty($tmp[1]) ? '' : '-'.$tmp[1]).'_SCOPE')); + } + + // ex service is Google-Emails we need only the first part Google + $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, $scopes); + + if ($apiService instanceof OAuth\OAuth2\Service\AbstractService || $apiService instanceof OAuth\OAuth1\Service\AbstractService) { + // ServiceInterface does not provide refreshAccessToekn, AbstractService does + dol_syslog("oauthlogintokens.php: call refreshAccessToken to get the new access token"); + $tokenobj = $apiService->refreshAccessToken($tokenobj); // This call refresh and store the new token (but does not include the refresh token) + + dol_syslog("oauthlogintokens.php: call setRefreshToken"); + $tokenobj->setRefreshToken($refreshtoken); // Restore the refresh token + + dol_syslog("oauthlogintokens.php: call storeAccessToken to save the new access token + the old refresh token"); + $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); // This save the new token including the refresh token + + if ($expire) { + setEventMessages($langs->trans("OldTokenWasExpiredItHasBeenRefresh"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("OldTokenWasNotExpiredButItHasBeenRefresh"), null, 'mesgs'); + } + } else { + dol_print_error($db, 'apiService is not a correct OAUTH2 Abstract service'); + } + + dol_syslog("oauthlogintokens.php: Read token again for service ".$OAUTH_SERVICENAME); + $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + } catch (Exception $e) { + // Return an error if token not found + print $e->getMessage(); + } +} + /* * View @@ -176,7 +272,7 @@ $keybeforeprovider = $keyforsupportedoauth2array; $keyforprovider = ''; } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; $nameofservice = ucfirst(strtolower(empty($supportedoauth2array[$keyforsupportedoauth2array]['callbackfile']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'])); @@ -191,6 +287,8 @@ } $state = $shortscope; // TODO USe a better state + $urltorefresh = $_SERVER["PHP_SELF"].'?action=refreshtoken&token='.newToken(); + // Define $urltorenew, $urltodelete, $urltocheckperms if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') { // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). @@ -220,6 +318,9 @@ if ($urltorenew) { $urltorenew .= '&keyforprovider='.urlencode($keyforprovider); } + if ($urltorefresh) { + $urltorefresh .= '&keyforprovider='.urlencode($keyforprovider).'&service='.urlencode($OAUTH_SERVICENAME); + } if ($urltodelete) { $urltodelete .= '&keyforprovider='.urlencode($keyforprovider); } @@ -234,6 +335,7 @@ // $OAUTH_SERVICENAME is for example 'Google-keyforprovider' print ''."\n"; $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); + print ''; //print $storage->token.'
'; //print $tokenobj->getExtraParams()['id_token'].'
'; //print $tokenobj->getAccessToken().'
'; @@ -348,6 +450,11 @@ print $form->textwithpicto('', $langs->trans('RequestAccess')); print '
'; } + // Request remote token + if ($urltorefresh && $refreshtoken) { + print ''.$langs->trans('RefreshToken').''; + } + // Check remote access if ($urltocheckperms) { print '
'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 539aec3b8dda4..ac96a98483c82 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -356,7 +356,7 @@ } if (!$error) { - // Initialisation object actioncomm + // Initialisation of object actioncomm $object->priority = GETPOSTISSET("priority") ? GETPOSTINT("priority") : 0; $object->fulldayevent = ($fulldayevent ? 1 : 0); $object->location = GETPOST("location", 'alphanohtml'); @@ -365,11 +365,15 @@ if (GETPOST("elementtype", 'alpha')) { $elProp = getElementProperties(GETPOST("elementtype", 'alpha')); $modulecodetouseforpermissioncheck = $elProp['module']; + $submodulecodetouseforpermissioncheck = $elProp['subelement']; $hasPermissionOnLinkedObject = 0; if ($user->hasRight($modulecodetouseforpermissioncheck, 'read')) { $hasPermissionOnLinkedObject = 1; + } elseif ($user->hasRight($modulecodetouseforpermissioncheck, $submodulecodetouseforpermissioncheck, 'read')) { + $hasPermissionOnLinkedObject = 1; } + if ($hasPermissionOnLinkedObject) { $object->fk_element = GETPOSTINT("fk_element"); $object->elementtype = GETPOST("elementtype", 'alpha'); @@ -430,7 +434,9 @@ $object->note_private = trim(GETPOST("note", "restricthtml")); if (GETPOSTISSET("contactid")) { - $object->contact = $contact; + $object->contact_id = GETPOSTINT("contactid"); + + $object->contact = $contact; // For backward compatibility } if (GETPOSTINT('socid') > 0) { diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index ec3c9a38e42dc..634d4624ca919 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -151,7 +151,6 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (empty($reshook)) { $backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php'; @@ -1669,7 +1668,20 @@ $result = $object->set_demand_reason($user, GETPOSTINT('demand_reason_id')); } elseif ($action == 'setconditions' && $usercancreate) { // Terms of payment - $result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTINT('cond_reglement_id_deposit_percent')); + $sql = "SELECT code "; + $sql .= "FROM " . $db->prefix() . "c_payment_term"; + $sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int')); + $result = $db->query($sql); + if ($result) { + $obj = $db->fetch_object($result); + if ($obj->code == 'DEP30PCTDEL') { + $result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTFLOAT('cond_reglement_id_deposit_percent')); + } else { + $object->deposit_percent = 0; + $object->update($user); + $result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), $object->deposit_percent); + } + } //} elseif ($action == 'setremisepercent' && $usercancreate) { // $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2)); //} elseif ($action == 'setremiseabsolue' && $usercancreate) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 69c0204929bf8..1cd7f22552e02 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -561,7 +561,7 @@ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $sql = 'SELECT'; -if ($search_all > 0) { +if ($search_all !== '') { $sql = 'SELECT DISTINCT'; } $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax , s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index a9283c8bd1880..7f2e193eaf650 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2720,7 +2720,7 @@ $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel']; } if ($reliquat > $generic_product->stock_reel) { @@ -2778,21 +2778,6 @@ } } } - - // Call Hook modifyTextInfo - $parameters = array('textinfo' => $text_info); - $reshook = $hookmanager->executeHooks('modifyTextInfo', $parameters, $object, $action); - if ($reshook == 1) { - // for add information - $text_info .= $hookmanager->resPrint; - } elseif ($reshook == 0) { - // for replace information - $text_info = $hookmanager->resPrint; - } elseif ($reshook == -1) { - // for errors - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } - if ($notshippable == 0) { $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft'); $text_info = $text_icon.' '.$langs->trans('Shippable').'
'.$text_info; diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 9d9845532df69..aa059a02bbfbd 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -2110,7 +2110,7 @@ $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { $generic_product->stock_reel = $productstat_cache[$obj->fk_product]['stock_reel']; - $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel']; } if ($reliquat > $generic_product->stock_reel) { diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 3c5b4534a1158..5f853b553bde6 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -1,13 +1,13 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2014-2017 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Marcos García - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2022 Charlene Benke +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2014-2024 Alexandre Spangaro + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Marcos García + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2022 Charlene Benke * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -950,7 +950,7 @@ // Ref print ''.$langs->trans("Ref").''; - print ''; + print ''; // Label print ''.$langs->trans("Label").''; diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 663eef6f6f391..1726f6395a730 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -159,6 +159,8 @@ public function post($request_data = null) $result = $this->_validate($request_data); $account = new Account($this->db); + // Date of the initial balance (required to create an account). + $account->date_solde = time(); foreach ($request_data as $field => $value) { if ($field === 'caller') { // Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller @@ -168,8 +170,6 @@ public function post($request_data = null) $account->$field = $this->_checkValForAPI($field, $value, $account); } - // Date of the initial balance (required to create an account). - $account->date_solde = time(); // courant and type are the same thing but the one used when // creating an account is courant $account->courant = $account->type; // deprecated diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 5f7273fd6ef86..d3ba89dd3c384 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1366,6 +1366,14 @@ public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidat $facture->multicurrency_tx = $facturerec->multicurrency_tx; } + if (isset($facture->array_options) && isset($facturerec->array_options)) { + foreach ($facturerec->array_options as $key => $value) { + if (isset($facture->array_options[$key])) { + $facture->array_options[$key] = $value; + } + } + } + $invoiceidgenerated = $facture->create($user); if ($invoiceidgenerated <= 0) { $this->errors = $facture->errors; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 9af72aa1a1fa0..4c997d5b9ad43 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -144,6 +144,7 @@ if ($action == 'create' && GETPOSTINT("accountid") > 0 && $user->hasRight('banque', 'cheque')) { if (GETPOSTISARRAY('toRemise')) { $object->type = $type; + $object->date_bordereau = dol_now(); $arrayofid = GETPOST('toRemise', 'array:int'); $result = $object->create($user, GETPOSTINT("accountid"), 0, $arrayofid); @@ -168,6 +169,7 @@ exit; } else { setEventMessages($object->error, $object->errors, 'errors'); + $action = 'new'; } } else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs'); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 70274fd13c360..1b091ec27b634 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -345,7 +345,7 @@ public function delete($user) */ public function validate($user) { - global $langs, $conf; + global $conf; $this->errno = 0; @@ -357,7 +357,7 @@ public function validate($user) $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " SET statut = 1, ref = '".$this->db->escape($numref)."'"; $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); $sql .= " AND statut = 0"; dol_syslog("RemiseCheque::Validate", LOG_DEBUG); @@ -368,13 +368,15 @@ public function validate($user) if ($num == 1) { $this->ref = $numref; $this->statut = 1; + $this->status = 1; } else { $this->errno = -1029; - dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); + dol_syslog("Remisecheque::validate Error ".$this->errno, LOG_ERR); } } else { $this->errno = -1033; - dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); + $this->error = $this->db->lasterror(); + dol_syslog("Remisecheque::validate Error ".$this->errno, LOG_ERR); } } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 430c477e89a35..abc8f7e2a4995 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -1690,6 +1690,7 @@ public function buildEPCQrCodeString() // Add the amount and reference $lines[] = 'EUR' . $totalTTCString; // Amount (optional) + $lines[] = ''; // Purpose (optional) $lines[] = ''; // Payment reference (optional) $lines[] = $this->ref; // Remittance Information (optional) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4f86c955552a1..2e5009addd89f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9144,7 +9144,7 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key $out .= $extrafields->showOutputField($key, $value, '', $this->table_element); break; case "create": - $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICOT', 'email,phone,ip,password')); + $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } @@ -9152,7 +9152,7 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); break; case "edit": - $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICOT', 'email,phone,ip,password')); + $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4ecf61ffd1842..8cf0dc801cebb 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -911,7 +911,7 @@ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, // Show file size $size = (!empty($file['size']) ? $file['size'] : dol_filesize($filedir."/".$file["name"])); - $out .= ''.dol_print_size($size, 1, 1).''; + $out .= ''.dol_print_size($size, 1, 1).''; // Show file date $date = (!empty($file['date']) ? $file['date'] : dol_filemtime($filedir."/".$file["name"])); @@ -2153,11 +2153,10 @@ public function listOfLinks($object, $permissiontodelete = 1, $action = null, $s if ($nboflinks > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; } - foreach ($links as $link) { print ''; //edit mode - if ($action == 'update' && $selected === $link->id) { + if ($action == 'update' && $selected === (int) $link->id) { print ''; print ''; print ''; diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php index 34f05db4c1152..8ea08e7d52a6a 100644 --- a/htdocs/core/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -254,7 +254,7 @@ public function fetchAll(&$links, $objecttype, $objectid, $sortfield = null, $so if ($num > 0) { while ($obj = $this->db->fetch_object($resql)) { $link = new Link($this->db); - $link->id = $obj->rowid; + $link->id = (int) $obj->rowid; $link->entity = $obj->entity; $link->datea = $this->db->jdate($obj->datea); $link->url = $obj->url; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 45d60332fdff3..fcca43a491898 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -261,6 +261,7 @@ public function connect($host, $login, $passwd, $name, $port = 0) try { if (!class_exists('mysqli')) { dol_print_error(null, 'Driver mysqli for PHP not available'); + return false; } if (strpos($host, 'ssl://') === 0) { $tmp = new mysqliDoli($host, $login, $passwd, $name, $port); @@ -1288,38 +1289,41 @@ public function getServerStatusValues($filter = '') } } -/** - * Class to make SSL connection - */ -class mysqliDoli extends mysqli -{ + +if (class_exists('myslqi')) { /** - * Constructor. - * This create an opened connection to a database server and eventually to a database - * - * @param string $host Address of database server - * @param string $user Name of database user - * @param string $pass Password of database user - * @param string $name Name of database - * @param int $port Port of database server - * @param string $socket Socket + * Class to make SSL connection */ - public function __construct($host, $user, $pass, $name, $port = 0, $socket = "") + class mysqliDoli extends mysqli { - $flags = 0; - if (PHP_VERSION_ID >= 80100) { - parent::__construct(); - } else { - // @phan-suppress-next-line PhanDeprecatedFunctionInternal - parent::init(); - } - if (strpos($host, 'ssl://') === 0) { - $host = substr($host, 6); - parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false); - // Suppress false positive @phan-suppress-next-line PhanTypeMismatchArgumentInternalProbablyReal - parent::ssl_set(null, null, "", null, null); - $flags = MYSQLI_CLIENT_SSL; + /** + * Constructor. + * This create an opened connection to a database server and eventually to a database + * + * @param string $host Address of database server + * @param string $user Name of database user + * @param string $pass Password of database user + * @param string $name Name of database + * @param int $port Port of database server + * @param string $socket Socket + */ + public function __construct($host, $user, $pass, $name, $port = 0, $socket = "") + { + $flags = 0; + if (PHP_VERSION_ID >= 80100) { + parent::__construct(); + } else { + // @phan-suppress-next-line PhanDeprecatedFunctionInternal + parent::init(); + } + if (strpos($host, 'ssl://') === 0) { + $host = substr($host, 6); + parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false); + // Suppress false positive @phan-suppress-next-line PhanTypeMismatchArgumentInternalProbablyReal + parent::ssl_set(null, null, "", null, null); + $flags = MYSQLI_CLIENT_SSL; + } + parent::real_connect($host, $user, $pass, $name, $port, $socket, $flags); } - parent::real_connect($host, $user, $pass, $name, $port, $socket, $flags); } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d89c11a76c3c6..416ab130901d8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -434,7 +434,10 @@ function getEntity($element, $shared = 1, $currentobject = null) $out = $mc->getEntity($element, $shared, $currentobject); } else { $out = ''; - $addzero = array('user', 'usergroup', 'cronjob', 'c_email_templates', 'c_holiday_types', 'email_template', 'default_values', 'overwrite_trans'); + $addzero = array('user', 'usergroup', 'cronjob', 'c_email_templates', 'email_template', 'default_values', 'overwrite_trans'); + if (getDolGlobalString('HOLIDAY_ALLOW_ZERO_IN_DIC')) { // this constant break the dictionary admin without Multicompany + $addzero[] = 'c_holiday_types'; + } if (in_array($element, $addzero)) { $out .= '0,'; } @@ -1041,8 +1044,8 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } // Sanitizing for special parameters. - // Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed. - if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') { + // Note: There is no reason to allow the backtopage/backtopageforcancel/backtopagejs, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed. + if (preg_match('/backtopage/', $paramname) || $paramname == 'backtolist' || $paramname == 'backtourl') { $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retrieve it after other replacements. do { @@ -10390,7 +10393,8 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1' $forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST', 'ReflectionFunction')); $forbiddenphpfunctions = array(); - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64_decode", "rawurldecode", "urldecode", "str_rot13", "hex2bin")); // decode string functions used to obfuscated function name + // @phpcs:ignore + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("base64"."_"."decode", "rawurl"."decode", "url"."decode", "str"."_rot13", "hex"."2bin")); // name of forbidden functions are split to avoid false positive $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("override_function", "session_id", "session_create_id", "session_regenerate_id")); $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes")); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index d6149ce89e1f4..b5000337f0f49 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1353,7 +1353,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ if ($bentityon) { // only if entity enable $maskrefclient_sql .= " AND entity IN (".getEntity($sharetable).")"; } elseif (!empty($forceentity)) { - $sql .= " AND entity IN (".$db->sanitize($forceentity).")"; + $maskrefclient_sql .= " AND entity IN (".$db->sanitize($forceentity).")"; } if ($where) { $maskrefclient_sql .= $where; //use the same optional where as general mask diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ca1d72e1cd36e..92b538c5824ed 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -814,17 +814,24 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) $watermark_x = $w / 2; $watermark_y = $h / 3; $pdf->SetFont('', 'B', 40); - $pdf->SetTextColor(255, 192, 203); + $pdf->SetTextColor(255, 0, 0); //rotate $pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', cos($watermark_angle), sin($watermark_angle), -sin($watermark_angle), cos($watermark_angle), $watermark_x * $k, ($h - $watermark_y) * $k, -$watermark_x * $k, -($h - $watermark_y) * $k)); //print watermark $pdf->SetXY($watermark_x_pos, $watermark_y_pos); + + // set alpha to semi-transparency + $pdf->SetAlpha(0.3); $pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text), "", 2, "C", 0); + //antirotate $pdf->_out('Q'); $pdf->SetXY($savx, $savy); + + // Restore alpha + $pdf->SetAlpha(1); } @@ -2501,10 +2508,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $outputlangs->load('orders'); if (count($objects) > 1 && count($objects) <= (getDolGlobalInt("MAXREFONDOC") ? getDolGlobalInt("MAXREFONDOC") : 10)) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :'); - foreach ($objects as $elementobject) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs)); + if (empty($object->context['DolPublicNoteAppendedGetLinkedObjects'])) { // Check if already appended before add to avoid repeat data + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' :'); + foreach ($objects as $elementobject) { + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref).(empty($elementobject->ref_client) ? '' : ' ('.$elementobject->ref_client.')').(empty($elementobject->ref_supplier) ? '' : ' ('.$elementobject->ref_supplier.')').' '); + $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("OrderDate").' : '.dol_print_date($elementobject->date, 'day', '', $outputlangs)); + } } } elseif (count($objects) == 1) { $elementobject = array_shift($objects); @@ -2534,10 +2543,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs) if (count($objects) > 1) { $order = null; + + $refListsTxt = ''; if (empty($object->linkedObjects['commande']) && $object->element != 'commande') { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' :'); + $refListsTxt.= $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending").' :'; } else { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities("RefSending").' :'); + $refListsTxt.=$outputlangs->transnoentities("RefSending").' :'; } // We concat this record info into fields xxx_value. title is overwrote. foreach ($objects as $elementobject) { @@ -2552,14 +2563,18 @@ function pdf_getLinkedObjects(&$object, $outputlangs) } } } - + $refListsTxt.= (!empty($refListsTxt)?' ':''); if (! is_object($order)) { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->transnoentities($elementobject->ref)); + $refListsTxt.= $outputlangs->transnoentities($elementobject->ref); } else { - $object->note_public = dol_concatdesc($object->note_public, $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '')); - $object->note_public = dol_concatdesc($object->note_public, ' / '.$outputlangs->transnoentities($elementobject->ref)); + $refListsTxt.= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); + $refListsTxt.= ' / '.$outputlangs->transnoentities($elementobject->ref); } } + + if (empty($object->context['DolPublicNoteAppendedGetLinkedObjects'])) { // Check if already appended before add to avoid repeat data + $object->note_public = dol_concatdesc($object->note_public, $refListsTxt); + } } elseif (count($objects) == 1) { $elementobject = array_shift($objects); $order = null; @@ -2597,6 +2612,8 @@ function pdf_getLinkedObjects(&$object, $outputlangs) } } + $object->context['DolPublicNoteAppendedGetLinkedObjects'] = 1; + // For add external linked objects if (is_object($hookmanager)) { $parameters = array('linkedobjects' => $linkedobjects, 'outputlangs' => $outputlangs); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 957a1b781b42e..1c3360e997299 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -2634,6 +2634,62 @@ public function checkForUpdate() return 0; } + /** + * Check for module compliance with Dolibarr rules and law + * If a module is reported by this function,it is surely a malware. Delete it as soon as possible. + * + * @return int|string Return integer <0 if Error, 0 == not compliant, 'string' with message if module not compliant + */ + public function checkForCompliance() + { + global $conf, $langs; + + // Get list of illegal modules name or ID + if (empty($conf->cache['noncompliantmodules'])) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + + $urlforblacklistmodules = 'https://ping.dolibarr.org/modules-blacklist.txt'; + + $result = getURLContent($urlforblacklistmodules, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only + if (isset($result['content']) && $result['http_code'] == 200) { + $langs->load("errors"); + + // Security warning : be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . - + $arrayoflines = preg_split("/[\n,]/", $result['content']); + foreach ($arrayoflines as $line) { + $tmpfieldsofline = explode(';', $line); + $modulekey = strtolower($tmpfieldsofline[0]); + $conf->cache['noncompliantmodules'][$modulekey]['name'] = $tmpfieldsofline[0]; + $conf->cache['noncompliantmodules'][$modulekey]['id'] = $tmpfieldsofline[1]; + $conf->cache['noncompliantmodules'][$modulekey]['signature'] = $tmpfieldsofline[2]; + $conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[3]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[3]); + if (!empty($tmpfieldsofline[4])) { + $message2 = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", '{s}'); + $listofillegalurl = ''; + foreach (explode(" ", $tmpfieldsofline[4]) as $illegalurl) { + $listofillegalurl .= ($listofillegalurl ? ' '.$langs->trans("or").' ' : '').''.preg_replace('/[^a-z0-9\.\-]/', '', $illegalurl).''; + } + $message2 = str_replace('{s}', $listofillegalurl, $message2); + $conf->cache['noncompliantmodules'][$modulekey]['message2'] = $message2; + } + } + } + } + + if (!empty($conf->cache['noncompliantmodules'])) { + $modulekey = strtolower($this->name); + if (in_array($modulekey, array_keys($conf->cache['noncompliantmodules']))) { + $answer = trim($conf->cache['noncompliantmodules'][$modulekey]['message']); + if (!empty($conf->cache['noncompliantmodules'][$modulekey]['message2'])) { + $answer .= '
'.$conf->cache['noncompliantmodules'][$modulekey]['message2']; + } + return $answer; + } + } + + return 0; + } + /** * Helper method to declare dictionaries one at a time (rather than declaring dictionaries property by property). * diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php index 3d767b59571a4..6a707b7736260 100644 --- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php +++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php @@ -333,7 +333,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->asset->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 9233a93f151b1..930b054b3479c 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -333,10 +333,10 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->bom->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->bom->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 5cecdaa413dcc..560c7ad1ec9ed 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -292,7 +292,7 @@ public function Header(&$pdf, $page, $pages, $outputlangs) $pdf->SetFont('', '', $default_font_size); $pdf->SetXY(10, 32); - $pdf->MultiCell(0, 2, $outputlangs->transnoentities("BankAccount"), 0, 'L'); + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("BankAccount"), 0, 'L'); pdf_bank($pdf, $outputlangs, 32, 32, $this->account, 1); $pdf->SetFont('', '', $default_font_size); diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 3f7607947509a..7bbea64d472cc 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -124,7 +124,7 @@ public function getNextValue($objsoc, $object) $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql .= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); $resql = $db->query($sql); if ($resql) { @@ -139,8 +139,8 @@ public function getNextValue($objsoc, $object) return -1; } - //$date=time(); - $date = $object->date_bordereau; + $date = (empty($object) ? dol_now() : $object->date_bordereau); + $yymm = dol_print_date($date, "%y%m"); if ($max >= (pow(10, 4) - 1)) { @@ -150,6 +150,7 @@ public function getNextValue($objsoc, $object) } dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); + return $this->prefix.$yymm."-".$num; } } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 9b97481dcba1e..dd6eea47d8508 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -128,7 +128,9 @@ public function getNextValue($objsoc, $object) return 0; } - $numFinal = get_next_value($db, $mask, 'bordereau_cheque', 'ref', '', $objsoc, empty($object) ? dol_now() : $object->date_bordereau); + $date = (empty($object) ? dol_now() : $object->date_bordereau); + + $numFinal = get_next_value($db, $mask, 'bordereau_cheque', 'ref', '', $objsoc, $date); return $numFinal; } diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 529ca3a85398a..3645718cfc04c 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -344,7 +344,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->commande->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index de6d3b05f394e..23ef65337e3df 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -8,7 +8,9 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Nick Fragoulis + * Copyright (C) 2024 Joachim Kueter * * 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 @@ -557,10 +559,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); - } - if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -644,6 +642,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); @@ -1846,7 +1849,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'border-left' => true, // add left line separator ); - if (!getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) { + if (!getDolGlobalInt('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT') && !getDolGlobalString('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN')) { $this->cols['vat']['status'] = true; } diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index c5b938fe8f16a..92882228e1792 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -356,7 +356,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->contrat->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index c8781cdd2cca7..b60f8b9c1c8df 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -342,7 +342,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->expedition->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 3cc19ec9933bb..d151becb4b6a0 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -574,10 +574,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $posYAfterDescription = 0; $heightforsignature = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -666,8 +662,12 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font - // weight + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // weight $weighttxt = ''; if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->weight) { $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); @@ -1206,6 +1206,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // Show recipient name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); + // @phan-suppress-next-line PhanPluginSuspiciousParamOrder $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection); $posy = $pdf->getY(); @@ -1213,6 +1214,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // Show recipient information $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); + // @phan-suppress-next-line PhanPluginSuspiciousParamOrder $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection); } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index aa8cc2584737c..ea303eae66f50 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -384,7 +384,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->facture->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 6466aaa298e22..548d40bcb7252 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -126,7 +126,7 @@ class pdf_sponge extends ModelePDFFactures */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; // Translations $langs->loadLangs(array("main", "bills")); @@ -714,10 +714,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); - } - if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - $page_bottom_margin)) { // If photo too high, we moved completely on new page @@ -799,6 +795,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); @@ -1444,9 +1445,9 @@ protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlan $EPCQrCodeString = $object->buildEPCQrCodeString(); $pdf->write2DBarcode($EPCQrCodeString, 'QRCODE,M', $qrPosX, $qrPosY, 25, 25, $styleQr, 'N'); - $pdf->SetXY($qrPosX + 5, $posy); + $pdf->SetXY($qrPosX + 30, $posy + 5); $pdf->SetFont('', '', $default_font_size - 5); - $pdf->MultiCell(30, 3, $langs->trans("INVOICE_ADD_EPC_QR_CODEPay"), 0, 'L', 0); + $pdf->MultiCell(30, 3, $outputlangs->transnoentitiesnoconv("INVOICE_ADD_EPC_QR_CODEPay"), 0, 'L', 0); $posy = $pdf->GetY() + 2; } } @@ -2702,7 +2703,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['totalexcltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_PROPAL_HIDE_PRICE_EXCL_TAX') ? true : false, + 'status' => !getDolGlobalString('PDF_INVOICE_HIDE_PRICE_EXCL_TAX') ? true : false, 'title' => array( 'textkey' => 'TotalHTShort' ), @@ -2713,7 +2714,7 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide $this->cols['totalincltax'] = array( 'rank' => $rank, 'width' => 26, // in mm - 'status' => !getDolGlobalString('PDF_PROPAL_SHOW_PRICE_INCL_TAX') ? false : true, + 'status' => !getDolGlobalString('PDF_INVOICE_SHOW_PRICE_INCL_TAX') ? false : true, 'title' => array( 'textkey' => 'TotalTTCShort' ), diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 0bf5e587d4ce5..3692f6d70e6eb 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -125,6 +125,13 @@ public function __construct($db, $datatoimport) $this->label_lib = 'PhpSpreadSheet'; $this->version_lib = '1.8.0'; + $arrayofstreams = stream_get_wrappers(); + if (!in_array('zip', $arrayofstreams)) { + $langs->load("errors"); + $this->error = $langs->trans('ErrorStreamMustBeEnabled', 'zip'); + return; + } + $this->datatoimport = $datatoimport; if (preg_match('/^societe_/', $datatoimport)) { $this->thirdpartyobject = new Societe($this->db); diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index fec763d30d044..f74f434070110 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -313,7 +313,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'mem $srctemplatepath, array( 'PATH_TO_TMP' => $conf->adherent->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index f2c1cba7aad9e..d82d9b4f04873 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -44,8 +44,6 @@ class modSalaries extends DolibarrModules */ public function __construct($db) { - global $conf; - $this->db = $db; $this->numero = 510; // Perms from 501..519 @@ -151,16 +149,18 @@ public function __construct($db) $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'SalariesAndPayments'; + $this->export_icon[$r] = 'salary'; $this->export_permission[$r] = array(array("salaries", "export")); - $this->export_fields_array[$r] = array('u.firstname'=>"Firstname", 'u.lastname'=>"Lastname", 'u.login'=>"Login", 'u.salary'=>'CurrentSalary', 'p.datep'=>'DatePayment', 'p.datesp'=>'DateStartPeriod', 'p.dateep'=>'DateEndPeriod', 'p.amount'=>'AmountPayment', 'p.num_payment'=>'Numero', 'p.label'=>'Label', 'p.note'=>'Note'); - $this->export_TypeFields_array[$r] = array('u.firstname'=>"Text", 'u.lastname'=>"Text", 'u.login'=>'Text', 'u.salary'=>"Numeric", 'p.datep'=>'Date', 'p.datesp'=>'Date', 'p.dateep'=>'Date', 'p.amount'=>'Numeric', 'p.num_payment'=>'Numeric', 'p.label'=>'Text'); + $this->export_fields_array[$r] = array('s.rowid' => 'SalaryID', 's.label'=>'Label', 's.datesp'=>'DateStartPeriod', 's.dateep'=>'DateEndPeriod', 's.amount' => 'SalaryAmount', 's.paye' => 'Status', 'u.firstname'=>"Firstname", 'u.lastname'=>"Lastname", 'u.login'=>"Login", 'u.salary'=>'CurrentSalary', 'p.datep'=>'DatePayment', 'p.amount'=>'AmountPayment', 'p.num_payment'=>'Numero', 'p.note'=>'Note'); + $this->export_TypeFields_array[$r] = array('s.rowid' => 'Numeric', 's.label'=>'Text', 's.amount' => 'Numeric', 's.paye' => 'Numeric', 'u.firstname'=>"Text", 'u.lastname'=>"Text", 'u.login'=>'Text', 'u.salary'=>"Numeric", 'p.datep'=>'Date', 's.datesp'=>'Date', 's.dateep'=>'Date', 'p.amount'=>'Numeric', 'p.num_payment'=>'Numeric'); $this->export_entities_array[$r] = array('u.firstname'=>'user', 'u.lastname'=>'user', 'u.login'=>'user', 'u.salary'=>'user', 'p.datep'=>'payment', 'p.datesp'=>'payment', 'p.dateep'=>'payment', 'p.amount'=>'payment', 'p.label'=>'payment', 'p.note'=>'payment', 'p.num_payment'=>'payment'); $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid'; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'salary as s'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON s.fk_user = u.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_salary = s.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id'; - $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('user').')'; + $this->export_sql_end[$r] .= ' AND s.entity IN ('.getEntity('salary').')'; } diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 1a784af2dcbf0..1607db5cd7c0d 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -327,7 +327,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->mrp->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 85450edf7f07d..4c8b329389407 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -339,7 +339,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->product->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index c07cea2dbc8f6..679cec0a89384 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -611,7 +611,7 @@ public function write_file($object, $outputlangs, $srctemplatepath) $srctemplatepath, array( 'PATH_TO_TMP' => $conf->project->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index b330aaac9b245..b86f6756d44a6 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -547,10 +547,10 @@ public function write_file($object, $outputlangs, $srctemplatepath) $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->project->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->project->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index e5fddcddd5fda..160d7cf4b5f04 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -376,7 +376,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->propal->multidir_temp[$object->entity], - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 282edf3174263..ffa72c9dc2f09 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1016,7 +1016,7 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) $posy = $pdf->GetY() + 2; } } - if ($conf->global->FACTURE_CHQ_NUMBER == -1) { + if (getDolGlobalInt('FACTURE_CHQ_NUMBER') == -1) { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); @@ -1035,8 +1035,8 @@ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if (!empty($object->fk_account) || !empty($object->fk_bank) || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = (empty($object->fk_account) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); - if (!empty($object->fk_bank)) { + $bankid = (empty($object->fk_account) ? getDolGlobalInt('FACTURE_RIB_NUMBER') : $object->fk_account); + if (!empty($object->fk_bank) && $object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } $account = new Account($this->db); @@ -1516,12 +1516,12 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output } else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } else { $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); + $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); } } @@ -1534,7 +1534,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $pdf->SetTextColor(128, 0, 0); $title .= ' - '.$outputlangs->transnoentities("NotValidated"); } - $pdf->MultiCell(100, 4, $title, '', 'R'); + $pdf->MultiCell($w, 4, $title, '', 'R'); $pdf->SetFont('', 'B', $default_font_size); @@ -1552,7 +1552,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } if (getDolGlobalString('PDF_SHOW_PROJECT_TITLE')) { @@ -1586,18 +1586,18 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $posy = $pdf->getY(); $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, $displaydate, false, $outputlangs, true), '', 'R'); $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, $displaydate, false, $outputlangs, true), '', 'R'); if (!getDolGlobalString('MAIN_PDF_HIDE_CUSTOMER_CODE') && $object->thirdparty->code_client) { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } // Get contact @@ -1609,7 +1609,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); } } @@ -1618,7 +1618,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $output $top_shift = 0; // Show list of linked objects $current_y = $pdf->getY(); - $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); if ($current_y < $pdf->getY()) { $top_shift = $pdf->getY() - $current_y; } @@ -1758,7 +1758,7 @@ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) * Show area for the customer to sign * * @param TCPDF $pdf Object PDF - * @param Propal $object Object invoice + * @param Propal $object Object proposal * @param int $posy Position depart * @param Translate $outputlangs Object langs * @return int Position pour suite @@ -1779,7 +1779,7 @@ protected function _signature_area(&$pdf, $object, $posy, $outputlangs) $pdf->SetFont('', '', $default_font_size - 2); $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1); - $pdf->SetXY($posx, $tab_top + $tab_hl); + $pdf->SetXY($posx, $tab_top + $tab_hl + 3); $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) { // Can be retrieve with getSignatureAppearanceArray() diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 6b75bc4663a6c..9001cb900c080 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -568,10 +568,6 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); - } - if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -606,18 +602,18 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); $pageposafter = $pdf->getPage(); - if ($pageposafter > $pageposbefore) { // There is a pagebreak + if ($pageposafter > $pageposbefore) { // There is a pagebreak (not enough space for total+free text+footer) $pdf->rollbackTransaction(true); - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it to simple footer, so we can retry as if we have just the simple footer. $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text - if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // There is no space left for total+free text but no page break. + if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page manually because no break page was done automatically for the last part. $pdf->AddPage('', '', true); if (!empty($tplidx)) { $pdf->useTemplate($tplidx); @@ -625,7 +621,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->setPage($pageposafter + 1); } } else { - // We found a page break + // We found a page break that was done automatically and there is ow enough space for total+free text+footer. // Allows data in the first page if description is long enough to break in multiples pages if (getDolGlobalString('MAIN_PDF_DATA_ON_FIRST_PAGE')) { $showpricebeforepagebreak = 1; @@ -646,7 +642,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - // We suppose that a too long description or photo were moved completely on next page + // We suppose that a too long description or photo were moved completely on next page, so we set the value for $curY and current page that will be used by the following output. if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; @@ -654,6 +650,11 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); @@ -999,7 +1000,7 @@ public function drawInfoTable(&$pdf, $object, $posy, $outputlangs) } $posxval = 52; - if (getDolGlobalString('MAIN_PDF_DATE_TEXT')) { + if (getDolGlobalString('MAIN_PDF_DELIVERY_DATE_TEXT')) { $displaydate = "daytext"; } else { $displaydate = "day"; @@ -1133,7 +1134,7 @@ public function drawInfoTable(&$pdf, $object, $posy, $outputlangs) // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { if ($object->fk_account > 0 || $object->fk_bank > 0 || getDolGlobalInt('FACTURE_RIB_NUMBER')) { - $bankid = ($object->fk_account <= 0 ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_account); + $bankid = ($object->fk_account <= 0 ? getDolGlobalInt('FACTURE_RIB_NUMBER') : $object->fk_account); if ($object->fk_bank > 0) { $bankid = $object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank } @@ -1361,7 +1362,12 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalLT2", $mysoc->country_code) : ''); $totalvat .= ' '; - $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + if (getDolGlobalString('PDF_LOCALTAX2_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') { + $totalvat .= $tvacompl; + } else { + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + } + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $total_localtax = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? price2num($tvaval * $object->multicurrency_tx, 'MT') : $tvaval); @@ -1404,8 +1410,7 @@ protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlan $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); /* - if ($object->close_code == 'discount_vat') - { + if ($object->close_code == 'discount_vat') { $index++; $pdf->SetFillColor(255,255,255); @@ -1844,7 +1849,7 @@ protected function drawSignatureArea(&$pdf, $object, $posy, $outputlangs) $pdf->SetFont('', '', $default_font_size - 2); $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1); - $pdf->SetXY($posx, $tab_top + $tab_hl); + $pdf->SetXY($posx, $tab_top + $tab_hl + 3); $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) { diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index c51179964e279..082b9f20198a5 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -337,7 +337,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->reception->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 5e9b54f03c119..0ea2d5535162a 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -291,7 +291,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->societe->multidir_temp[$object->entity], - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 4db3e9f93d291..1739914c5f171 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -338,7 +338,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->product->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php index 8246efc372d6f..0e3f2be33c785 100644 --- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php @@ -340,7 +340,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->fournisseur->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index a6750022925f9..e272fa2f9e1f1 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -335,7 +335,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->fournisseur->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 7132a4de3ad98..885a25b84b56b 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -519,10 +519,6 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $posYAfterImage = 0; $posYAfterDescription = 0; - if ($this->getColumnStatus('position')) { - $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); - } - // We start with Photo of product line if ($this->getColumnStatus('photo')) { // We start with Photo of product line @@ -549,6 +545,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $posYAfterImage = $curY + $imglinesize['height']; } } + // Description of product line $curX = $this->posxdesc - 1; $showpricebeforepagebreak = 1; @@ -604,6 +601,11 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par default + // # of line + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', $i + 1); + } + // VAT Rate if ($this->getColumnStatus('vat')) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 17e7fb8ae2c9a..d0622a1686f53 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -364,7 +364,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->supplier_proposal->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index c488f8035b508..a46099083c582 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -311,7 +311,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->ticket->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 8dd43bbdc32d1..332af37d8c7db 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -342,7 +342,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->user->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index cabdf9611aa44..1989ded79e399 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -363,7 +363,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->user->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index cfa1c65e93cfa..bab0e76a46fe5 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1144,7 +1144,7 @@ public function doCollectOneCollector($mode = 0) } else { $keyforprovider = ''; } - $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array); + $keyforsupportedoauth2array = preg_replace('/-.*$/', '', strtoupper($keyforsupportedoauth2array)); $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME'; if (!empty($supportedoauth2array)) { @@ -1185,11 +1185,22 @@ public function doCollectOneCollector($mode = 0) $serviceFactory = new \OAuth\ServiceFactory(); $oauthname = explode('-', $OAUTH_SERVICENAME); // ex service is Google-Emails we need only the first part Google - $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array()); + + $scopes = array(); + if (preg_match('/^Microsoft/', $OAUTH_SERVICENAME)) { + //$extraparams = $tokenobj->getExtraParams(); + $tmp = explode('-', $OAUTH_SERVICENAME); + $scopes = explode(',', getDolGlobalString('OAUTH_'.strtoupper($tmp[0]).(empty($tmp[1]) ? '' : '-'.$tmp[1]).'_SCOPE')); + } + + $apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, $scopes); + '@phan-var-force OAuth\OAuth2\Service\AbstractService|OAuth\OAuth1\Service\AbstractService $apiService'; // createService is only ServiceInterface - // We have to save the token because Google give it only once + $refreshtoken = $tokenobj->getRefreshToken(); $tokenobj = $apiService->refreshAccessToken($tokenobj); + + // We have to save the token because answer give it only once $tokenobj->setRefreshToken($refreshtoken); $storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj); } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 4759362533403..a66d2fef42155 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2925,7 +2925,7 @@ } // Presend form -$modelmail = 'expensereport'; +$modelmail = 'expensereport_send'; $defaulttopic = 'SendExpenseReportRef'; $diroutput = $conf->expensereport->dir_output; $trackid = 'exp'.$object->id; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b89ea893078f4..66761d12cdd31 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1661,7 +1661,7 @@ if ($origin == "commande") { $cond_reglement_id = 0; $mode_reglement_id = 0; - $delivery_date = ''; + $datelivraison = ''; $objectsrc->note_private = ''; $objectsrc->note_public = ''; if ($societe = $object->thirdparty) { @@ -1685,9 +1685,9 @@ $demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0)); //$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0)); //$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); - $dateinvoice = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : ''; + $dateinvoice = getDolGlobalString('MAIN_AUTOFILL_DATE') ? '' : -1; - $datedelivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); + $datelivraison = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); if (isModEnabled("multicurrency")) { if (!empty($objectsrc->multicurrency_code)) { @@ -1820,7 +1820,9 @@ $usehourmin = 1; } print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate($datelivraison ? $datelivraison : -1, 'liv_', $usehourmin, $usehourmin, 0, "set"); + print ''; // Bank Account diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index f66b29130667c..8998a54eb5468 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1,16 +1,16 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2016 Meziane Sof - * Copyright (C) 2017-2018 Frédéric France - * Copyright (C) 2023-2024 Nick Fragoulis - * Copyright (C) 2024 MDW +/* Copyright (C) 2002-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2015-2024 Alexandre Spangaro + * Copyright (C) 2016 Meziane Sof + * Copyright (C) 2017-2018 Frédéric France + * Copyright (C) 2023-2024 Nick Fragoulis + * Copyright (C) 2024 MDW * * 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 @@ -28,7 +28,7 @@ /** * \file htdocs/fourn/facture/card-rec.php - * \ingroup invoice fournisseurs + * \ingroup supplier invoice * \brief Page to show predefined invoice */ @@ -478,7 +478,7 @@ } if ($qty < 0) { $langs->load("errors"); - setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); + setEventMessages($langs->trans('ErrorQtyForSupplierInvoiceCantBeNegative'), null, 'errors'); $error++; } @@ -542,8 +542,8 @@ $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $prod->id); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $prod->id); if (empty($tva_tx)) { $tva_npr = 0; } @@ -551,7 +551,7 @@ // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. $pqp = (GETPOSTINT('pbq') ? GETPOSTINT('pbq') : 0); - $datapriceofproduct = $prod->getSellPrice($mysoc, $object->thirdparty, $pqp); + $datapriceofproduct = $prod->getSellPrice($object->thirdparty, $mysoc, $pqp); $pu_ht = $datapriceofproduct['pu_ht']; $pu_ttc = $datapriceofproduct['pu_ttc']; @@ -666,8 +666,8 @@ $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); + $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); $info_bits = 0; if ($tva_npr) { $info_bits |= 0x01; @@ -819,7 +819,7 @@ } if ($qty < 0) { $langs->load("errors"); - setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors'); + setEventMessages($langs->trans('ErrorQtyForSupplierInvoiceCantBeNegative'), null, 'errors'); $error++; } @@ -931,7 +931,7 @@ print ''; // Third party - print '' . $langs->trans("Customer") . '' . $object->thirdparty->getNomUrl(1, 'customer') . ''; + print '' . $langs->trans("Supplier") . '' . $object->thirdparty->getNomUrl(1, 'supplier') . ''; print ''; // Invoice subtype @@ -944,7 +944,7 @@ $note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : $object->note_public; $note_private = GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : $object->note_private; - // Help of substitution key + // Help for substitution key $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')'; @@ -1113,7 +1113,7 @@ $disableedit = 1; $disablemove = 1; $disableremove = 1; - $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines('', $object->thirdparty, $mysoc, $lineid, 0); // No date selector for template invoice } print "\n"; @@ -1613,7 +1613,7 @@ $canchangeproduct = 0; $object->statut = $object->suspended; - $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines($action, $object->thirdparty, $mysoc, $lineid, 0); // No date selector for template invoice } // Form to add new line diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 0bede5a6b4d37..fc5b6a8c93387 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3584,9 +3584,9 @@ function setRadioForTypeOfInvoice() { // Show link for "recalculate" if ($object->getVentilExportCompta() == 0) { $s = '' . $langs->trans("ReCalculate") . ' '; - $s .= '' . $langs->trans("Mode1") . ''; + $s .= '' . $langs->trans("Mode1") . ''; $s .= ' / '; - $s .= '' . $langs->trans("Mode2") . ''; + $s .= '' . $langs->trans("Mode2") . ''; print '
'; print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '
' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); print '       '; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index d18fc712d61fd..1f7a95c706e00 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -337,7 +337,7 @@ // Filter: Date if (!empty($arrayfields['cpl.date_action']['checked'])) { print ''; - print ''; + print ''; print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'valignmiddle width75', true); print ''; } @@ -560,8 +560,8 @@ } if ($log_holiday == '2') { - print ''; - print ''.$langs->trans('NoRecordFound').''; + print ''; + print ''.$langs->trans('NoRecordFound').''; print ''; } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 869bddbb3fde0..660ba435eec46 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -783,6 +783,16 @@ $classname = "Import".ucfirst($model); require_once $dir.$file; $obj = new $classname($db, $datatoimport); + + if (!empty($obj->error)) { + $langs->load("errors"); + $param = '&datatoimport='.$datatoimport.'&format='.$format; + setEventMessages($obj->error, null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"].'?step=3'.$param.'&filetoimport='.urlencode($relativepath)); + exit; + } + + if ($model == 'csv') { $obj->separator = $separator_used; $obj->enclosure = $enclosure; diff --git a/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php b/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php index b6f89118d8359..bc28762c688ff 100644 --- a/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php +++ b/htdocs/includes/OAuth/OAuth2/Service/AbstractService.php @@ -218,12 +218,31 @@ public function refreshAccessToken(TokenInterface $token) 'refresh_token' => $refreshToken, ); + // @CHANGE LDR + //global $conf; $conf->global->OAUTH_ADD_SCOPE_AND_TENANT_IN_REFRESH_MESSAGE = 1; + if (getDolGlobalString('OAUTH_ADD_SCOPE_AND_TENANT_IN_REFRESH_MESSAGE')) { + if (!empty($this->scopes)) { + $parameters['scope'] = implode($this->getScopesDelimiter(), $this->scopes); + } + if ($this->storage->getTenant()) { + $parameters['tenant'] = $this->storage->getTenant(); + } + } + //var_dump($parameters); + $responseBody = $this->httpClient->retrieveResponse( $this->getAccessTokenEndpoint(), $parameters, $this->getExtraOAuthHeaders() ); - //print $responseBody;exit; // We must have a result "{"token_type":"Bearer","scope... + + + // @CHANGE LDR + $data = json_decode((string) $responseBody, true); + if (is_array($data) && !empty($data['error_description'])) { + print 'Oauth2 AbstractService error received: '.$data['error_description']; + } + //print $responseBody;exit; // We must have a result string "{"token_type":"Bearer","error_description":...,"scope... $token = $this->parseAccessTokenResponse($responseBody); $this->storage->storeAccessToken($this->service(), $token); diff --git a/htdocs/includes/jquery/plugins/jcrop/index.html b/htdocs/includes/jquery/plugins/jcrop/index.html deleted file mode 100644 index 209c929c61d01..0000000000000 --- a/htdocs/includes/jquery/plugins/jcrop/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - -Jcrop: the jQuery Image Cropping Plugin - - - -
-

Jcrop Image Cropping Plugin

- - - Jcrop - is the image cropping plugin for - jQuery.
- You've successfully unpacked Jcrop. -
- -

Static Demos

- - - -

Live Demo

- - - -

Jcrop Links

- - - -
- - © 2008 Kelly Hallman and DeepLiquid.com
- Free software released under - MIT License -
-
- - - - diff --git a/htdocs/includes/jquery/plugins/jpicker/Example.html b/htdocs/includes/jquery/plugins/jpicker/Example.html deleted file mode 100644 index b93bd0152e3b3..0000000000000 --- a/htdocs/includes/jquery/plugins/jpicker/Example.html +++ /dev/null @@ -1,774 +0,0 @@ - - - - - - Digital Magic Productions - jPicker - A jQuery Color Picker Plugin - - - - - - - -
-

jPicker - A jQuery Color Picker Plugin.

-

- jPicker is a fast, lightweight jQuery plugin for including an advanced color picker in your web projects. It has been painstakenly ported from John Dyers' awesome work on his picker using the Prototype framework.

- jPicker supports all current browsers and has been extensively tested in Chrome, Firefox, IE5.5+, Safari, and Opera.

- If you are updating a current version, you MUST always use the CSS and image files from the download as there may have been changes.

- If you are moving from a V1.0.* version, you MUST read the docs below to implement some changes to the Color object returned by the callback functions.

- View John Dyer's prototype plugin here.

- View jPicker details a docs below.

- Check out the source from Google Code. -



-

jPicker Inline Example

-

- jPicker can be used inline by binding to any block level element.

- jPicker() -- no arguments -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('#Inline').jPicker();
-    });
-</script>
-<div id="Inline"></div>
-
-



-

jPicker Expandable Example

-

- jPicker can also display only a small picker icon that opens a popup for editing.

- jPicker({ window: { expandable: true }}) -

-<script type="text/javascript">
-  $(document).ready(
-    function()
-    {
-      $('#Expandable').jPicker(
-        {
-          window:
-          {
-            expandable: true
-          }
-        });
-    });
-</script>
-<span id="Expandable"></span>
- -



-

jPicker Alpha Channel Example

-

- jPicker can also pick colors with alpha (transparency) values.

- jPicker({ window: { expandable: true }}) -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('#Alpha').jPicker(
-        {
-          window:
-          {
-            expandable: true
-          },
-          color:
-          {
-            alphaSupport: true,
-            active: new $.jPicker.Color({ ahex: '99330099' })
-          }
-        });
-    });
-</script>
-<span id="Alpha"></span>
- -



-

jPicker Binded Example

-

- jPicker can also be binded to an input element.

- jPicker() -- no arguments -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('#Binded').jPicker();
-    });
-</script>
-<input id="Binded" type="text" value="e2ddcf" />
- -



-

Multiple jPicker Binded Example

-

- jPicker can also be binded to multiple elements at a time.

- jPicker() -- no arguments -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('.Multiple').jPicker();
-    });
-</script>
-<input class="Multiple" type="text" value="e2ddcf" /><br />
-<input class="Multiple" type="text" value="" /><br />
-<input class="Multiple" type="text" value="fda0f7" />
-
-
-
-



-

jPicker Callback Functions

-

- Register for callback function to have it interact with your page.

- jPicker([settings, [commitCallback, [liveCallback, [cancelCallback]]]]) -

-<script type="text/javascript">
-  $(document).ready(
-    function()
-    {
-      var LiveCallbackElement = $('#Live'),
-          LiveCallbackButton = $('#LiveButton');  // you don't want it searching this
-                                                  // on every live callback!!!
-      $('#Callbacks').jPicker(
-        {},
-        function(color, context)
-        {
-          var all = color.val('all');
-          alert('Color chosen - hex: ' + (all && '#' + all.hex || 'none') +
-            ' - alpha: ' + (all && all.a + '%' || 'none'));
-          $('#Commit').css(
-            {
-              backgroundColor: all && '#' + all.hex || 'transparent'
-            }); // prevent IE from throwing exception if hex is empty
-        },
-        function(color, context)
-        {
-          if (context == LiveCallbackButton.get(0)) alert('Color set from button');
-          var hex = color.val('hex');
-          LiveCallbackElement.css(
-            {
-              backgroundColor: hex && '#' + hex || 'transparent'
-            }); // prevent IE from throwing exception if hex is empty
-        },
-        function(color, context)
-        {
-          alert('"Cancel" Button Clicked');
-        });      
-      $('#LiveButton').click(
-        function()
-        {
-          $.jPicker.List[0].color.active.val('hex', 'e2ddcf', this);
-        });
-    });
-</script>
-<input id="Callbacks" type="text" value="e2ddcf" />
-<span id="Commit" style="background-color: #e2ddcf; display: block; --
-          float: left; height: 50px; margin: 10px; width: 50px;"> --
-          Commit</span>
-<span id="Live" style="display: block; float: left; height: 50px; --
-          margin: 10px; width: 50px;">Live</span>
-<input id="LiveButton" type="button" value="Set To #e2ddcf" />
-
- Commit - Live - -



-

jPicker Settings And Colors

-

- Use the "val" method on the active color for interaction with the picker.

- (jQuery).jPicker.List[index] -

-<script type="text/javascript">        
-  $(document).ready(
-    function()
-    {
-      $('#AlterColors').jPicker();
-      $('#GetActiveColor').click(
-        function()
-        {
-          alert($.jPicker.List[0].color.active.val('ahex'));
-        });
-      $('#GetRG').click(
-        function()
-        {
-          var rg=$.jPicker.List[0].color.active.val('rg');
-          alert('red: ' + rg.r + ', green: ' + rg.g);
-        });
-      $('#SetHue').click(
-        function()
-        {
-          $.jPicker.List[0].color.active.val('h', 133);
-        });
-      $('#SetValue').click(
-        function()
-        {
-          $.jPicker.List[0].color.active.val('v', 38);
-        });
-      $('#SetRG').click(
-        function()
-        {
-          $.jPicker.List[0].color.active.val('rg', { r: 213, g: 118 });
-        });
-    });
-</script>
-<input id="AlterColors" type="text" value="e2ddcf" /><br />
-<input id="GetActiveColor" type="button" value="Get Active Color" /><br />
-<input id="GetRG" type="button" value="Get Red/Green Value" /><br />
-<input id="SetHue" type="button" value="Set Hue To 133" /><br />
-<input id="SetValue" type="button" value="Set Value To 38" /><br />
-<input id="SetRG" type="button" value="Set Red/Green To 213, 118" />
-
-
-
-
-
- -



-

jPicker Core

-

- jPicker Core function - returns the jQuery object.

- jPicker([settings, [commitCallback, [liveCallback, [cancelCallback]]]]) -



-

Settings

-

- settings [object]: (with defaults)
-

-{
-  window: // used to define the position of the popup window
-          // only useful in binded mode
-  {
-    title: null, // any title for the jPicker window itself - displays
-                 // "Drag Markers To Pick A Color" if left null
-    position:
-    {
-      x: 'screenCenter', // acceptable values "left", "center", "right",
-                         // "screenCenter", or relative px value
-      y: 'top', // acceptable values "top", "bottom", "center", or relative px
-                // value
-    },
-    expandable: false, // default to large static picker - set to true to make an
-                       // expandable picker (small icon with popup) - set
-                       // automatically when binded to input element
-    liveUpdate: true, // set false if you want the user to click "OK" before the
-                      // binded input box updates values (always "true" for
-                      // expandable picker)
-    alphaSupport: false, // set to true to enable alpha picking
-    alphaPrecision: 0, // set decimal precision for alpha percentage display -
-                       // hex codes do not map directly to percentage integers -
-                       // range 0-2
-    updateInputColor: true // set to false to prevent binded input colors from
-                           // changing
-  },
-  color:
-  {
-    mode: 'h', // acceptable values "h" (hue), "s" (saturation), "v" (brightness),
-               // "r" (red), "g" (green), "b" (blue), "a" (alpha)
-    active: new $.jPicker.Color({ hex: 'ffc000' }), // accepts any declared
-               // jPicker.Color object or hex string WITH OR WITHOUT '#'
-    quickList: // this list of quick pick colors - override for a different list
-      [
-        new $.jPicker.Color({ h: 360, s: 33, v: 100}), // accepts any declared
-               // jPicker.Color object or hex string WITH OR WITHOUT '#'
-        new $.jPicker.Color({ h: 360, s: 66, v: 100}),
-        (...) // removed for brevity
-        new $.jPicker.Color({ h: 330, s: 100, v: 50}),
-        new $.jPicker.Color()
-      ]
-  },
-  images
-  {
-    clientPath: '/jPicker/images/', // Path to image files
-    colorMap: // colorMap size and arrow icon
-    {
-      width: 256, // Map width - don't override unless using a smaller image set
-      height: 256, // Map height - don't override unles using a smaller image set
-      arrow:
-      {
-        file: 'mappoint.gif', // Arrow icon image file
-        width: 15, // Arrow icon width
-        height: 15 // Arrow icon height
-      }
-    },
-    colorBar: // colorBar size and arrow icon
-    {
-      width: 20, // Bar width - don't override unless using a smaller image set
-      height: 256, // Bar height - don't override unless using a smaller image set
-      arrow:
-      {
-        file: 'rangearrows.gif', // Arrow icon image file
-        width: 40, // Arrow icon width
-        height: 9 // Arrow icon height
-      }
-    },
-    picker: // picker icon and size
-    {
-      file: 'picker.gif', // Picker icon image file
-      width: 25, // Picker width - don't override unless using a smaller image set
-      height: 24 // Picker height - don't override unless using a smaller image set
-    }
-  },
-  localization:
-  {
-    text:
-    {
-      title: 'Drag Markers To Pick A Color',
-      newColor: 'new',
-      currentColor: 'current',
-      ok: 'OK',
-      cancel: 'Cancel'
-    },
-    tooltips:
-    {
-      colors:
-      {
-        newColor: 'New Color - Press “OK” To Commit',
-        currentColor: 'Click To Revert To Original Color'
-      },
-      buttons:
-      {
-        ok: 'Commit To This Color Selection',
-        cancel: 'Cancel And Revert To Original Color'
-      },
-      hue:
-      {
-        radio: 'Set To “Hue” Color Mode',
-        textbox: 'Enter A “Hue” Value (0-360°)'
-      },
-      saturation:
-      {
-        radio: 'Set To “Saturation” Color Mode',
-        textbox: 'Enter A “Saturation” Value (0-100%)'
-      },
-      brightness:
-      {
-        radio: 'Set To “Brightness” Color Mode',
-        textbox: 'Enter A “Brightness” Value (0-100%)'
-      },
-      red:
-      {
-        radio: 'Set To “Red” Color Mode',
-        textbox: 'Enter A “Red” Value (0-255)'
-      },
-      green:
-      {
-        radio: 'Set To “Green” Color Mode',
-        textbox: 'Enter A “Green” Value (0-255)'
-      },
-      blue:
-      {
-        radio: 'Set To “Blue” Color Mode',
-        textbox: 'Enter A “Blue” Value (0-255)'
-      },
-      alpha:
-      {
-        radio: 'Set To “Alpha” Color Mode',
-        textbox: 'Enter A “Alpha” Value (0-100)'
-      },
-      hex:
-      {
-        textbox: 'Enter A “Hex” Color Value (#000000-#ffffff)',
-        alpha: 'Enter A “Alpha” Value (#00-#ff)'
-      }
-    }
-  }
-}
-



-

Callback Pattern

-

- function(jPicker.Color color, object context){...} -



-

jPicker List

-

- The list of active jPicker objects.

- (jQuery).jPicker.List[] -



-

jPicker Color Class

-

- Definition of the jPicker.Color class.
-

-(jQuery).jPicker.Color()
-(jQuery).jPicker.Color({ ahex: 'ffffffff' })
-(jQuery).jPicker.Color({ hex: 'ffffff', [a: (0-255)] })
-(jQuery).jPicker.Color({ r: (0-255), g: (0-255), b: (0-255), [a: (0-255)] })
-(jQuery).jPicker.Color({ h: (0-360), s: (0-100), v: (0-100), [a: (0-255)] })
-{
-  val: function(name, value, context),
-  bind: function(callback) where callback is function(color, [context]),
-  unbind: function(callback)
-}
-
-method "val" usage
-
-val(name) : get value
-
-  'r':     red         (0-255)
-  'g':     green       (0-255)
-  'b':     blue        (0-255)
-  'a':     alpha       (0-255)
-  'h':     hue         (0-360)
-  's':     saturation  (0-100)
-  'v':     value       (0-100)
-  'hex':   hex         (000000-ffffff)
-  'ahex':  ahex        (00000000-ffffffff)
-  'all':   all         all
-  
-  ex. Usage
-
-    val('r'):     (0-255)
-    val('h'):     (0-360)
-    val('hex'):   (000000-ffffff)
-    val('rg'):    { r: (0-255), g: (0-255) }
-    val('rgba'):  { r: (0-255), g: (0-255), b: (0-255), a: (0-255) }
-    val('hvga'):  { h: (0-255), v: (0-100), g: (0-255), a: (0-255) }
-    val('all'):   { r: (0-255), g: (0-255), b: (0-255), a: (0-255), h: (0-360) --
-                    s: (0-100), v: (0-100), hex: (000000-ffffff), --
-                    ahex: (00000000-ffffffff) }
-
-val(name, value, [context]) : set value
-
-  'r':     red         (0-255)
-  'g':     green       (0-255)
-  'b':     blue        (0-255)
-  'a':     alpha       (0-255)
-  'h':     hue         (0-360)
-  's':     saturation  (0-100)
-  'v':     value       (0-100)
-  'hex':   hex         (000000-ffffff)
-  'ahex':  ahex        (00000000-ffffffff)
-  
-  ex. Usage
-
-    val('r', (0-255)) || val('r', { r: (0-255) })
-    val('h', (0-360)) || val('h', { h: (0-360) })
-    val('hex', (000000-ffffff)) || val('hex', { hex: (000000-ffffff) })
-    val('rg', { r: (0-255), g: (0-255) })
-    val('rgba', { r: (-255), g: (0-255), b: (0-255), a: (0-255) })
-    val(null, { r: (0-255), g: (0-255) })
-    val('hvga'):  incorrect usage - cannot set hsv AND rgb as they will conflict
-



-

jPicker ColorMethod Utility Class

-

- Static methods for altering and retrieving different color spaces.
-

-(jQuery).jPicker.ColorMethods.hexToRgba:
-    function(hex)
-    returns { r: (0-255), g: (0-255), b: (0-255), a: (0-255) }
-    
-(jQuery).jPicker.ColorMethods.validateHex:
-    function(hex)
-    returns new hex string
-    
-(jQuery).jPicker.ColorMethods.rgbaToHex:
-    function({ r: (0-255), g: (0-255), b: (0-255), a: (0-255) })
-    returns hex string
-    
-(jQuery).jPicker.ColorMethods.intToHex:
-    function(number)
-    returns hex string
-    
-(jQuery).jPicker.ColorMethods.hexToInt:
-    function(hex)
-    return integer
-
-(jQuery).jPicker.ColorMethods.rgbToHsv:
-    function({ r: (0-255), g: (0-255), b: (0-255) })
-    returns { h: (0-360), s: (0-100), v: (0-100) }
-
-(jQuery).jPicker.ColorMethods.hsvToRgb:
-    function({ h: (0-360), s: (0-100), v: (0-100) })
-    returns { r: (0-255), g: (0-255), b: (0-255) }
-
-



-

Known Issues

-
    -
  • -

    Attaching multiple jPicker objects on a single page will slow performance.

    -
      -
    • jPicker creates a new instance of the picker for every element. Performance will suffer when binding dozens of instances.
    • -
    -
  • -

-

Coming Soon

-
    -
  • -
      -
    • Will consider supporting jQuery ThemeRoller CSS API for theming the UI if demand exists.
    • -
    -
  • -

-

Planned For Future Release

-
    -
  • - Move the jPicker object to a single instance that all selection instances point to. -
      -
    • This will result in much faster operation and initialization for pages with multiple pickers.
    • -
    -
  • -
  • Add activateCallback option for calling a callback function when the jPicker is activated or its binding is switched to a different picker element.
  • -

-

Change Log

-
    -
  • -

    V1.1.5:

    -
      -
    • Corrected Color object constructor to allow setting of the "alpha" value as per the documentation which previously didn't work.
    • -
    • Added support for translucency for quickList colors with checkered background - Only available if "alphaSupport" is enabled.
    • -
    • Restricted default color to "alpha" of 255 if "alphaSupport" is disabled - It will now assign an explicit alpha of 255 when disabled.
    • -
    • Added new setting variable "alphaPrecision" which indicates the number of decimal points to allow in the alpha percentage display - Now defaults to 0.
    • -
    -
  • -
  • -

    V1.1.4:

    -
      -
    • Changed "alpha" range from 0-100 to 0-255 to correct truncating and rounding errors caused by attempting to get an integer percentage that matches a hex value.
    • -
    • "alpha" percentage display will now show up to 1 decimal point for more accurate representation of "alpha" value.
    • -
    • Color object now accepts "alpha" values in a range of 0-255 and also returns the same when getting the "alpha" value. You will need to run ((alpha * 100) / 255) to retrieve a percentage value.
    • -
    • Reworked the table layout and labels to remove the need for the label to reference the radio input box. This reduces injected code and removes the need to generate unique ids on the radio buttons.
    • -
    • Transparent/invisible caret on NULL color is now corrected - uses the same caret color as a white color.
    • -
    • Setting a binded input value of "" or no value attribute will now create a NULL color on initialization instead of the settings default color.
    • -
    • Added a dynamic, invisible "iframe" behind a dialog picker in all browsers that fail jQuery.support.boxModel (currently IE <= 7 Quirks Mode). This prevents "select" box from showing through the picker.
    • -
    -
  • -
  • -

    V1.1.3:

    -
      -
    • Now adding popup color pickers to document.body instead of inline with the popup control. This corrects issues with the picker not showing beyond a relative container scope.
    • -
    • No longer need to hide popup icon in Internet Explorer for picker elements lower in the DOM than the currently active one since the picker itself is attached to document.body (it is always higher in the DOM now).
    • -
    • Popup pickers are now bring-to-front selectable. Clicking on the picker will bring it above all other pickers on the page instead of having to drag one out from underneath another.
    • -
    • Corrected jPicker.List/setTimeout bug which allowed an instance to bind to the List in an order other than the order the initialization function was called.
    • -
    • Added a updateInputColor option (default true) to allow for a binded input field that does not automatically update its background/text color.
    • -
    -
    -
  • -
  • -

    V1.1.2:

    -
      -
    • Reworked the find methods and contexts for element searches. Now using ":first" instead of ".eq(0)" to take advantage of early out searches. Much faster initialization of the picker, on the order of 6 times.
    • -
    • Now using setTimeout for calling visual updates. Dramatically improved marker dragging in all browsers. Reduces blocking as re-rendering is internal to the browser and independent of the other javascript still in progress.
    • -
    • Marker updates can now cancel a previous valueChanged event when a new mouseMove event comes in. IE8 marker dragging is still slower, much over 5 times faster than it was.
    • -
    • Reworked entire quickPick list creation. It now adds up source code and does a single "html" method instead of multiple "append" methods. This is a large part of the speed increase on initialization.
    • -
    • The vast majority of all running scripts on both initialization and dragging is now occupied altering the style rules and finding elements (init only) instead of jPicker code.
    • -
    • All methods previously called with global context now use the "call" method for using the context of the class running the method. "this" in a callback is now the DOM node (jQuery style) and jPicker instead of "window".
    • -
    • Added "effects" section of window settings to allow different show/hide effects and durations.
    • -
    • Removed change log and read me from the full source code to separate files (ChangeLog.txt and ReadMe.txt) and an HTML demonstration/documentation page (Example.txt).
    • -
    -
    -
  • -
  • -

    V1.1.1:

    -
      -
    • Correct IE exception caused by attempting to set "#transparent" to CSS background-color.
    • -
    -
    -
  • -
  • -

    V1.1.0:

    -
      -
    • Reworked nearly the entire plugin including the internal and external event model, bindings, DOM searches, classes, and overall presentation.
    • -
    • The Color object now supports a changed event that you can bind to (or just bind to the picker events still included).
    • -
    • Event order has been reversed, instead of an change event on the map/bar/text fields updating the display, they now update the Color object which then fires the events that update the display.
    • -
    • alphaSupport re-implemented by request - default behavior is off.
    • -
    • Hex code now only 6 characters again.
    • -
    • Color object can now have its value changed from code, using the "val" method, and it will fire all events necessary to update the display.
    • -
    • Removed all "get_*" methods from the color object, instead opting for a single "val" method for getting and setting, more in line with familiar jQuery methods.
    • -
    • Better rendering for all IE versions in Quirks mode.
    • -
    -
    -
  • -
  • -

    V1.0.13:

    -
      -
    • Updated transparency algorithm for red/green/blue color modes. The algorithm from John Dyers' color picker was close but incorrect. Bar colors are now pixel perfect with the new algorithm.
    • -
    • Changed from using "background-position" on the color maps to an element of full height using the "top" attribute for image-map location using "overflow: hidden" to hide overdraw.
    • -
    • IE7/8 ignores opacity on elements taller than 4096px. Image maps therefore no longer include a blank first map so the Bar is just under 4096. Blank is now accomplished by setting the "top" setting to below the map display.
    • -
    • New colorBar picker image that does not draw outside of the element since the elements now hide overdraw.
    • -
    • Added IE5.5/6 support for the picker. This is why it now uses maps of full height and the "top" attribute for map locations.
    • -
    • Moved the images in the maps to 4 pixels apart from each other. IE7/8 change the first pixel of the bottom-border of 2px to partially transparent showing a portion of a different color map without this.
    • -
    -
    -
  • -
  • -

    V1.0.12:

    -
      -
    • Added minified CSS file.
    • -
    • Added IE7/8 Quirks Mode support.
    • -
    • Added configurable string constants for all text and tooltips. You can now change the default values for different languages.
    • -
    • Privatized the RGBA values in the Color object for better NULL handling. YOU MUST USE THE NEW GET FUNCTIONS TO ACCESS THE COLOR PROPERTIES.
    • -
    • Better NULL color handling and an additional "No Color Selected" quick pick color.
    • -
    • More consistent behavior across multiple versions of browsers.
    • -
    • Added alpha response to the binded color picker icon.
    • -
    • Removed "alphaSupport" variable. It is now always supported.
    • -
    -
    -
  • -
  • -

    V1.0.11b:

    -
      -
    • Corrected NULL behavior in IE. jQuery was getting an exception when attempting to assign a backgroundColor style of '#'. Now assigns 'transparent' if color is NULL.
    • -
    • Can now create new Color object WITH OR WITHOUT the '#' prefix.
    • -
    -
    -
  • -
  • -

    V1.0.11:

    -
      -
    • Added ability for NULL colors (delete the hex value). Color will be returned as color.hex == ''. Can set the default color to an empty hex string as well.
    • -
    • cancelCallback now returns the original color for use in programming responses.
    • -
    -
    -
  • -
  • -

    V1.0.10:

    -
      -
    • Corrected table layout and tweaked display for more consisent presentation. Nice catch from Jonathan Pasquier.
    • -
    -
    -
  • -
  • -

    V1.0.9:

    -
      -
    • Added optional title variable for each jPicker window.
    • -
    -
    -
  • -
  • -

    V1.0.8:

    -
      -
    • Moved all images into a few sprites - now using backgroundPosition to change color maps and bars instead of changing the image - this should be faster to download and run.
    • -
    -
    -
  • -
  • -

    V1.0.7:

    -
      -
    • RENAMED CSS FILE TO INCLUDE VERSION NUMBER!!! YOU MUST USE THIS VERSIONED CSS FILE!!! There will be no need to do your own CSS version number increments from now on.
    • -
    • Added opacity feedback to color preview boxes.
    • -
    • Removed reliance on "id" value of containing object. Subobjects are now found by class and container instead of id's. This drastically reduces injected code.
    • -
    • Removed (jQuery).jPicker.getListElementById(id) function since "id" is no longer incorporated or required.
    • -
    -
    -
  • -
  • -

    V1.0.6:

    -
      -
    • Corrected picker bugs introduced with 1.0.5.
    • -
    • Removed alpha slider bar until activated - default behavior for alpha is now OFF.
    • -
    • Corrected Color constructor bug not allowing values of 0 for initial value (it was evaluating false and missing the init code - Thanks Pavol).
    • -
    • Removed title tags (tooltips) from color maps and bars - They get in the way in some browsers (e.g. IE - dragging marker does NOT prevent or hide the tooltip).
    • -
    • THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!!
    • -
    -
    -
  • -
  • -

    V1.0.5:

    -
      -
    • Added opacity support to picker and color/callback methods. New property "a" (alpha - range from 0-100) in all color objects now - defaults to 100% opaque. (Thank you Pavol)
    • -
    • Added title attributes to input elements - gives short tooltip directions on what button or field does.
    • -
    • Commit callback used to fire on control initialization (twice actually) - This has been corrected, it does not fire on initialization.
    • -
    • THERE WERE CSS FILE CHANGES WITH THIS UPDATE!!! IF YOU USE NEVER-EXPIRE HEADERS, YOU WILL NEED TO INCREMENT YOUR CSS FILE VERSION NUMBER!!!
    • -
    -
    -
  • -
  • -

    V1.0.4:

    -
      -
    • Added ability for smaller picker icon with expandable window on any DOM element (not just input).
    • -
    • "draggable" property renamed to "expandable" and its scope increased to create small picker icon or large static picker.
    • -
    -
    -
  • -
  • -

    V1.0.3

    -
      -
    • Added cancelCallback function for registering an external function when user clicks cancel button. (Thank you Jeff and Pavol)
    • -
    -
    -
  • -
  • -

    V1.0.2

    -
      -
    • Random bug fixes - speed concerns.
    • -
    -
    -
  • -
  • -

    V1.0.1

    -
      -
    • Corrected closure based memeory leak - there may be others?
    • -
    -
    -
  • -
  • -

    V1.0.0

    -
      -
    • First Release.
    • -
    -
    -
  • -
-
- - \ No newline at end of file diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 42fc9cd2a1ac4..90d0afca1ba28 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -740,7 +740,7 @@ private function _save() // Add the image to the Manifest (which maintains a list of images, necessary to avoid "Corrupt ODT file. Repair?" when opening the file with LibreOffice) $this->addImageToManifest($imageValue); } - if (! $this->file->addFromString('./META-INF/manifest.xml', $this->manifestXml)) { + if (! $this->file->addFromString('META-INF/manifest.xml', $this->manifestXml)) { throw new OdfException('Error during file export: manifest.xml'); } $this->file->close(); diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 483e98a4fbaff..65901dcd91e9e 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -268,6 +268,8 @@ ALTER TABLE llx_ticket ADD COLUMN origin_references text DEFAULT NULL; ALTER TABLE llx_expensereport MODIFY COLUMN model_pdf varchar(255) DEFAULT NULL; ALTER TABLE llx_fichinter_rec MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; +ALTER TABLE llx_hrm_evaluation MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; + ALTER TABLE llx_societe ADD COLUMN geolat double(24,8) DEFAULT NULL; ALTER TABLE llx_societe ADD COLUMN geolong double(24,8) DEFAULT NULL; ALTER TABLE llx_societe ADD COLUMN geopoint point DEFAULT NULL; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 9b4d9c7e17a87..c444d7fa667e3 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -313,7 +313,7 @@ drop table tmp_societe_double; -- Sequence to removed duplicated values of llx_accounting_account. Run several times if you still have duplicate. drop table tmp_accounting_account_double; --select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2; -create table tmp_accounting_account_double as (select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2); +create table tmp_accounting_account_double as (select account_number, fk_pcg_version, entity, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version, entity having count(rowid) >= 2); --select * from tmp_accounting_account_double; delete from llx_accounting_account where (rowid) in (select max_rowid from tmp_accounting_account_double); --update to avoid duplicate, delete to delete drop table tmp_accounting_account_double; diff --git a/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql b/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql index 0bf20b1b48efc..6f8aead90c888 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo-mrp.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) ---Put here your own copyright and developer email--- +-- Copyright (C) 2024 Laurent Destailleur -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql index cad0d9ffd7933..da8e70b6375f7 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.key.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson +-- Copyright (C) 2024 Laurent Destailleur -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql index 96dc828134e63..bcabab0d61799 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields-mrp.sql @@ -1,4 +1,4 @@ --- Copyright (C) 2019 Alicealalalamdskfldmjgdfgdfhfghgfh Adminson +-- Laurent Destailleur -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e3d6f60d66626..cc9cd9963bf7c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2393,7 +2393,6 @@ INVOICE_ADD_SWISS_QR_CODE=Show the swiss QR-Bill code on invoices (with a bank a INVOICE_ADD_SWISS_QR_CODEMore=Switzerland's standard for invoices; make sure ZIP & City are filled and that the accounts have valid Swiss/Liechtenstein IBANs. INVOICE_ADD_EPC_QR_CODE=Show the EPC QR code on invoices (with a bank account defined for credit transfer) INVOICE_ADD_EPC_QR_CODEMore=This feature allows you to add or remove an EPC QR Code on your invoices, which facilitates automatic SEPA credit transfers. Enabling this option helps your clients make payments easily by scanning the QR code, reducing manual entry errors. Use this feature if you have clients in countries like Austria, Belgium, Finland, Germany, and the Netherlands where this system is supported. Disable it if it's not required for your business operations or client base. -INVOICE_ADD_EPC_QR_CODEPay=Scan this QR code to pay with a smartphone supporting payment with EPC QR code. INVOICE_SHOW_SHIPPING_ADDRESS=Show shipping address INVOICE_SHOW_SHIPPING_ADDRESSMore=Compulsory indication in some countries (France, ...) SUPPLIER_PROPOSAL_ADD_BILLING_CONTACT=Show billing contact on proposal diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index c41cadb34bc49..1ede99d2278dc 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -669,3 +669,4 @@ SearchValidatedSupplierInvoicesWithDate=Search unpaid supplier invoices with a v SendEmailsRemindersOnSupplierInvoiceDueDate=Send reminder by email for validated and unpaid supplier invoices PaymentMadeForSeveralInvoices=Payment made for several invoices SituationInvoiceProgressCurrent=Invoice progress +INVOICE_ADD_EPC_QR_CODEPay=Scan this QR code to pay with a smartphone supporting payment with EPC QR code. diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 11d2bd69cac51..2e18fb389b3f4 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -141,6 +141,7 @@ ErrorFieldCantBeNegativeOnInvoice=Field %s cannot be negative o ErrorLinesCantBeNegativeForOneVATRate=Total of lines (net of tax) can't be negative for a given not null VAT rate (Found a negative total for VAT rate %s%%). ErrorLinesCantBeNegativeOnDeposits=Lines can't be negative in a deposit. You will face problems when you will need to consume the deposit in final invoice if you do so. ErrorQtyForCustomerInvoiceCantBeNegative=Quantity for line into customer invoices can't be negative +ErrorQtyForSupplierInvoiceCantBeNegative=Quantity for line into supplier invoices can't be negative ErrorWebServerUserHasNotPermission=User account %s used to execute web server has no permission for that ErrorNoActivatedBarcode=No barcode type activated ErrUnzipFails=Failed to unzip %s with ZipArchive @@ -341,6 +342,7 @@ ErrorEndHourIsNull=End date field cannot be empty ErrorStartHourIsNull=Start date field cannot be empty ErrorTooManyLinesToProcessPleaseUseAMoreSelectiveFilter=Too many lines to process. Please use a more selective filter. ErrorEmptyValueForQty=Quantity cannot be zero. +ErrorStreamMustBeEnabled=The PHP stream %s is not available. Check your PHP modules and Dolibarr parameter $dolibarr_main_stream_to_disable. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. @@ -390,6 +392,9 @@ WarningReadBankAlsoAllowedIfUserHasPermission=Warning, reading bank account is a WarningNoDataTransferedInAccountancyYet=Please note, there is no data in the accounting table. Please transfer your data recorded in the application to the accounting section or change the calculation mode to analyze the data recorded outside of accounting. WarningChangingThisMayBreakStopTaskScheduler=Warning, changing this value may disable the scheduler WarningAmountOfFileDiffersFromSumOfLines=Warning, amount of file (%s) differs from the sum of lines (%s) +WarningModuleAffiliatedToAReportedCompany=Warning, this module has been reported to the Dolibarr foundation as being published by a company using illegal practices (non-compliance with the rules for using the Dolibarr brand, collecting your data without your consent or deploying malware). Use it at your own risk! +WarningModuleAffiliatedToAPiratPlatform=Be careful when getting a module (paid or free) from a suspicious non official platform like %s + SwissQrOnlyVIR = SwissQR invoice can only be added on invoices set to be paid with credit transfer payments. SwissQrCreditorAddressInvalid = Creditor address is invalid (are ZIP and city set? (%s) SwissQrCreditorInformationInvalid = Creditor information is invalid for IBAN (%s): %s diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index adf8ed60dff16..2a6c1d4fe2932 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -9,6 +9,8 @@ NewSalary=New salary AddSalary=Add salary NewSalaryPayment=New salary card AddSalaryPayment=Add salary payment +SalaryID=Salary ID +SalaryAmount=Salary amount SalaryPayment=Salary payment SalariesPayments=Salaries payments SalariesPaymentsOf=Salaries payments of %s diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 7b7c9b3e99cb0..1506e58d4e0d5 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -358,10 +358,10 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $odfHandler = new Odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->mymodule->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->mymodule->dir_temp, + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch (Exception $e) { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7ceeab47c0f9b..be70a2625388c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1983,7 +1983,7 @@ foreach ($arraypricelevel as $key => $value) { if (!empty($arrayfields['p.sellprice'.$key]['checked'])) { print ''; - if (!empty($productpricescache[$obj->rowid])) { + if (!empty($productpricescache[$obj->rowid]) && isset($productpricescache[$obj->rowid][$key]['price_base_type'])) { if ($productpricescache[$obj->rowid][$key]['price_base_type'] == 'TTC') { print ''.price($productpricescache[$obj->rowid][$key]['price_ttc']).' '.$langs->trans("TTC").''; } else { diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ce3f73e148aaf..4ed9db8e735d7 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -960,8 +960,8 @@ public function delete($user, $notrigger = 0) 'fichinter' => 'fk_projet', 'don' => array('field' => 'fk_projet', 'module' => 'don'), 'actioncomm' => 'fk_project', - 'mrp_mo' => 'fk_project', - 'entrepot' => 'fk_project' + 'mrp_mo' => array('field' => 'fk_project', 'module' => 'mrp'), + 'entrepot' => 'fk_project', ); foreach ($listoftables as $key => $value) { if (is_array($value)) { diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 0820c33a2f608..fcc9a00e72a70 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -70,10 +70,10 @@ unset($_SESSION['track_id_customer']); unset($_SESSION['email_customer']); } -if (isset($_SESSION['track_id_customer'])) { +if (empty($track_id) && isset($_SESSION['track_id_customer'])) { $track_id = $_SESSION['track_id_customer']; } -if (isset($_SESSION['email_customer'])) { +if (empty($email) && isset($_SESSION['email_customer'])) { $email = strtolower($_SESSION['email_customer']); } @@ -210,6 +210,7 @@ // Store current page url $url_page_current = dol_buildpath('/public/ticket/list.php', 1); + $contextpage = $url_page_current; // Do we click on purge search criteria ? if (GETPOST("button_removefilter_x")) { diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index ed7f393d56e37..ea5794ed324f2 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1083,6 +1083,11 @@ public function delete(User $user) $mouvS->origin = null; $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed + if ($result < 0) { + $error++; + $this->error = $mouvS->error; + $this->errors = $mouvS->errors; + } } } else { $error++; diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index 7bea09384ef9a..def8d1843d0ca 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -353,7 +353,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails $srctemplatepath, array( 'PATH_TO_TMP' => $conf->recruitment->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'ZIP_PROXY' => getDolGlobalString('MAIN_ODF_ZIP_PROXY', 'PclZipProxy'), // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' ) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 96d414b1d120c..cea7ce1948f24 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2011-2024 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -343,6 +343,7 @@ public function fetch($id) $this->datec = $this->db->jdate($obj->datec); $this->tms = $this->db->jdate($obj->tms); $this->datepaye = $this->db->jdate($obj->datep); + $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; $this->fk_typepayment = $obj->fk_typepayment; $this->num_paiement = $obj->num_payment; diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index 5f30b4fb11821..a15fb006e1057 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -4,7 +4,9 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW * Copyright (C) 2024 Alexandre SPANGARO + * Copyright (C) 2024 Frédéric France * * 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 diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index eb49f75e8da6c..6931f6d7d7656 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2077,7 +2077,7 @@ public function fetch($rowid, $ref = '', $ref_ext = '', $barcode = '', $idprof1 $this->model_pdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; - $result = 1; + $result = $this->id; // fetch optionals attributes and labels $this->fetch_optionals(); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 21d4f6bd01418..df0efa5139472 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1903,6 +1903,7 @@ $userstatic->user_mobile = $val['user_mobile']; $userstatic->job = $val['job']; $userstatic->gender = $val['gender']; + $userstatic->statut = $val['statut']; print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); $j++; if ($j < $nbofsalesrepresentative) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 97af0c4d022ec..ed793371f70f2 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1694,7 +1694,7 @@ print ''; - if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) { + if ($action != 'editdate_livraison' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { print ''; } print '
'; print $langs->trans('DeliveryDate'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).'
'; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index a0c72cdd55fae..a92bc4cac5302 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -597,7 +597,7 @@ function CloseBill() { if (!empty($conf->global->TAKEPOS_FORBID_SALES_TO_DEFAULT_CUSTOMER)) { echo "customerAnchorTag = document.querySelector('a[id=\"customer\"]'); "; echo "if (customerAnchorTag && customerAnchorTag.innerText.trim() === '".$langs->trans("Customer")."') { "; - echo "alert('".$langs->trans("NoClientErrorMessage")."'); "; + echo "alert('".dol_escape_js($langs->trans("NoClientErrorMessage"))."'); "; echo "return; } \n"; } ?>