From 5b52dc9f0470d3ae64de8cc13ebb8ebdfb60350e Mon Sep 17 00:00:00 2001 From: hystepik Date: Tue, 31 Jan 2023 10:43:58 +0100 Subject: [PATCH 001/300] Fix : stripe sepa payment process --- htdocs/core/class/commoninvoice.class.php | 137 +++------------------- htdocs/langs/en_US/bills.lang | 2 + htdocs/public/stripe/ipn.php | 101 +++++++++++++++- htdocs/stripe/class/stripe.class.php | 24 ++-- 4 files changed, 129 insertions(+), 135 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index d1eb324cc7f..0f38b39e0af 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -92,6 +92,10 @@ abstract class CommonInvoice extends CommonObject */ const STATUS_ABANDONED = 3; + /** + * Classified processing because payment requested + */ + const STATUS_PROCESSING = 4; public $totalpaid; // duplicate with sumpayed public $totaldeposits; // duplicate with sumdeposit @@ -610,6 +614,10 @@ abstract class CommonInvoice extends CommonObject $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially'); $statusType = 'status9'; + } elseif ($status == 4) { + $labelStatus = $langs->transnoentitiesnoconv('BillStatusRequestProcessing'); + $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusRequestProcessing'); + $statusType = 'status3'; } elseif ($alreadypaid == 0) { $labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid'); @@ -900,9 +908,9 @@ abstract class CommonInvoice extends CommonObject $sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn"; $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; - $sql .= " AND fk_facture = ".((int) $this->fk_facture); // Add a protection to not pay another invoice than current one - $sql .= " AND traite = 0"; // Add a protection to not process twice $sql .= " WHERE rowid = ".((int) $did); + $sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one + $sql .= " AND traite = 0"; // Add a protection to not process twice dol_syslog(get_class($this)."::makeStripeSepaRequest 1", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1186,126 +1194,11 @@ abstract class CommonInvoice extends CommonObject // Default description used for label of event. Will be overwrite by another value later. $description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG; - - // @TODO LMR Save request to status pending instead of done. Done should be set with a webhook. - - - $db = $this->db; - - $ipaddress = getUserRemoteIP(); - - $TRANSACTIONID = $charge->id; - $currency = $conf->currency; - $paymentmethod = 'stripe'; - $emetteur_name = $charge->customer; - - // Same code than into paymentok.php... - - $paymentTypeId = 0; - if ($paymentmethod == 'paybox') { - $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS; - } - if ($paymentmethod == 'paypal') { - $paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS; - } - if ($paymentmethod == 'stripe') { - $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; - } - if (empty($paymentTypeId)) { - //erics - if ($sepaMode) { - $paymentType = 'PRE'; - } else { - $paymentType = $_SESSION["paymentType"]; - if (empty($paymentType)) { - $paymentType = 'CB'; - } - } - $paymentTypeId = dol_getIdFromCode($this->db, $paymentType, 'c_paiement', 'code', 'id', 1); - } - - $currencyCodeType = $currency; - - $ispostactionok = 1; - - // Creation of payment line - // TODO LMR This must be move into the stripe server listening hooks public/stripe/ipn.php - include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; - $paiement = new Paiement($this->db); - $paiement->datepaye = $now; - $paiement->date = $now; - if ($currencyCodeType == $conf->currency) { - $paiement->amounts = [$this->id => $amounttopay]; // Array with all payments dispatching with invoice id - } else { - $paiement->multicurrency_amounts = [$this->id => $amounttopay]; // Array with all payments dispatching - - $postactionmessages[] = 'Payment was done in a different currency than currency expected of company'; - $ispostactionok = -1; - // Not yet supported, so error + $result =$this->setStatut($this::STATUS_PROCESSING); + if ($result < 0) { $error++; $errorforinvoice++; - } - $paiement->paiementid = $paymentTypeId; - $paiement->num_paiement = ''; - $paiement->num_payment = ''; - // Add a comment with keyword 'SellYourSaas' in text. Used by trigger. - $paiement->note_public = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; - $paiement->note_private = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; - $paiement->ext_payment_id = $charge->id . ':' . $customer->id . '@' . $stripearrayofkeys['publishable_key']; - $paiement->ext_payment_site = 'stripe'; - - if (!$errorforinvoice) { - dol_syslog('* Record payment for invoice id ' . $this->id . '. It includes closing of invoice and regenerating document'); - - // This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document - $paiement_id = $paiement->create($user, 1); - if ($paiement_id < 0) { - $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); - $ispostactionok = -1; - $error++; - $errorforinvoice++; - } else { - $postactionmessages[] = 'Payment created'; - } - - dol_syslog("The payment has been created for invoice id " . $this->id); - } - - if (!$errorforinvoice && isModEnabled('banque')) { - dol_syslog('* Add payment to bank'); - - // The bank used is the one defined into Stripe setup - $bankaccountid = 0; - if ($paymentmethod == 'stripe') { - $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; - } - - if ($bankaccountid > 0) { - $label = '(CustomerInvoicePayment)'; - if ($this->type == Facture::TYPE_CREDIT_NOTE) { - $label = '(CustomerInvoicePaymentBack)'; - } // Refund of a credit note - $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $emetteur_name, ''); - if ($result < 0) { - $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); - $ispostactionok = -1; - $error++; - $errorforinvoice++; - } else { - $postactionmessages[] = 'Bank transaction of payment created (by makeStripeSepaRequest)'; - } - } else { - $postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.'; - $ispostactionok = -1; - $error++; - $errorforinvoice++; - } - } - - if ($ispostactionok < 1) { - $description = 'Stripe payment OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') but post action KO from makeStripeSepaRequest: ' . $FULLTAG; - } else { - $description = 'Stripe payment+post action OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') from makeStripeSepaRequest: ' . $FULLTAG; + $this->errors[] = 'Error on invoice status change to processing'; } } @@ -1563,13 +1456,13 @@ abstract class CommonInvoice extends CommonObject $idtransferfile = 0; // Update the direct debit payment request of the processed invoice to save the id of the prelevement_bon - $sql = "UPDATE".MAIN_DB_PREFIX."prelevement_demande SET"; + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET"; $sql .= " traite = 1,"; // TODO Remove this $sql .= " date_traite = '".$this->db->idate(dol_now())."'"; // TODO Remove this if ($idtransferfile > 0) { $sql .= " fk_prelevement_bons = ".((int) $idtransferfile); } - $sql .= "WHERE rowid = ".((int) $did); + $sql .= " WHERE rowid = ".((int) $did); dol_syslog(get_class($this)."::makeStripeSepaRequest", LOG_DEBUG); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 183620c72da..40adce33c66 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -148,6 +148,8 @@ BillShortStatusNotPaid=Not paid BillShortStatusNotRefunded=Not refunded BillShortStatusClosedUnpaid=Closed BillShortStatusClosedPaidPartially=Paid (partially) +BillStatusRequestProcessing=Payment request processing +BillShortStatusRequestProcessing=Processing PaymentStatusToValidShort=To validate ErrorVATIntraNotConfigured=Intra-Community VAT number not yet defined ErrorNoPaiementModeConfigured=No default payment type defined. Go to Invoice module setup to fix this. diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index dd5b1db148f..b41149a88f8 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -72,7 +72,9 @@ if (isset($_GET['connect'])) { $servicestatus = 1; } } - +$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY; +$service = 'StripeTest'; +$servicestatus = 0; if (empty($conf->stripe->enabled)) { httponly_accessforbidden('Module Stripe not enabled'); } @@ -300,6 +302,103 @@ if ($event->type == 'payout.created') { } elseif ($event->type == 'payment_intent.succeeded') { // Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). // TODO: create fees // TODO: Redirect to paymentok.php + include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; + $object = $event->data->object; + $invoice_id = $object->metadata->dol_id; + $ipaddress = $object->metadata->ipaddress; + $invoice_amount = $object->amount / 100; + $TRANSACTIONID = $object->id; + $customer_id = $object->customer; + $errorforinvoice = 0; + $paymentmethod = 'stripe'; + $now = dol_now(); + $currencyCodeType = strtoupper($object->currency); + $paymentmethodstripeid = $object->payment_method; + + global $stripearrayofkeysbyenv; + $stripeacc = $stripearrayofkeysbyenv[$servicestatus]['secret_key']; + + dol_syslog("Try to create sepa_debit with data = ".json_encode($dataforcard)); + + $s = new \Stripe\StripeClient($stripeacc); + + $paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid); + + //$paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; + $paymentTypeId = $paymentmethodstripe->type; + if ($paymentTypeId == "sepa_debit") { + $paymentTypeId = "BANCON"; + } elseif ($paymentTypeId == "card") { + $paymentTypeId = "CB"; + } + + $paiement = new Paiement($db); + $paiement->datepaye = $now; + $paiement->date = $now; + if ($currencyCodeType == $conf->currency) { + $paiement->amounts = [$invoice_id => $invoice_amount]; // Array with all payments dispatching with invoice id + } else { + $paiement->multicurrency_amounts = [$invoice_id => $invoice_amount]; // Array with all payments dispatching + + $postactionmessages[] = 'Payment was done in a different currency than currency expected of company'; + $ispostactionok = -1; + // Not yet supported, so error + $error++; + $errorforinvoice++; + } + $paiement->paiementid = $paymentTypeId; + $paiement->num_paiement = ''; + $paiement->num_payment = ''; + // Add a comment with keyword 'SellYourSaas' in text. Used by trigger. + $paiement->note_public = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; + $paiement->note_private = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; + $paiement->ext_payment_id = $TRANSACTIONID . ':' . $customer_id . '@' . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']; + $paiement->ext_payment_site = 'stripe'; + + if (!$errorforinvoice) { + dol_syslog('* Record payment for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document'); + + // This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document + $paiement_id = $paiement->create($user, 1); + if ($paiement_id < 0) { + $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } else { + $postactionmessages[] = 'Payment created'; + } + + dol_syslog("The payment has been created for invoice id " . $invoice_id); + } + + if (!$errorforinvoice && isModEnabled('banque')) { + dol_syslog('* Add payment to bank'); + + // The bank used is the one defined into Stripe setup + $bankaccountid = 0; + if ($paymentmethod == 'stripe') { + $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; + } + + if ($bankaccountid > 0) { + $label = '(CustomerInvoicePayment)'; + $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, ''); + if ($result < 0) { + $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } else { + $postactionmessages[] = 'Bank transaction of payment created (by makeStripeSepaRequest)'; + } + } else { + $postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.'; + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } + } } elseif ($event->type == 'payment_intent.payment_failed') { // TODO: Redirect to paymentko.php } elseif ($event->type == 'checkout.session.completed') { // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index bc98a085d08..0684fb370b7 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -964,10 +964,9 @@ class Stripe extends CommonObject $dataforcard = array( 'type'=>'sepa_debit', "sepa_debit" => array('iban' => $iban), - 'currency' => strtolower($conf->currency), - 'usage' => 'reusable', - 'owner' => array( + 'billing_details' => array( 'name' => $soc->name, + 'email' => !empty($soc->email) ? $soc->email : "", ), "metadata" => array( 'dol_type'=>$object->element, @@ -979,19 +978,19 @@ class Stripe extends CommonObject ); // Complete owner name if (!empty($soc->town)) { - $dataforcard['owner']['address']['city']=$soc->town; + $dataforcard['billing_details']['address']['city']=$soc->town; } if (!empty($soc->country_code)) { - $dataforcard['owner']['address']['country']=$soc->country_code; + $dataforcard['billing_details']['address']['country']=$soc->country_code; } if (!empty($soc->address)) { - $dataforcard['owner']['address']['line1']=$soc->address; + $dataforcard['billing_details']['address']['line1']=$soc->address; } if (!empty($soc->zip)) { - $dataforcard['owner']['address']['postal_code']=$soc->zip; + $dataforcard['billing_details']['address']['postal_code']=$soc->zip; } if (!empty($soc->state)) { - $dataforcard['owner']['address']['state']=$soc->state; + $dataforcard['billing_details']['address']['state']=$soc->state; } //$a = \Stripe\Stripe::getApiKey(); @@ -1013,14 +1012,14 @@ class Stripe extends CommonObject $s = new \Stripe\StripeClient($stripeacc); - // TODO LMR Deprecated with the new Stripe API and SCA. - // TODO LMR Replace ->create() and ->createSource() and replace with ->getSetupIntent() to then, get the Payment mode with $payment_method = \Stripe\PaymentMethod::retrieve($setupintent->payment_method); ? - $sepa = $s->sources->create($dataforcard); + $sepa = $s->paymentMethods->create($dataforcard); if (!$sepa) { $this->error = 'Creation of sepa_debit on Stripe has failed'; } else { // link customer and src - $cs = $cu->createSource($cu->id, array('source' => $sepa->id)); + $cs = $s->setupIntents->create(['payment_method_types' => ['sepa_debit'], 'customer' => $cu->id]); + $cs = $s->setupIntents->update($cs->id, ['payment_method' => $sepa->id]); + $cs = $s->setupIntents->confirm($cs->id, ['mandate_data' => ['customer_acceptance' => ['type' => 'offline']]]); if (!$cs) { $this->error = 'Link SEPA <-> Customer failed'; } else { @@ -1040,6 +1039,7 @@ class Stripe extends CommonObject } } } catch (Exception $e) { + $sepa = null; $this->error = $e->getMessage(); dol_syslog($this->error, LOG_WARNING); } From 1e53f87d518070479e71b0236d65e5d21320b7f9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 8 Feb 2023 12:18:46 +0100 Subject: [PATCH 002/300] FIX: various PHP8 compatibility fixes --- htdocs/admin/agenda.php | 2 +- htdocs/admin/agenda_extsites.php | 2 +- htdocs/admin/agenda_other.php | 4 +-- htdocs/admin/agenda_xcal.php | 33 ++++++++++++++----- htdocs/admin/dav.php | 6 +++- htdocs/admin/facture.php | 8 +++-- htdocs/admin/payment.php | 6 ++-- .../core/class/commondocgenerator.class.php | 10 ++++++ .../modules/facture/mod_facture_mercure.php | 23 ++++++------- .../core/modules/payment/mod_payment_ant.php | 6 ++-- .../doc/doc_generic_proposal_odt.modules.php | 19 ++++++----- ..._generic_supplier_proposal_odt.modules.php | 19 ++++++----- .../mod_supplier_proposal_saphir.php | 8 +++-- .../user/doc/doc_generic_user_odt.modules.php | 17 ++++++---- .../doc/doc_generic_usergroup_odt.modules.php | 17 ++++++---- htdocs/dav/dav.lib.php | 2 +- htdocs/includes/tcpdi/tcpdi_parser.php | 4 +-- htdocs/main.inc.php | 2 ++ 18 files changed, 117 insertions(+), 71 deletions(-) diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 730983ad090..bd1bae40d19 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -197,7 +197,7 @@ if (!empty($triggers)) { print ''.$trigger['label'].''; print ''; $key = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; - $value = $conf->global->$key; + $value = getDolGlobalInt($key); print ''; print ''."\n"; } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 5567e741272..d6cb112810a 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -202,7 +202,7 @@ print ''.$langs->trans("AgendaExtSitesDesc")."\n"; -$selectedvalue=$conf->global->AGENDA_DISABLE_EXT; +$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT'); if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; print ""; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 8e50380e2ae..7a49d2def53 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -325,7 +325,7 @@ print ''."\n"; print ''."\n"; // Manual or automatic @@ -387,7 +387,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltex print ' '."\n"; $tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); -print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); +print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW')); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; -$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); +$formactions->form_select_status_action('agenda', getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'), 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); print '
'; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index ce36d97d06a..fc75042146f 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -38,6 +38,23 @@ $langs->loadLangs(array("admin", "other", "agenda")); $def = array(); $actionsave = GETPOST('save', 'alpha'); +$MAIN_AGENDA_XCAL_EXPORTKEY = getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY'); +$MAIN_AGENDA_EXPORT_PAST_DELAY = getDolGlobalInt('MAIN_AGENDA_EXPORT_PAST_DELAY'); +$MAIN_AGENDA_EXPORT_CACHE = getDolGlobalInt('MAIN_AGENDA_EXPORT_CACHE'); +$AGENDA_EXPORT_FIX_TZ = getDolGlobalString('AGENDA_EXPORT_FIX_TZ'); + +if (GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) { + $MAIN_AGENDA_XCAL_EXPORTKEY = trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')); +} +if (GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) { + $MAIN_AGENDA_EXPORT_PAST_DELAY = intval(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'int')); +} +if (GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) { + $MAIN_AGENDA_EXPORT_CACHE = intval(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'int')); +} +if (GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) { + $AGENDA_EXPORT_FIX_TZ = trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')); +} // Sauvegardes parametres if ($actionsave) { @@ -45,10 +62,10 @@ if ($actionsave) { $db->begin(); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')), 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', $MAIN_AGENDA_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', $MAIN_AGENDA_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', $MAIN_AGENDA_EXPORT_CACHE, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', $AGENDA_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity); if ($i >= 4) { $db->commit(); @@ -97,7 +114,7 @@ print ""; print ''; print ''.$langs->trans("PasswordTogetVCalExport").""; -print ''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); } @@ -107,13 +124,13 @@ print ""; print ''; print "".$langs->trans("PastDelayVCalExport").""; -print "global->MAIN_AGENDA_EXPORT_PAST_DELAY)."\" size=\"10\"> ".$langs->trans("days").""; +print " ".$langs->trans("days").""; print " "; print ""; print ''; print "".$langs->trans("UseACacheDelay").""; -print "global->MAIN_AGENDA_EXPORT_CACHE)."\" size=\"10\">"; +print ""; print " "; print ""; @@ -130,7 +147,7 @@ print ""; print ''; print ''.$langs->trans("FixTZ").""; print ""; -print ''; +print ''; print '   '.$langs->trans("FillThisOnlyIfRequired"); print ""; print ""; diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index e12848e3de1..a19ffa17b49 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -42,7 +42,7 @@ $arrayofparameters = array( 'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), - 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) + 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>! empty($conf->ecm->enabled)) ); // To fix when dire does not exists @@ -123,6 +123,10 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $key => $val) { + if (isset($val['enabled']) && empty($val['enabled'])) { + continue; + } + print ''; $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); $label = $langs->trans($key); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index ae269492ddf..756484289aa 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -323,7 +323,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -661,12 +661,14 @@ if (!empty($conf->banque->enabled)) { } print ""; +$FACTURE_CHQ_NUMBER = getDolGlobalInt('FACTURE_CHQ_NUMBER'); + print ''; print "".$langs->trans("SuggestPaymentByChequeToAddress").""; print ""; print '', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -84,17 +84,17 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of deposit $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; @@ -136,23 +136,20 @@ class mod_facture_mercure extends ModeleNumRefFactures */ public function getNextValue($objsoc, $invoice, $mode = 'next') { - global $db, $conf; + global $db; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Get Mask value $mask = ''; if (is_object($invoice) && $invoice->type == 1) { - $mask = $conf->global->FACTURE_MERCURE_MASK_REPLACEMENT; - if (!$mask) { - $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE; - } + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_REPLACEMENT', getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE')); } elseif (is_object($invoice) && $invoice->type == 2) { - $mask = $conf->global->FACTURE_MERCURE_MASK_CREDIT; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_CREDIT'); } elseif (is_object($invoice) && $invoice->type == 3) { - $mask = $conf->global->FACTURE_MERCURE_MASK_DEPOSIT; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_DEPOSIT'); } else { - $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE'); } if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 958074202fe..d59d7c47f6f 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -61,7 +61,7 @@ class mod_payment_ant extends ModeleNumRefPayments */ public function info() { - global $db, $conf, $langs; + global $db, $langs; $langs->load("bills"); @@ -82,7 +82,7 @@ class mod_payment_ant extends ModeleNumRefPayments // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -128,7 +128,7 @@ class mod_payment_ant extends ModeleNumRefPayments require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->PAYMENT_ANT_MASK; + $mask = getDolGlobalString('PAYMENT_ANT_MASK'); if (!$mask) { $this->error = 'NotConfigured'; 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 66e2f3c8312..ab03b04b86e 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 @@ -117,13 +117,16 @@ class doc_generic_proposal_odt extends ModelePDFPropales $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('PROPALE_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= '
'; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -133,7 +136,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROPALE_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -159,7 +162,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -167,7 +170,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Scan directories $nbofiles = count($listoffiles); - if (!empty($conf->global->PROPALE_ADDON_PDF_ODT_PATH)) { + if (!empty($odtPath)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; $texte .= count($listoffiles); @@ -184,26 +187,26 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= '
'; // Set default template for different status of proposal - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFPropales::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } 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 04f6ed49012..0cfcd91a350 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 @@ -118,13 +118,16 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -134,7 +137,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -160,7 +163,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; - if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFSupplierProposal::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelSupplierProposalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelSupplierProposalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelSupplierProposalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index e7db54062cb..99a05e12e4d 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -64,7 +64,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal */ public function info() { - global $conf, $langs, $db; + global $langs, $db; $langs->load("bills"); @@ -83,9 +83,11 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); $tooltip .= $langs->trans("GenericMaskCodes5"); + $mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); + // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -131,7 +133,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // On defini critere recherche compteur - $mask = $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; + $mask = empty($conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK) ? '' : $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; if (!$mask) { $this->error = 'NotConfigured'; 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 656eb88ecaa..aa068a162e2 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 @@ -115,13 +115,16 @@ class doc_generic_user_odt extends ModelePDFUser $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('USER_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -131,7 +134,7 @@ class doc_generic_user_odt extends ModelePDFUser // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USER_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -157,7 +160,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -167,26 +170,26 @@ class doc_generic_user_odt extends ModelePDFUser if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { // Model for creation $list = ModelePDFUser::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->USER_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('USER_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->USER_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('USER_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->USER_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('USER_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } 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 e1c83023df9..e1e5238cb89 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 @@ -118,13 +118,16 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('USERGROUP_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -134,7 +137,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -160,7 +163,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -170,26 +173,26 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFUserGroup::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/dav/dav.lib.php b/htdocs/dav/dav.lib.php index 2861b8744bf..9babbabbe83 100644 --- a/htdocs/dav/dav.lib.php +++ b/htdocs/dav/dav.lib.php @@ -54,7 +54,7 @@ function dav_admin_prepare_head() $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/admin/dav.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/admin/dav.php'; $head[$h][1] = $langs->trans("WebDAV"); $head[$h][2] = 'webdav'; $h++; diff --git a/htdocs/includes/tcpdi/tcpdi_parser.php b/htdocs/includes/tcpdi/tcpdi_parser.php index 13e9839f2b4..174c496d4f4 100644 --- a/htdocs/includes/tcpdi/tcpdi_parser.php +++ b/htdocs/includes/tcpdi/tcpdi_parser.php @@ -1365,7 +1365,7 @@ class tcpdi_parser { $obj = $this->getObjectVal($obj); if (isset ($obj[1][1]['/Rotate'])) { $res = $this->getObjectVal($obj[1][1]['/Rotate']); - if ($res[0] == PDF_TYPE_OBJECT) + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) return $res[1]; return $res; } else { @@ -1373,7 +1373,7 @@ class tcpdi_parser { return false; } else { $res = $this->_getPageRotation($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) return $res[1]; return $res; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b97312859b9..d541f3abce5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -754,6 +754,8 @@ if (!defined('NOLOGIN')) { $login = ''; } + $dol_authmode = ''; + if ($login) { $dol_authmode = $conf->authmode; // This properties is defined only when logged, to say what mode was successfully used $dol_tz = $_POST["tz"]; From da0daa49da8d0c64d05c832f07ae3d1cabd2d901 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 9 Feb 2023 18:01:59 +0100 Subject: [PATCH 003/300] FIX: some more PHP8 comptability fixes --- htdocs/core/class/html.formfile.class.php | 8 ++++---- .../triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4bcf742d461..1d6a2b10a04 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -496,6 +496,10 @@ class FormFile $titletoshow = ($title == 'none' ? '' : $title); } + $addcolumforpicto = ($delallowed || $printer || $morepicto); + $colspan = (4 + ($addcolumforpicto ? 1 : 0)); + $colspanmore = 0; + // Show table if ($genallowed) { $modellist = array(); @@ -747,10 +751,6 @@ class FormFile $out .= ''; - $addcolumforpicto = ($delallowed || $printer || $morepicto); - $colspan = (4 + ($addcolumforpicto ? 1 : 0)); - $colspanmore = 0; - $out .= ''; // Model diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index d441d364f4b..ba9cdba1493 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -1059,7 +1059,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $ret = $actioncomm->create($user); // User creating action if ($ret > 0 && !empty($conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)) { - if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { + if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { foreach ($object->attachedfiles['paths'] as $key => $filespath) { $srcfile = $filespath; $destdir = $conf->agenda->dir_output.'/'.$ret; From b5ffe6204fe6df0d14215e32b6cb04f110c00873 Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 10 Feb 2023 15:30:36 +0100 Subject: [PATCH 004/300] push with ipn not working --- .../class/bonprelevement.class.php | 2 +- htdocs/core/class/commoninvoice.class.php | 67 ++++++++++--------- htdocs/langs/en_US/bills.lang | 2 - htdocs/public/stripe/ipn.php | 48 ++++++++++++- 4 files changed, 83 insertions(+), 36 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index b9d1fd7c54a..bbfc694d414 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -106,7 +106,7 @@ class BonPrelevement extends CommonObject */ public function __construct($db) { - global $conf, $langs; + global $conf, $langs, $db; $this->db = $db; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 2063bb59bf9..41d76310779 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -92,10 +92,6 @@ abstract class CommonInvoice extends CommonObject */ const STATUS_ABANDONED = 3; - /** - * Classified processing because payment requested - */ - const STATUS_PROCESSING = 4; public $totalpaid; // duplicate with sumpayed public $totaldeposits; // duplicate with sumdeposit @@ -618,10 +614,6 @@ abstract class CommonInvoice extends CommonObject $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially'); $statusType = 'status9'; - } elseif ($status == 4) { - $labelStatus = $langs->transnoentitiesnoconv('BillStatusRequestProcessing'); - $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusRequestProcessing'); - $statusType = 'status3'; } elseif ($alreadypaid == 0) { $labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid'); @@ -1197,13 +1189,6 @@ abstract class CommonInvoice extends CommonObject // Default description used for label of event. Will be overwrite by another value later. $description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG; - - $result =$this->setStatut($this::STATUS_PROCESSING); - if ($result < 0) { - $error++; - $errorforinvoice++; - $this->errors[] = 'Error on invoice status change to processing'; - } } $object = $this; @@ -1457,24 +1442,42 @@ abstract class CommonInvoice extends CommonObject } // TODO Create a prelevement_bon and set its status to sent instead of this - $idtransferfile = 0; - - // Update the direct debit payment request of the processed invoice to save the id of the prelevement_bon - $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET"; - $sql .= " traite = 1,"; // TODO Remove this - $sql .= " date_traite = '".$this->db->idate(dol_now())."'"; // TODO Remove this - if ($idtransferfile > 0) { - $sql .= " fk_prelevement_bons = ".((int) $idtransferfile); - } - $sql .= " WHERE rowid = ".((int) $did); - - - dol_syslog(get_class($this)."::makeStripeSepaRequest", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this).'::makeStripeSepaRequest Erreur'); + $bon = new BonPrelevement($db); + $nbinvoices = $bon->create(); + if ($nbinvoices <= 0) { $error++; + $errorforinvoice++; + dol_syslog("Error on BonPrelevement creation", LOG_ERR); + $this->errors[] = "Error on BonPrelevement creation"; + } + + $result = $bon->set_infotrans($user, $now, 'internet'); + if ($result < 0) { + $error++; + $errorforinvoice++; + dol_syslog("Error on BonPrelevement creation", LOG_ERR); + $this->errors[] = "Error on BonPrelevement creation"; + } + + if (!$errorforinvoice) { + $idtransferfile = $bon->id; + // Update the direct debit payment request of the processed invoice to save the id of the prelevement_bon + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET"; + $sql .= " traite = 1,"; // TODO Remove this + $sql .= " date_traite = '".$this->db->idate(dol_now())."',"; // TODO Remove this + if ($idtransferfile > 0) { + $sql .= " fk_prelevement_bons = ".((int) $idtransferfile); + } + $sql .= " WHERE rowid = ".((int) $did); + + + dol_syslog(get_class($this)."::makeStripeSepaRequest", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::makeStripeSepaRequest Erreur'); + $error++; + } } } else { $this->error = 'WithdrawRequestErrorNilAmount'; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 40adce33c66..183620c72da 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -148,8 +148,6 @@ BillShortStatusNotPaid=Not paid BillShortStatusNotRefunded=Not refunded BillShortStatusClosedUnpaid=Closed BillShortStatusClosedPaidPartially=Paid (partially) -BillStatusRequestProcessing=Payment request processing -BillShortStatusRequestProcessing=Processing PaymentStatusToValidShort=To validate ErrorVATIntraNotConfigured=Intra-Community VAT number not yet defined ErrorNoPaiementModeConfigured=No default payment type defined. Go to Invoice module setup to fix this. diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index b41149a88f8..de4ed61f802 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -43,9 +43,9 @@ require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; @@ -399,6 +399,52 @@ if ($event->type == 'payout.created') { $errorforinvoice++; } } + + if (!$errorforinvoice && isModEnabled('prelevement')) { //TEST IPN + $bon = new BonPrelevement($db); + $idbon = 0; + $sql = "SELECT dp.fk_prelevement_bons as idbon"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as dp"; + $sql .= " WHERE dp.fk_facture = '".$db->escape($invoice_id)."'"; + $sql .= " AND dp.sourcetype = 'facture'"; + $sql .= " AND dp.traite = 1"; + $result = $db->query($sql); + if ($result) { + if ($db->num_rows($result)) { + $obj = $db->fetch_object($result); + $idbon = $obj->idbon; + } + } else { + $postactionmessages[] = $db->lasterror(); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } + + if (!empty($idbon)) { + $bon->fetch($idbon); + $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons "; + $sql .= " SET fk_user_credit = ".$user->id; + $sql .= ", statut = ".$bon::STATUS_CREDITED; + $sql .= ", date_credit = '".$db->idate($now)."'"; + $sql .= ", credite = 1"; + $sql .= " WHERE rowid=".((int) $bon->id); + $sql .= " AND entity = ".((int) $bon->entity); + $sql .= " AND statut = ".$bon::STATUS_TRANSFERED; + + $db->begin(); + $result = $db->query($sql); + if (!$result) { + $db->rollback(); + $postactionmessages[] = $db->lasterror(); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } else { + $db->commit(); + } + } + } } elseif ($event->type == 'payment_intent.payment_failed') { // TODO: Redirect to paymentko.php } elseif ($event->type == 'checkout.session.completed') { // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). From 89f3ba1a322c4949ab741a5bbf5d8736482460ae Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 10 Feb 2023 16:12:24 +0100 Subject: [PATCH 005/300] fix ipn --- htdocs/public/stripe/ipn.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index de4ed61f802..ad51e37c310 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -400,7 +400,7 @@ if ($event->type == 'payout.created') { } } - if (!$errorforinvoice && isModEnabled('prelevement')) { //TEST IPN + if (!$errorforinvoice && isModEnabled('prelevement')) { $bon = new BonPrelevement($db); $idbon = 0; $sql = "SELECT dp.fk_prelevement_bons as idbon"; @@ -423,13 +423,12 @@ if ($event->type == 'payout.created') { if (!empty($idbon)) { $bon->fetch($idbon); - $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons "; + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; $sql .= " SET fk_user_credit = ".$user->id; $sql .= ", statut = ".$bon::STATUS_CREDITED; $sql .= ", date_credit = '".$db->idate($now)."'"; $sql .= ", credite = 1"; $sql .= " WHERE rowid=".((int) $bon->id); - $sql .= " AND entity = ".((int) $bon->entity); $sql .= " AND statut = ".$bon::STATUS_TRANSFERED; $db->begin(); From bc0b0514bb4547885d1b27eb682f51d54b2a0a7d Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 10 Feb 2023 16:29:39 +0100 Subject: [PATCH 006/300] fix Ci --- htdocs/public/stripe/ipn.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index ad51e37c310..2c93654829b 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -425,11 +425,11 @@ if ($event->type == 'payout.created') { $bon->fetch($idbon); $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; $sql .= " SET fk_user_credit = ".$user->id; - $sql .= ", statut = ".$bon::STATUS_CREDITED; + $sql .= ", statut = '".$db->escape($bon::STATUS_CREDITED)."'"; $sql .= ", date_credit = '".$db->idate($now)."'"; $sql .= ", credite = 1"; $sql .= " WHERE rowid=".((int) $bon->id); - $sql .= " AND statut = ".$bon::STATUS_TRANSFERED; + $sql .= " AND statut = '".$db->escape($bon::STATUS_TRANSFERED)."'"; $db->begin(); $result = $db->query($sql); From 74a0b5f211b9350d8c7a9c1d4c75e703ac081001 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 14 Feb 2023 09:21:31 +0100 Subject: [PATCH 007/300] FIX: php 8 warnings: use v17 code --- htdocs/admin/dav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index 8310308265d..1b615ddeed1 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -43,7 +43,7 @@ $arrayofparameters = array( 'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), - 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>! empty($conf->ecm->enabled)) + 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>isModEnabled('ecm')) ); // To fix when dire does not exists From 8b8ba10ae2e9a354d1471a1effacfc6258a2b7e9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 14 Feb 2023 09:35:06 +0100 Subject: [PATCH 008/300] FIX: php 8 warnings: adapt to v17 --- htdocs/core/class/commondocgenerator.class.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 7e07d7427bc..1b59d44bdde 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -40,11 +40,6 @@ abstract class CommonDocGenerator */ public $name = ''; - /** - * @var string Name of constant that is used to save list of directories to scan - */ - public $scandir = ''; - /** * @var string Error code (or message) */ From 076ffaa15bb5631509912b4f82efe89525bb9e3e Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 21 Feb 2023 09:43:35 +0100 Subject: [PATCH 009/300] FIX - error datamatrix --- .../includes/tecnickcom/tcpdf/include/barcodes/datamatrix.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/tecnickcom/tcpdf/include/barcodes/datamatrix.php b/htdocs/includes/tecnickcom/tcpdf/include/barcodes/datamatrix.php index 19b46fadaf1..783f99da4cd 100644 --- a/htdocs/includes/tecnickcom/tcpdf/include/barcodes/datamatrix.php +++ b/htdocs/includes/tecnickcom/tcpdf/include/barcodes/datamatrix.php @@ -629,7 +629,7 @@ class Datamatrix { if ($numch[ENC_C40] == $numch[ENC_X12]) { $k = ($pos + $charscount + 1); while ($k < $data_length) { - $tmpchr = ord($data{$k}); + $tmpchr = ord($data[$k]); if ($this->isCharMode($tmpchr, ENC_X12)) { return ENC_X12; } elseif (!($this->isCharMode($tmpchr, ENC_X12) OR $this->isCharMode($tmpchr, ENC_C40))) { From 50baadbe0ad0c5eb797c2dd7ad8b267ccf8cf42b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 13:27:21 +0100 Subject: [PATCH 010/300] Fix warning --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c9dff023034..9dca1b1051d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1455,7 +1455,7 @@ class Propal extends CommonObject if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) { $object->ref_client = ''; } - if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING == 1) { + if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) { $object->note_private = ''; $object->note_public = ''; } From 643c05116f6bf35065b749dcb321c2609fe759aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 13:37:27 +0100 Subject: [PATCH 011/300] Debug v17 --- htdocs/admin/mailing.php | 6 +-- htdocs/comm/action/class/actioncomm.class.php | 4 +- htdocs/comm/mailing/card.php | 39 ++++++++++++++++--- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 19effcdfd2e..81f8210b23f 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -150,8 +150,8 @@ print ''; print ''; print $langs->trans("MailingEMailError").''; -print ''; -if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && !isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) { +print ''; +if (getDolGlobalString('MAILING_EMAIL_ERRORSTO') && !isValidEmail(getDolGlobalString('MAILING_EMAIL_ERRORSTO'))) { print ' '.img_warning($langs->trans("BadEMail")); } print ''; @@ -160,7 +160,7 @@ print ''; print ''; print $form->textwithpicto($langs->trans("MailingDelay"), $langs->trans("IfDefinedUseAValueBeetween", '0.001', '10')).''; -print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index eae7136ac88..39c4fd50be9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2463,7 +2463,7 @@ class ActionComm extends CommonObject } // Sender - $from = $conf->global->MAIN_MAIL_EMAIL_FROM; + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); if (empty($from)) { $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; $error++; @@ -2471,7 +2471,7 @@ class ActionComm extends CommonObject if (!$error) { // Errors Recipient - $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO; + $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); // Mail Creation $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 32207425d2a..63750d5d834 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -43,18 +43,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->load("mails"); $id = (GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int')); + $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel'); $confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); $urlfrom = GETPOST('urlfrom'); +// Initialize technical objects $object = new Mailing($db); +$extrafields = new ExtraFields($db); $result = $object->fetch($id); -$extrafields = new ExtraFields($db); - -// fetch optionals attributes and labels +// Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -98,6 +99,32 @@ if ($reshook < 0) { } if (empty($reshook)) { + $error = 0; + + $backurlforlist = DOL_URL_ROOT.'/comm/mailing/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/comm/mailing/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + + if ($cancel) { + /*var_dump($cancel);var_dump($backtopage);var_dump($backtopageforcancel);exit;*/ + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + $action = ''; + } + // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { if (!GETPOST("clone_content", 'alpha') && !GETPOST("clone_receivers", 'alpha')) { @@ -736,9 +763,9 @@ if ($action == 'create') { print ''.$langs->trans("MailTitle").''; - print ''.$langs->trans("MailFrom").''; + print ''.$langs->trans("MailFrom").''; - print ''.$langs->trans("MailErrorsTo").''; + print ''.$langs->trans("MailErrorsTo").''; // Other attributes $parameters = array(); From 9b6e0bab0004070575e4c653df295581cc51afad Mon Sep 17 00:00:00 2001 From: "yann.droniou" Date: Tue, 21 Feb 2023 14:26:29 +0100 Subject: [PATCH 012/300] Fix LDAP Authentification failure with error 500 --- htdocs/core/class/ldap.class.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index b2b5e2c6e93..38220f7a17b 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -344,12 +344,7 @@ class Ldap */ public function close() { - $r_type = get_resource_type($this->connection); - if ($this->connection && ($r_type === "Unknown" || !@ldap_close($this->connection))) { - return false; - } else { - return true; - } + return $this->unbind(); } /** @@ -401,7 +396,7 @@ class Ldap public function unbind() { $this->result = true; - if ($this->connection) { + if (is_resource($this->connection)) { $this->result = @ldap_unbind($this->connection); } if ($this->result) { From 1f3aa24c8a27e6e851829057bbf668c4f68bbb4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 16:56:16 +0100 Subject: [PATCH 013/300] Fix missing date delivery on invoice --- htdocs/core/lib/pdf.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index fef33262a0f..86ed5fb107d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2386,6 +2386,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / '; $linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_delivery, 'day', '', $outputlangs); } else { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); From 3f0f9c0e70e548665d2b5b8f42ef4f40b1387b46 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 21 Feb 2023 17:21:01 +0100 Subject: [PATCH 014/300] FIX : Recursive management for showinh/hiding sube-BOM lines on the MO Page --- htdocs/bom/lib/bom.lib.php | 41 ++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 8d827ba09aa..2cf8fc61733 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -156,22 +156,33 @@ function mrpCollapseBomManagement() '."\n"; } + // Subject + if ($this->withtitletopic) { + print ''; + // Answer to a ticket : display of the thread title in readonly + if ($this->withtopicreadonly) { + print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; + } else { + if (isset($this->withreadid) && $this->withreadid > 0) { + $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.''; + } else { + $subject = GETPOST('subject', 'alpha'); + } + print 'withemail)?' autofocus':'').' />'; + } + print ''; + } + // MESSAGE $msg = GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ''; print ''; @@ -846,6 +851,8 @@ class FormTicket print ' selected="selected"'; } elseif ($arraycategories['use_default'] == "1" && !$selected && !$empty) { print ' selected="selected"'; + } elseif (count($ticketstat->cache_category_tickets) == 1) { + print ' selected="selected"'; } print '>'; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 089629234d6..99b8210644c 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -274,7 +274,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin = $langs->transnoentities($body, $object->track_id).'
'; $message_admin .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; $message_admin .= '
  • '.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'
  • '; - $message_admin .= '
  • '.$langs->trans('Category').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'
  • '; + $message_admin .= '
  • '.$langs->trans('TicketCategory').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'
  • '; $message_admin .= '
  • '.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'
  • '; $message_admin .= '
  • '.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'
  • '; // Extrafields @@ -343,7 +343,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer = $langs->transnoentities($body, $object->track_id).'
    '; $message_customer .= '
    • '.$langs->trans('Title').' : '.$object->subject.'
    • '; $message_customer .= '
    • '.$langs->trans('Type').' : '.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code).'
    • '; - $message_customer .= '
    • '.$langs->trans('Category').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'
    • '; + $message_customer .= '
    • '.$langs->trans('TicketCategory').' : '.$langs->getLabelFromKey($this->db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code).'
    • '; $message_customer .= '
    • '.$langs->trans('Severity').' : '.$langs->getLabelFromKey($this->db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code).'
    • '; // Extrafields diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index ea560012afc..7cb36b3bd0c 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -183,7 +183,7 @@ CreatedBy=Created by NewTicket=New Ticket SubjectAnswerToTicket=Ticket answer TicketTypeRequest=Request type -TicketCategory=Ticket categorization +TicketCategory=Ticket group SeeTicket=See ticket TicketMarkedAsRead=Ticket has been marked as read TicketReadOn=Read on diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index aca2828da3b..5c99c56c1d0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5215,7 +5215,7 @@ div.visible { display: block; } -div.hidden, header.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { +div.hidden, header.hidden, tr.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { display: none; } .unvisible { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 7a0f9749be8..93b501885fe 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5211,7 +5211,7 @@ div.visible { display: block; } -div.hidden, header.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { +div.hidden, header.hidden, tr.hidden, td.hidden, img.hidden, span.hidden, div.showifmore { display: none; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 7cbb23c75c4..d46a787f983 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -726,7 +726,7 @@ if ($action == 'create' || $action == 'presend') { print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); - $formticket->trackid = ''; // TODO Use a unique key to avoid conflict in upload file feature + $formticket->trackid = ''; // TODO Use a unique key 'tic' to avoid conflict in upload file feature $formticket->withfromsocid = $socid ? $socid : $user->socid; $formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withtitletopic = 1; @@ -737,7 +737,6 @@ if ($action == 'create' || $action == 'presend') { $formticket->withfile = 2; $formticket->withextrafields = 1; $formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid')); - $formticket->trackid = 'tic'.$object->id; $formticket->withcancel = 1; From 5713ca8a4329907f9b8a35d2673a4a28bacb81c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 16:01:48 +0100 Subject: [PATCH 042/300] Regression --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 386ed4fc134..f361c0d7028 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -854,7 +854,7 @@ if ($resql) { } $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; - llxHeader('', $langs->trans('ListOfProposals'), $help_url); + llxHeader('', $title, $help_url); $param = '&search_status='.urlencode($search_status); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { From 04a6a0a0435e8273baf2195fb086007c6dc9fd2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 16:27:10 +0100 Subject: [PATCH 043/300] Fix qodana --- .../canvas/actions_contactcard_common.class.php | 6 ++++-- htdocs/core/class/validate.class.php | 16 ++++++++-------- .../societe/canvas/actions_card_common.class.php | 2 ++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 4a3fc28c9de..7e73d264480 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -74,8 +74,10 @@ abstract class ActionsContactCardCommon if (!empty($id)) { $object->fetch($id); } - $this->object = $object; - //} + + $this->object = $object; + + return $object; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/class/validate.class.php b/htdocs/core/class/validate.class.php index 31cf6300aff..37bb37aec4f 100644 --- a/htdocs/core/class/validate.class.php +++ b/htdocs/core/class/validate.class.php @@ -27,7 +27,6 @@ */ class Validate { - /** * @var DoliDb Database handler (result of a new DoliDB) */ @@ -62,7 +61,7 @@ class Validate } if (!is_object($this->outputLang) || !method_exists($this->outputLang, 'load')) { - return false; + return; } $this->outputLang->loadLangs(array('validate', 'errors')); @@ -72,7 +71,8 @@ class Validate /** * Use to clear errors msg or other ghost vars - * @return null + * + * @return void */ protected function clear() { @@ -82,8 +82,8 @@ class Validate /** * Use to clear errors msg or other ghost vars * - * @param string $errMsg your error message - * @return null + * @param string $errMsg your error message + * @return void */ protected function setError($errMsg) { @@ -93,9 +93,9 @@ class Validate /** * Check for e-mail validity * - * @param string $email e-mail address to validate - * @param int $maxLength string max length - * @return boolean Validity is ok or not + * @param string $email e-mail address to validate + * @param int $maxLength string max length + * @return boolean Validity is ok or not */ public function isEmail($email, $maxLength = false) { diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index fc8794aa1a8..a2b320e50db 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -70,6 +70,8 @@ abstract class ActionsCardCommon $object->fetch($id, $ref); } $this->object = $object; + + return $object; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 837f89c19fc0872e66ce7d1e685bc20cdc263c72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 17:17:34 +0100 Subject: [PATCH 044/300] Fix warning --- htdocs/core/class/smtps.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 135d9d9e8de..46193e1efea 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1862,6 +1862,7 @@ class SMTPs } elseif ($type == 'alternative') { return $this->_smtpsAlternativeBoundary; } + return ''; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 53014290cfe115b872d3fd9eaa1f3fd98d8b3ea4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 17:18:42 +0100 Subject: [PATCH 045/300] Fix unbind --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 3dc45c753bc..68464524621 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -401,7 +401,7 @@ class Ldap public function unbind() { $this->result = true; - if ($this->connection) { + if (is_resource($this->connection) || is_object($this->connection)) { $this->result = @ldap_unbind($this->connection); } if ($this->result) { From f6f420d19aebe61c78ae8cc2dfbae10b882c530d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 17:26:22 +0100 Subject: [PATCH 046/300] Doc --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 68464524621..b3d5766daff 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -339,7 +339,7 @@ class Ldap * This method seems a duplicate/alias of unbind(). * * @return boolean true or false - * @deprecated ldap_close is an alias of ldap_unbind + * @deprecated ldap_close is an alias of ldap_unbind, so use unbind() instead. * @see unbind() */ public function close() From f7348d21d366ebf579bc52f533aa0113abb39b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:20:04 +0100 Subject: [PATCH 047/300] doc --- htdocs/core/menus/standard/eldy_menu.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 596e1e4cc3f..de33b209383 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -36,6 +36,11 @@ class MenuManager public $atarget = ""; // To store default target to use onto links public $name = "eldy"; + /** + * @var Menu + */ + public $menu; + public $menu_array; public $menu_array_after; From 873a0266eef558b32e8018d50fd576aeead936f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:20:53 +0100 Subject: [PATCH 048/300] Update auguria_menu.php --- htdocs/core/menus/standard/auguria_menu.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index ae40ec170fc..168effd964d 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -37,6 +37,11 @@ class MenuManager public $atarget = ""; // To store default target to use onto links public $name = "auguria"; + /** + * @var Menu + */ + public $menu; + public $menu_array; public $menu_array_after; From 53d89bb068a40d25e32b78fdf350dbfb3b05d282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:24:40 +0100 Subject: [PATCH 049/300] Update menubase.class.php --- htdocs/core/class/menubase.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 9544e11e075..3630d137136 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -152,6 +152,10 @@ class Menubase */ public $tms; + /** + * @var Menu menu + */ + public $newmenu; /** * Constructor From fc8ae34dd34f34286b84d3dfe06996f7f4b52d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:32:13 +0100 Subject: [PATCH 050/300] Update conf.class.php --- htdocs/core/class/conf.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 12457a41339..2b3ddba9881 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -79,6 +79,10 @@ class Conf // An array to store cache results ->cache['nameofcache']=... public $cache; + /** + * @var int To tell header was output + */ + public $headerdone; /** * @var string[] From a20c511ee934d5996f603016e36d850933e58c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 20:58:55 +0100 Subject: [PATCH 051/300] doc --- htdocs/datapolicy/class/datapolicycron.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index fb76767bf1e..7383d303a7c 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2023 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 @@ -27,6 +27,11 @@ */ class DataPolicyCron { + /** + * @var DoliDB Database handler. + */ + public $db; + /** * Constructor * From f1bcaf60850c006c51ad9dbb43482d13357c9aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:16:16 +0100 Subject: [PATCH 052/300] doc --- htdocs/don/class/paymentdonation.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 657a1d32d1a..1aceca10c16 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -92,6 +92,10 @@ class PaymentDonation extends CommonObject public $type_code; public $type_label; + public $chid; + public $datepaid; + public $bank_account; + public $bank_line; /** * @var string Id of external payment mode From 66a56a36e40c1ae827109af227462edcb7c54831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:19:55 +0100 Subject: [PATCH 053/300] Update commonsocialnetworks.class.php --- htdocs/core/class/commonsocialnetworks.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonsocialnetworks.class.php b/htdocs/core/class/commonsocialnetworks.class.php index 04dc17e26f0..19928eb1dbb 100644 --- a/htdocs/core/class/commonsocialnetworks.class.php +++ b/htdocs/core/class/commonsocialnetworks.class.php @@ -16,9 +16,9 @@ */ /** - * \file htdocs/core/class/commonincoterm.class.php + * \file htdocs/core/class/commonsocialnetworks.class.php * \ingroup core - * \brief File of the superclass of object classes that support incoterm (customer and supplier) + * \brief File of the superclass of object classes that support socialnetworks */ From 3306565ba8a2f510364bf3cabd829d7a2703eb02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:26:59 +0100 Subject: [PATCH 054/300] doc --- htdocs/core/class/doleditor.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index dad1f572406..bb63c1dd927 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -43,6 +43,7 @@ class DolEditor public $cols; public $height; public $width; + public $uselocalbrowser; public $readonly; public $posx; public $posy; From f8b75f33126d851ad4f9bfe2b70260234d3aa880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:29:07 +0100 Subject: [PATCH 055/300] Update cstate.class.php --- htdocs/core/class/cstate.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index e098de93bd4..46e60b2f7fd 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -49,6 +49,11 @@ class Cstate // extends CommonObject */ public $id; + /** + * @var int ID + */ + public $rowid; + public $code_departement; public $code; From 1ce9da8026a7234d96869bf32acf83512748cb06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 21:38:26 +0100 Subject: [PATCH 056/300] doc --- htdocs/core/class/CMailFile.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 9e8593e6d1b..c54b527eff2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -128,6 +128,7 @@ class CMailFile // Image public $html; + public $msgishtml; public $image_boundary; public $atleastoneimage = 0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). public $html_images = array(); From b74e7e8de4b0ab12650164bb7796268666a51206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 22:47:19 +0100 Subject: [PATCH 057/300] translation --- htdocs/contrat/class/contrat.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0007bc334b9..48a3e4053a4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1992,6 +1992,8 @@ class Contrat extends CommonObject { global $conf, $langs, $user; + $langs->load('contracts'); + $datas = []; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { From d326e59beba5e5d997384f323f6f22c57c55a17e Mon Sep 17 00:00:00 2001 From: pratushraj Date: Thu, 23 Feb 2023 13:00:31 +0530 Subject: [PATCH 058/300] issue #24014 --- htdocs/projet/class/task.class.php | 9 ++++++--- htdocs/projet/tasks.php | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 87ab0afdc47..3c58a147d39 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -813,7 +813,7 @@ class Task extends CommonObjectLine * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') { global $conf, $hookmanager; @@ -953,8 +953,11 @@ class Task extends CommonObjectLine } } - - $sql .= " ORDER BY p.ref, t.rang, t.dateo"; + if($sortfield && $sortorder) { + $sql .= $this->db->order($sortfield, $sortorder); + } else { + $sql .= " ORDER BY p.ref, t.rang, t.dateo"; + } //print $sql;exit; dol_syslog(get_class($this)."::getTasksArray", LOG_DEBUG); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index ffba37abb7d..22258bd3b18 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -124,12 +124,12 @@ $search_array_options = $extrafields->getOptionalsFromPost($taskstatic->table_el // Default sort order (if not yet defined by previous GETPOST) -if (!$sortfield) { +/* if (!$sortfield) { reset($object->fields); $sortfield="t.".key($object->fields); } // Set here default search field. By default 1st field in definition. Reset is required to avoid key() to return null. if (!$sortorder) { $sortorder = "ASC"; -} +} */ // Security check @@ -848,7 +848,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). $filteronthirdpartyid = $socid; - $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options); + $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options, 0, 1, $sortfield, $sortorder); // We load also tasks limited to a particular user $tmpuser = new User($db); @@ -998,41 +998,41 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; // print ''.$langs->trans("Project").''; if (!empty($arrayfields['t.ref']['checked'])) { - print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); + print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], 't.ref', '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.label']['checked'])) { - print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); + print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.description']['checked'])) { print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); } if (!empty($arrayfields['t.dateo']['checked'])) { - print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.datee']['checked'])) { - print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['t.planned_workload']['checked'])) { - print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.duration_effective']['checked'])) { - print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress_calculated']['checked'])) { print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress']['checked'])) { - print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); + print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", '', $param, '', $sortfield, $sortorder, 'right ', '', 1); } if (!empty($arrayfields['t.progress_summary']['checked'])) { print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '', 1); } if ($object->usage_bill_time) { if (!empty($arrayfields['t.tobill']['checked'])) { - print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "t.tobill", '', $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['t.billed']['checked'])) { - print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "t.billed", '', $param, '', $sortfield, $sortorder, 'right '); } } // Contacts of task, disabled because available by default jsut after @@ -1043,7 +1043,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third */ if (!empty($arrayfields['t.budget_amount']['checked'])) { - print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['c.assigned']['checked'])) { From af4228064d95a44e62ac9b4342e0d6955d4f87a4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Feb 2023 07:33:16 +0000 Subject: [PATCH 059/300] Fixing style errors. --- htdocs/projet/class/task.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3c58a147d39..fea80f6d13a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -953,7 +953,7 @@ class Task extends CommonObjectLine } } - if($sortfield && $sortorder) { + if ($sortfield && $sortorder) { $sql .= $this->db->order($sortfield, $sortorder); } else { $sql .= " ORDER BY p.ref, t.rang, t.dateo"; From 30c76623e12de38b67f8518a44701011cf7fa8a2 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 23 Feb 2023 10:46:20 +0100 Subject: [PATCH 060/300] FIX : missing w option in dol_print_date --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d503026a868..053bbfe98ca 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2696,8 +2696,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($time); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', '%w', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', 'w', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( @@ -2722,8 +2722,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $dtts->setTimestamp($timetouse); $dtts->setTimezone($tzo); $newformat = str_replace( - array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), - array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), + array('%Y', '%y', '%m', '%d', '%H', '%I', '%M', '%S', '%p', '%w', 'T', 'Z', '__a__', '__A__', '__b__', '__B__'), + array('Y', 'y', 'm', 'd', 'H', 'h', 'i', 's', 'A', 'w', '__£__', '__$__', '__{__', '__}__', '__[__', '__]__'), $format); $ret = $dtts->format($newformat); $ret = str_replace( From 763001625bdf7ad32b09bf8dcd9ec68bfc4f1e07 Mon Sep 17 00:00:00 2001 From: hystepik Date: Thu, 23 Feb 2023 11:20:19 +0100 Subject: [PATCH 061/300] New : test of big upload on test_forms --- htdocs/core/ajax/flowjs-server.php | 7 +++- htdocs/public/test/test_forms.php | 64 ++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index e1f5feaaf10..480dba39195 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -35,6 +35,9 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } +if (!defined('NOCSRFCHECK')) { + define('NOCSRFCHECK', '1'); +} // If there is no need to load and show top and left menu if (!defined("NOLOGIN")) { define("NOLOGIN", '1'); @@ -68,7 +71,7 @@ if (!empty($upload_dir)) { $temp_dir = $upload_dir.'/'.$flowIdentifier; } else { $temp_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'.$flowIdentifier; - $upload_dir = $temp_dir; + $upload_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'; } if ($_SERVER['REQUEST_METHOD'] === 'GET') { @@ -133,7 +136,7 @@ function createFileFromChunks($temp_dir, $upload_dir, $fileName, $chunkSize, $to $total_files = 0; $files = dol_dir_list($temp_dir, 'files'); foreach ($files as $file) { - if (stripos($file, $fileName) !== false) { + if (stripos($file["name"], $fileName) !== false) { $total_files++; } } diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index acc9151798f..e041e1d98fa 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -105,6 +105,70 @@ $array = array(1=>'Value 1', 2=>'Value 2', 3=>'Value 3'); $arrayselected = array(1, 3); print $form->multiselectarray('testmulti', $array, $arrayselected, '', 0, 'minwidth100'); +print '

      '."\n"; + +// Test6a: Upload of big files +print "Test 6a: Upload of big files
      \n"; +print "The file will be uploaded in the directory: documents/test_form/temp/
      \n"; + +if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { + print ''; + print ' No file selected.'; + print '
      '; + print '
      '; + print ''; + print ''; +} else { + print "If this message displays, please add flow.js file which can be found here :https://github.com/flowjs/flow.js and place the js lib in htdocs/includes/flowjs/
      \n"; +} + print '
'; // End of page From 5d5634cc505a7b2ce990d645e785ca5faee77281 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 23 Feb 2023 11:41:46 +0100 Subject: [PATCH 062/300] fix : Warning: Undefined property: Conf:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/contrat/card.php on line 1652 --- htdocs/contrat/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 6b3937df76a..b41d913a92e 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1649,9 +1649,9 @@ if ($action == 'create') { if ($objp->subprice >= 0) { $colspan = 6; - if ($conf->margin->enabled && getDolGlobalString('PRODUCT_USE_UNITS')) { + if (isModEnabled('margin') && getDolGlobalString('PRODUCT_USE_UNITS')) { $colspan = 8; - } elseif ($conf->margin->enabled || getDolGlobalString('PRODUCT_USE_UNITS')) { + } elseif (isModEnabled('margin') || getDolGlobalString('PRODUCT_USE_UNITS')) { $colspan = 7; } From d86ab00950d9c7592ba8ab8c55f5ed7dc681e038 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 12:08:43 +0100 Subject: [PATCH 063/300] Look and feel v18 --- htdocs/comm/mailing/card.php | 10 +++++++++- htdocs/comm/mailing/cibles.php | 10 ++++++++-- htdocs/comm/mailing/info.php | 8 +++++++- htdocs/core/class/html.form.class.php | 8 ++++++-- htdocs/theme/eldy/global.inc.php | 7 +++++-- htdocs/theme/md/style.css.php | 8 ++++++++ 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 634047cdad6..a0d8ec640d0 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -899,6 +899,12 @@ if ($action == 'create') { $linkback = '
'.$langs->trans("BackToList").''; + $morehtmlref = '
'; + // Ref customer + $morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1); + $morehtmlref .= '
'; + $morehtmlright = ''; $nbtry = $nbok = 0; if ($object->statut == 2 || $object->statut == 3) { @@ -912,7 +918,7 @@ if ($action == 'create') { $morehtmlright .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '
'; print '
'; @@ -920,11 +926,13 @@ if ($action == 'create') { print ''; // Description + /* print ''; + */ // From print '
'; print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string'); print ''; print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string'); print '
'; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 758172b4d5f..71e8617f927 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -212,6 +212,12 @@ if ($object->fetch($id) >= 0) { $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref = '
'; + // Ref customer + $morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= '
'; + $morehtmlright = ''; $nbtry = $nbok = 0; if ($object->statut == 2 || $object->statut == 3) { @@ -226,14 +232,14 @@ if ($object->fetch($id) >= 0) { $morehtmlright .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '
'; print '
'; print ''; - print ''; + //print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; } else { From 6da5df45b22177ea758c94c459fdba66e22a68ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 13:21:45 +0100 Subject: [PATCH 066/300] FIX Bad value for phone in substitutions keys --- htdocs/core/lib/functions.lib.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e6ac7f2d9f2..40fcbfbf12b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3575,15 +3575,15 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $picto = ''; } } - if ($adddivfloat) { + if ($adddivfloat == 1) { $rep .= '
'; - } else { + } elseif (empty($adddivfloat)) { $rep .= ''; } $rep .= ($withpicto ?img_picto($titlealt, 'object_'.$picto.'.png').' ' : '').$newphone; - if ($adddivfloat) { + if ($adddivfloat == 1) { $rep .= '
'; - } else { + } elseif (empty($adddivfloat)) { $rep .= ''; } } @@ -7638,9 +7638,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, '__USER_ID__' => (string) $user->id, '__USER_LOGIN__' => (string) $user->login, '__USER_EMAIL__' => (string) $user->email, - '__USER_PHONE__' => (string) dol_print_phone($user->office_phone), - '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile), - '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile), + '__USER_PHONE__' => (string) dol_print_phone($user->office_phone, '', 0, 0, '', " ", '', '', -1), + '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile, '', 0, 0, '', " ", '', '', -1), + '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile, '', 0, 0, '', " ", '', '', -1), '__USER_FAX__' => (string) $user->office_fax, '__USER_LASTNAME__' => (string) $user->lastname, '__USER_FIRSTNAME__' => (string) $user->firstname, @@ -7655,8 +7655,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray = array_merge($substitutionarray, array( '__MYCOMPANY_NAME__' => $mysoc->name, '__MYCOMPANY_EMAIL__' => $mysoc->email, - '__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone), - '__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax), + '__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone, '', 0, 0, '', " ", '', '', -1), + '__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax, '', 0, 0, '', " ", '', '', -1), '__MYCOMPANY_PROFID1__' => $mysoc->idprof1, '__MYCOMPANY_PROFID2__' => $mysoc->idprof2, '__MYCOMPANY_PROFID3__' => $mysoc->idprof3, From dbf3df52106fd13d47cd9c6733fe3832d191bf69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 13:50:25 +0100 Subject: [PATCH 067/300] Fix emailing in test mode use correct user or sender signature --- htdocs/comm/mailing/card.php | 21 ++++++++++++------- htdocs/comm/mailing/cibles.php | 4 ++-- htdocs/core/class/html.formmail.class.php | 10 +++++---- .../core/modules/mailings/fraise.modules.php | 6 +++--- .../core/modules/mailings/pomme.modules.php | 4 ++-- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index a0d8ec640d0..d46ea99c213 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -223,7 +223,6 @@ if (empty($reshook)) { $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : ''); - $targetobject = null; // Not defined with mass emailing $parameters = array('mode'=>'emailing'); $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object @@ -468,19 +467,25 @@ if (empty($reshook)) { if (!$error) { // Is the message in html - $msgishtml = -1; // Unknow by default + $msgishtml = -1; // Unknow = autodetect by default if (preg_match('/[\s\t]*/i', $object->body)) { $msgishtml = 1; } + $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : ''); + + $parameters = array('mode'=>'emailing'); + $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object + // other are set at begin of page - $object->substitutionarrayfortest['__EMAIL__'] = $object->sendto; - $object->substitutionarrayfortest['__MAILTOEMAIL__'] = ''.$object->sendto.''; + $substitutionarray['__EMAIL__'] = $object->sendto; + $substitutionarray['__MAILTOEMAIL__'] = ''.$object->sendto.''; // Subject and message substitutions - complete_substitutions_array($object->substitutionarrayfortest, $langs); - $tmpsujet = make_substitutions($object->sujet, $object->substitutionarrayfortest); - $tmpbody = make_substitutions($object->body, $object->substitutionarrayfortest); + complete_substitutions_array($substitutionarray, $langs, $targetobject); + + $tmpsujet = make_substitutions($object->sujet, $substitutionarray); + $tmpbody = make_substitutions($object->body, $substitutionarray); $arr_file = array(); $arr_mime = array(); @@ -935,7 +940,7 @@ if ($action == 'create') { */ // From - print '
'; - print ' - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - - - - - - Date: Thu, 23 Feb 2023 18:29:58 +0100 Subject: [PATCH 071/300] FIx duplicate image file from src data --- htdocs/core/class/CMailFile.class.php | 30 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 9e8593e6d1b..92c657f257f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -273,10 +273,16 @@ class CMailFile if ($this->html_images[$i]) { $this->atleastoneimage = 1; if ($this->html_images[$i]['type'] == 'cidfromdata') { - $posindice = count($filename_list); - $filename_list[$posindice] = $this->html_images[$i]['fullpath']; - $mimetype_list[$posindice] = $this->html_images[$i]['content_type']; - $mimefilename_list[$posindice] = $this->html_images[$i]['name']; + if (!in_array($this->html_images[$i]['fullpath'], $filename_list)) { + // If this file path is not already into the $filename_list, we add it. + $posindice = count($filename_list); + $filename_list[$posindice] = $this->html_images[$i]['fullpath']; + $mimetype_list[$posindice] = $this->html_images[$i]['content_type']; + $mimefilename_list[$posindice] = $this->html_images[$i]['name']; + } else { + $posindice = array_search($this->html_images[$i]['fullpath'], $filename_list); + } + // We complete the array of cid_list $cid_list[$posindice] = $this->html_images[$i]['cid']; } dol_syslog("CMailFile::CMailfile: html_images[$i]['name']=".$this->html_images[$i]['name'], LOG_DEBUG); @@ -284,6 +290,8 @@ class CMailFile } } } + //var_dump($filename_list); + //var_dump($cid_list);exit; // Set atleastoneimage if there is at least one file (into $filename_list array) if (is_array($filename_list)) { @@ -1130,6 +1138,13 @@ class CMailFile return 'Bad value for sendmode'; } + // Now we delete image files that were created dynamically to manage data inline files + foreach ($this->html_images as $val) { + if (!empty($val['type']) && $val['type'] == 'cidfromdata') { + //dol_delete($val['fullpath']); + } + } + $parameters = array('sent' => $res); $action = ''; $reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks @@ -1659,7 +1674,7 @@ class CMailFile } /** - * Seearch images into html message and init array this->images_encoded if found + * Search images into html message and init array this->images_encoded if found * * @param string $images_dir Location of physical images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO @@ -1746,7 +1761,8 @@ class CMailFile } /** - * Seearch images with data:image format into html message + * Seearch images with data:image format into html message. + * If we find some, we create it on disk. * * @param string $images_dir Location of where to store physicaly images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO @@ -1788,7 +1804,7 @@ class CMailFile foreach ($matches[1] as $key => $ext) { // We save the image to send in disk $filecontent = $matches[2][$key]; - $cid = 'cid000'.dol_hash($this->html, 'md5'); + $cid = 'cid000'.dol_hash($this->html, 'md5'); // The id must not change if image is same $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; $fhandle = @fopen($destfiletmp, 'w'); From 1573ab5f383df1fd68852d0134661989b9aab9c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 18:42:15 +0100 Subject: [PATCH 072/300] Fix position of quickadd button --- htdocs/theme/md/dropdown.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index 64bebc67f79..eb1fd668361 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -447,18 +447,23 @@ a.dropdown-item { max-width: 360px; } + #topmenu-quickadd-dropdown a.login-dropdown-a, #topmenu-bookmark-dropdown a.login-dropdown-a { color: #000; } + #topmenu-quickadd-dropdown .dropdown-menu, #topmenu-bookmark-dropdown .dropdown-menu { width: 230px; } + div#topmenu-quickadd-dropdown, div#topmenu-bookmark-dropdown { position: unset; } - div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { + div#topmenu-global-search-dropdown, + div#topmenu-quickadd-dropdown, + div#topmenu-bookmark-dropdown { line-height: unset; } From 56afa676c011eba86f439d7b6c27193de04e9f64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 15:50:57 +0100 Subject: [PATCH 073/300] Fix tags --- htdocs/comm/mailing/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 63750d5d834..80b808524c8 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -374,7 +374,7 @@ if (empty($reshook)) { if (!$resql2) { dol_print_error($db); } else { - //if cheack read is use then update prospect contact status + //if check read is use then update prospect contact status if (strpos($message, '__CHECK_READ__') !== false) { //Update status communication of thirdparty prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".((int) $obj->rowid).")"; @@ -476,6 +476,9 @@ if (empty($reshook)) { // other are set at begin of page $object->substitutionarrayfortest['__EMAIL__'] = $object->sendto; $object->substitutionarrayfortest['__MAILTOEMAIL__'] = ''.$object->sendto.''; + $object->substitutionarrayfortest['__CHECK_READ__'] = ''; + $object->substitutionarrayfortest['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; + $object->substitutionarrayfortest['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->sendto).'&mtid=0'; // Subject and message substitutions complete_substitutions_array($object->substitutionarrayfortest, $langs); From ba59e4eb3de9bdf7d2123a68f48996d11b6f448b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 18:29:58 +0100 Subject: [PATCH 074/300] FIx duplicate image file from src data --- htdocs/core/class/CMailFile.class.php | 32 ++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 46de8d8e7af..ecfe968bd02 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -273,10 +273,16 @@ class CMailFile if ($this->html_images[$i]) { $this->atleastoneimage = 1; if ($this->html_images[$i]['type'] == 'cidfromdata') { - $posindice = count($filename_list); - $filename_list[$posindice] = $this->html_images[$i]['fullpath']; - $mimetype_list[$posindice] = $this->html_images[$i]['content_type']; - $mimefilename_list[$posindice] = $this->html_images[$i]['name']; + if (!in_array($this->html_images[$i]['fullpath'], $filename_list)) { + // If this file path is not already into the $filename_list, we add it. + $posindice = count($filename_list); + $filename_list[$posindice] = $this->html_images[$i]['fullpath']; + $mimetype_list[$posindice] = $this->html_images[$i]['content_type']; + $mimefilename_list[$posindice] = $this->html_images[$i]['name']; + } else { + $posindice = array_search($this->html_images[$i]['fullpath'], $filename_list); + } + // We complete the array of cid_list $cid_list[$posindice] = $this->html_images[$i]['cid']; } dol_syslog("CMailFile::CMailfile: html_images[$i]['name']=".$this->html_images[$i]['name'], LOG_DEBUG); @@ -284,6 +290,8 @@ class CMailFile } } } + //var_dump($filename_list); + //var_dump($cid_list);exit; // Set atleastoneimage if there is at least one file (into $filename_list array) if (is_array($filename_list)) { @@ -1124,7 +1132,14 @@ class CMailFile return 'Bad value for sendmode'; } - $parameters = array(); + // Now we delete image files that were created dynamically to manage data inline files + foreach ($this->html_images as $val) { + if (!empty($val['type']) && $val['type'] == 'cidfromdata') { + //dol_delete($val['fullpath']); + } + } + + $parameters = array('sent' => $res); $action = ''; $reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -1655,7 +1670,7 @@ class CMailFile } /** - * Seearch images into html message and init array this->images_encoded if found + * Search images into html message and init array this->images_encoded if found * * @param string $images_dir Location of physical images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO @@ -1742,7 +1757,8 @@ class CMailFile } /** - * Seearch images with data:image format into html message + * Seearch images with data:image format into html message. + * If we find some, we create it on disk. * * @param string $images_dir Location of where to store physicaly images files. For example $dolibarr_main_data_root.'/medias' * @return int >0 if OK, <0 if KO @@ -1784,7 +1800,7 @@ class CMailFile foreach ($matches[1] as $key => $ext) { // We save the image to send in disk $filecontent = $matches[2][$key]; - $cid = 'cid000'.dol_hash($this->html, 'md5'); + $cid = 'cid000'.dol_hash($this->html, 'md5'); // The id must not change if image is same $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; $fhandle = @fopen($destfiletmp, 'w'); From 0fbb197231b461885e6479d95d89077bba505dc6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 18:42:15 +0100 Subject: [PATCH 075/300] Fix position of quickadd button --- htdocs/theme/md/dropdown.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index 64bebc67f79..eb1fd668361 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -447,18 +447,23 @@ a.dropdown-item { max-width: 360px; } + #topmenu-quickadd-dropdown a.login-dropdown-a, #topmenu-bookmark-dropdown a.login-dropdown-a { color: #000; } + #topmenu-quickadd-dropdown .dropdown-menu, #topmenu-bookmark-dropdown .dropdown-menu { width: 230px; } + div#topmenu-quickadd-dropdown, div#topmenu-bookmark-dropdown { position: unset; } - div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { + div#topmenu-global-search-dropdown, + div#topmenu-quickadd-dropdown, + div#topmenu-bookmark-dropdown { line-height: unset; } From f034b12ec1e2bc56e7637b438ddd88d314b90666 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 20:07:53 +0100 Subject: [PATCH 076/300] Clean code --- htdocs/mrp/js/lib_dispatch.js.php | 2 +- htdocs/mrp/mo_production.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/js/lib_dispatch.js.php b/htdocs/mrp/js/lib_dispatch.js.php index 8470716ce8f..1dd2d9d164c 100644 --- a/htdocs/mrp/js/lib_dispatch.js.php +++ b/htdocs/mrp/js/lib_dispatch.js.php @@ -69,7 +69,7 @@ function addDispatchLine(index, type, mode) { mode = mode || 'qtymissing' - console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); + console.log("mrp/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); if(mode == 'qtymissingconsume' || mode == 'allmissingconsume') { var inputId = 'qtytoconsume'; var warehouseId = 'idwarehouse'; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index c4353bd264b..a4225a0a14a 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -432,7 +432,8 @@ $tmpbatch = new Productlot($db); $tmpstockmovement = new MouvementStock($db); $help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag'; -llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php')); +$morejs = array('/mrp/js/lib_dispatch.js.php'); +llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, $morejs); $newToken = newToken(); From 4d44e6853348f874c19bac3c707a41c142e4964b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 20:40:46 +0100 Subject: [PATCH 077/300] Fix substitution for emailing test --- htdocs/comm/mailing/card.php | 2 +- htdocs/core/class/html.formmail.class.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 06d72826101..1fec22ea979 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -323,7 +323,7 @@ if (empty($reshook)) { $newmessage = make_substitutions($message, $substitutionarray, null, 0); $moreinheader = ''; - if (preg_match('/__UNSUBSCRIBE__/', $message)) { + if (preg_match('/__UNSUBSCRIBE_(_|URL_)/', $message)) { $moreinheader = "List-Unsubscribe: <__UNSUBSCRIBE_URL__>\n"; $moreinheader = make_substitutions($moreinheader, $substitutionarray); } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 96d6d4c0d89..e3a60fbf6ab 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1615,8 +1615,6 @@ class FormMail extends Form $tmparray['__OTHER3__'] = 'Other3'; $tmparray['__OTHER4__'] = 'Other4'; $tmparray['__OTHER5__'] = 'Other5'; - $tmparray['__CHECK_READ__'] = 'TagCheckMail'; - $tmparray['__UNSUBSCRIBE__'] = 'TagUnsubscribe'; //,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing $onlinepaymentenabled = 0; From a0446ee1196cdcff9e9e05aab5416c5d5ad4d6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Feb 2023 21:16:25 +0100 Subject: [PATCH 078/300] doc --- htdocs/delivery/class/delivery.class.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 9a11302e5bd..975ee6cbfb6 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2011-2023 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2023 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 @@ -113,6 +114,9 @@ class Delivery extends CommonObject */ public $statuts; + /** + * @var DeliveryLine[] lines + */ public $lines = array(); @@ -1150,7 +1154,6 @@ class Delivery extends CommonObject } - /** * Management class of delivery note lines */ @@ -1203,13 +1206,23 @@ class DeliveryLine extends CommonObjectLine public $product_ref; public $product_label; + public $price; + public $fk_origin_line; public $origin_id; - public $price; - + /** + * @var int origin line ID + */ public $origin_line_id; + /** + * @var int origin line ID + * @deprecated + * @see $origin_line_id + */ + public $commande_ligne_id; + /** * Constructor From 4068b1db87f0439180b96c37f82fef23ba524376 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 21:19:01 +0100 Subject: [PATCH 079/300] Fix link for read or unsubscribe must use a unique hash --- htdocs/admin/mailing.php | 2 +- htdocs/admin/mails.php | 3 ++- htdocs/admin/mails_emailing.php | 8 +++++--- htdocs/comm/mailing/card.php | 12 ++++++------ htdocs/core/actions_massactions.inc.php | 2 +- htdocs/core/actions_sendmails.inc.php | 2 +- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- .../core/actions_massactions_mail.inc.php | 1 - htdocs/public/emailing/mailing-read.php | 6 +++--- htdocs/public/emailing/mailing-unsubscribe.php | 6 ++++-- scripts/emailings/mailing-send.php | 6 +++--- 11 files changed, 27 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 19effcdfd2e..8a6f6522606 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -155,7 +155,7 @@ if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && !isValidEmail($conf->global print ' '.img_warning($langs->trans("BadEMail")); } print ''; -print ''; +print ''; print ''; print ''; print ''; // Accountancy_account_insurance print ''; print ''; // Accountancy_account_interest print ''; print ''; - } else // For external software - { + } else { + // For external software // Accountancy_account_capital print ''; print ''; From 78e3275fa983fd0958c6051485c269eb391858c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Feb 2023 21:50:11 +0100 Subject: [PATCH 084/300] doc --- htdocs/core/lib/fourn.lib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index c658916e359..7093493dad9 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Marc Barilley * Copyright (C) 2011-2013 Philippe Grand - * Copyright (C) 2022 Frédéric France + * Copyright (C) 2022-2023 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 @@ -29,10 +29,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param FactureFournisseur $object Object related to tabs * @return array Array of tabs to show */ -function facturefourn_prepare_head($object) +function facturefourn_prepare_head(FactureFournisseur $object) { global $db, $langs, $conf; @@ -56,7 +56,7 @@ function facturefourn_prepare_head($object) } //if ($fac->mode_reglement_code == 'PRE') - if (!empty($conf->paymentbybanktransfer->enabled)) { + if (isModEnabled('paymentbybanktransfer')) { $nbStandingOrders = 0; $sql = "SELECT COUNT(pfd.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; @@ -132,8 +132,8 @@ function facturefourn_prepare_head($object) /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs - * @return array Array of tabs to show + * @param CommandeFournisseur $object Object related to tabs + * @return array Array of tabs to show */ function ordersupplier_prepare_head(CommandeFournisseur $object) { From 4c6b8d7a20e1fa1ff56ef9a1f19d1d19cb772f39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 22:14:10 +0100 Subject: [PATCH 085/300] Fix navigation into timespent --- htdocs/projet/tasks/time.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 139a1711658..d97dee9a11b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1112,23 +1112,27 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + // Task + // Show section with information of task. If id of task is not defined and project id defined, then $projectidforalltimes is not empty. if (empty($projectidforalltimes) && empty($allprojectforuser)) { $head = task_prepare_head($object); print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition'); if ($action == 'deleteline') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); + $urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST("lineid", 'int').($withproject ? '&withproject=1' : ''); + print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); } $param = ($withproject ? '&withproject=1' : ''); + $param .= ($param ? '&' : '').'id='.$object->id; // ID of task $linkback = $withproject ? ''.$langs->trans("BackToList").'' : ''; if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id); } $morehtmlref = ''; @@ -1225,17 +1229,15 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser if ($projectstatic->id > 0 || $allprojectforuser > 0) { - if ($action == 'deleteline' && !empty($projectidforalltimes)) { - print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); - } - // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('tasktimelist')); $formconfirm = ''; if ($action == 'deleteline' && !empty($projectidforalltimes)) { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); + // We must use projectidprojectid if on list of timespent of project and id=taskid if on list of timespent of a task + $urlafterconfirm = $_SERVER["PHP_SELF"]."?".($projectstatic->id > 0 ? 'projectid='.$projectstatic->id : ($object->id > 0 ? "id=".$object->id : '')).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : '')."&contextpage=".urlencode($contextpage); + $formconfirm = $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1); } // Call Hook formConfirm From 043e0b6ce06318da1f18854d419affbedae24005 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 22:26:14 +0100 Subject: [PATCH 086/300] Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into develop --- htdocs/core/class/commondocgenerator.class.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 319c2a7ef2c..26d90d54fb8 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -70,11 +70,6 @@ abstract class CommonDocGenerator */ public $scandir; - /** - * @var string model name - */ - public $name; - /** * @var string model description (short text) */ From 34252d34c461f647653b33151e6dadd4a5ea8b7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 22:31:21 +0100 Subject: [PATCH 087/300] Debug v18 --- htdocs/public/emailing/mailing-unsubscribe.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index f4ca2b10031..286818bad1c 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -91,6 +91,7 @@ if (empty($tag) || ($unsuscrib != '1')) { $head = ''; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; + llxHeader($head, $langs->trans("MailUnsubcribe"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); dol_syslog("public/emailing/mailing-unsubscribe.php : Launch unsubscribe requests", LOG_DEBUG); @@ -107,12 +108,12 @@ if (!$resql) { $obj = $db->fetch_object($resql); if (empty($obj)) { - print 'Email tag not found. Operation canceled.'; + print 'Emailing tag '.$tag.' not found in database. Operation canceled.'; llxFooter('', 'private'); exit; } if (empty($obj->email)) { - print 'Email for this tag not valid. Operation canceled.'; + print 'Email for this tag is not valid. Operation canceled.'; llxFooter('', 'private'); exit; } From 9e59a3d60173f0a8a98cbeb4f401438cccb71c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Feb 2023 08:57:44 +0100 Subject: [PATCH 088/300] fix warning --- htdocs/core/class/rssparser.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 6992612592d..663bb96a7b6 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -446,7 +446,7 @@ class RssParser $itemDescription = sanitizeVal((string) $item['description']); $itemPubDate = sanitizeVal((string) $item['pubdate']); $itemId = sanitizeVal((string) $item['guid']); - $itemAuthor = sanitizeVal((string) $item['author']); + $itemAuthor = sanitizeVal((string) ($item['author'] ?? '')); } // Loop on each category From e403b416376ac2f4c438a483a087e6708895666c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Feb 2023 09:14:25 +0100 Subject: [PATCH 089/300] translations --- htdocs/langs/en_US/boxes.lang | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 9e80e36b119..e74539132f6 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -118,6 +118,27 @@ BoxCustomersOutstandingBillReached=Customers with oustanding limit reached UsersHome=Home users and groups MembersHome=Home Membership ThirdpartiesHome=Home Thirdparties +productindex=Home products and services +mrpindex=Home MRP +commercialindex=Home commercial +projectsindex=Home projects +invoiceindex=Home invoices +hrmindex=Home invoices TicketsHome=Home Tickets +stockindex=Home stocks +sendingindex=Home shippings +receptionindex=Home receivings +activityindex=Home activity +proposalindex=Home proposal +ordersindex=Home orders +orderssuppliersindex=Home orders suppliers +contractindex=Home contracts +interventionindex=Home interventions +suppliersproposalsindex=Home suppliers proposals +donationindex=Home donations +specialexpensesindex=Home specials expenses +expensereportindex=Home expensereport +mailingindex=Home mailing +opensurveyindex=Home opensurvey AccountancyHome=Home Accountancy ValidatedProjects=Validated projects From e90f41da9d4f6b05ba6be7fd024dd6d408fc8e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Feb 2023 09:28:30 +0100 Subject: [PATCH 090/300] Update rssparser.class.php --- htdocs/core/class/rssparser.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 663bb96a7b6..6d83fd6d6da 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -36,6 +36,8 @@ class RssParser */ public $error = ''; + public $feed_version; + private $_format = ''; private $_urlRSS; private $_language; From 67d9934aa1e63dff6a21dcf0054cd10fc664ae28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 24 Feb 2023 10:54:23 +0100 Subject: [PATCH 091/300] pagination works with any font --- htdocs/core/lib/pdf.lib.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e4f6b169e93..d6b8365c730 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -13,6 +13,7 @@ * Copyright (C) 2019 Lenin Rivas * Copyright (C) 2020 Nicolas ZABOURI * Copyright (C) 2021-2022 Anthony Berton + * Copyright (C) 2023 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 @@ -1287,11 +1288,14 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } } // Show page nb only on iso languages (so default Helvetica font) - if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { + // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { $pdf->SetXY($dims['wk'] - $dims['rm'] - 18, -$posy); - //$pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); - $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); - } + // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); + // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts + // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell + $pagination = $pdf->PageNo().' / '.$pdf->getNumPages(); + $pdf->MultiCell(18, 2, $pagination, 0, 'R', 0); + // } // Show Draft Watermark if (!empty($watermark)) { From 5f8bff123b8e3d53dea3bb0180fc88c154a5777b Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 24 Feb 2023 11:05:54 +0100 Subject: [PATCH 092/300] fix process --- htdocs/core/ajax/flowjs-server.php | 3 --- htdocs/public/test/test_forms.php | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index 480dba39195..962db0b8548 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -35,9 +35,6 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} // If there is no need to load and show top and left menu if (!defined("NOLOGIN")) { define("NOLOGIN", '1'); diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index e041e1d98fa..50693000442 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -109,7 +109,7 @@ print '

'."\n"; // Test6a: Upload of big files print "Test 6a: Upload of big files
\n"; -print "The file will be uploaded in the directory: documents/test_form/temp/
\n"; +print "The file will be uploaded in the directory: documents/test/temp/
\n"; if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { print ''; @@ -121,7 +121,7 @@ if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { jQuery(document).ready(function() { var flow = new Flow({ target:"'.DOL_URL_ROOT.'/core/ajax/flowjs-server.php", - query:{module:"test_form"}, + query:{module:"test", token:"'.newToken().'"}, testChunks:false }); '; @@ -166,7 +166,7 @@ if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { '; print ''; } else { - print "If this message displays, please add flow.js file which can be found here :https://github.com/flowjs/flow.js and place the js lib in htdocs/includes/flowjs/
\n"; + print "If this message displays, please add flow.js and flow.min.js files which can be found here: https://github.com/flowjs/flow.js and place the js lib in htdocs/includes/flowjs/
\n"; } print '
'; From fdf374fdee7706a47fb9c693e2bdcec2ca7d635f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:15:17 +0100 Subject: [PATCH 093/300] Add field to protect a file by a password --- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 1 + htdocs/install/mysql/tables/llx_ecm_files.sql | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 5f4a0f2cdd0..522940b62ed 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -82,4 +82,5 @@ ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_user_valid ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_projet (fk_projet); ALTER TABLE llx_supplier_proposal ADD INDEX idx_supplier_proposal_fk_account(fk_account); +ALTER TABLE llx_ecm_files ADD COLUMN share_pass varchar(32) after share; diff --git a/htdocs/install/mysql/tables/llx_ecm_files.sql b/htdocs/install/mysql/tables/llx_ecm_files.sql index cf9f3a8f148..14952d45594 100644 --- a/htdocs/install/mysql/tables/llx_ecm_files.sql +++ b/htdocs/install/mysql/tables/llx_ecm_files.sql @@ -22,6 +22,7 @@ CREATE TABLE llx_ecm_files ref varchar(128), -- contains hash from filename+filepath label varchar(128) NOT NULL, -- contains hash of file content share varchar(128) NULL, -- contains hash for file sharing + share_pass varchar(32) NULL, -- password to access the file (encoded with dolEncrypt) entity integer DEFAULT 1 NOT NULL, -- multi company id filepath varchar(255) NOT NULL, -- relative to dolibarr document dir. Example module/def filename varchar(255) NOT NULL, -- file name only without any directory From 27c15c523dcfe685e8266500f0d23cc49a396e2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:27:14 +0100 Subject: [PATCH 094/300] CSS --- htdocs/product/reassort.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 22c475ab337..bfe12d7efe2 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -465,7 +465,7 @@ if ($resql) { print $product->getNomUrl(1, '', 16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''; - print '
'; + print ''; if (isModEnabled("service") && $type == 1) { print ''; } } @@ -523,7 +523,7 @@ if ($resql) { if (!empty($conf->global->PRODUCT_USE_UNITS)) { print ''; } - print ''; From ca6e7dcb4164359b1d3fdf97b6200544030b5c36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:31:46 +0100 Subject: [PATCH 095/300] Fix sql error --- htdocs/product/stock/stockatdate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 69893559dfa..da6627942c5 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -276,10 +276,10 @@ if (!empty($canvas)) { $sql .= " AND p.canvas = '".$db->escape($canvas)."'"; } if ($fk_warehouse > 0) { - $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } else { - $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } // Add where from hooks From c266681379762dc853c6ba568418f598a384b5a0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 24 Feb 2023 11:32:56 +0100 Subject: [PATCH 096/300] fix : Warning: Constant DOL_URL_ROOT already defined in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/filemanagerdol/connectors/php/config.inc.php on line 40 --- htdocs/core/filemanagerdol/connectors/php/config.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/filemanagerdol/connectors/php/config.inc.php b/htdocs/core/filemanagerdol/connectors/php/config.inc.php index 848153d84fc..368b82c42e7 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.inc.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.inc.php @@ -37,7 +37,7 @@ $pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine if ($pos == '/') { $pos = ''; // si $pos vaut /, on le met a '' } -define('DOL_URL_ROOT', $pos); +//define('DOL_URL_ROOT', $pos); $entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_SESSION['dol_entity'] : null); // SECURITY: You must explicitly enable this "connector". (Set it to "true"). From 2a16db0e860fe5aa5705f4532630c969f2fbc81b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 24 Feb 2023 11:35:07 +0100 Subject: [PATCH 097/300] fix : Warning: Undefined variable in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/filemanagerdol/browser/default/browser.php on line 52 --- htdocs/core/filemanagerdol/browser/default/browser.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/filemanagerdol/browser/default/browser.php b/htdocs/core/filemanagerdol/browser/default/browser.php index 0c1b29d12b2..1cf6d8612c2 100644 --- a/htdocs/core/filemanagerdol/browser/default/browser.php +++ b/htdocs/core/filemanagerdol/browser/default/browser.php @@ -49,6 +49,7 @@ if (!empty($conf->modules_parts['theme'])) { // This slow down } //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; +$themeparam = ''; print ''."\n"; ?> From 2cb3e260f7fdc6be019de07663ded89b6e3f3d04 Mon Sep 17 00:00:00 2001 From: hystepik Date: Fri, 24 Feb 2023 12:20:39 +0100 Subject: [PATCH 098/300] add module verification --- htdocs/core/ajax/flowjs-server.php | 9 ++++++++- htdocs/public/test/test_forms.php | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php index 962db0b8548..d520c57c9c5 100644 --- a/htdocs/core/ajax/flowjs-server.php +++ b/htdocs/core/ajax/flowjs-server.php @@ -62,7 +62,7 @@ $flowTotalSize = GETPOST('flowTotalSize', 'alpha'); top_httphead(); dol_syslog(join(',', $_GET)); -$result = true; +$result = false; if (!empty($upload_dir)) { $temp_dir = $upload_dir.'/'.$flowIdentifier; @@ -71,6 +71,12 @@ if (!empty($upload_dir)) { $upload_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'; } +if ($module != "test" && !isModEnabled($module)) { + echo json_encode("The module ".$module." is not enabled"); + header("HTTP/1.0 400"); + die(); +} + if ($_SERVER['REQUEST_METHOD'] === 'GET') { $chunk_file = $temp_dir.'/'.$flowFilename.'.part'.$flowChunkNumber; if (file_exists($chunk_file)) { @@ -83,6 +89,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (file_exists($upload_dir.'/'.$flowFilename)) { echo json_encode('File '.$flowIdentifier.' was already uploaded'); header("HTTP/1.0 200 Ok"); + die(); } elseif (!empty($_FILES)) foreach ($_FILES as $file) { // check the error status if ($file['error'] != 0) { diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index 50693000442..b7ed524e297 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -161,6 +161,11 @@ if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) { $("#filespan").text("No file selected."); $(this).hide(); }) + flow.on("fileError", function(file, message){ + console.log("Error on file upload",file, message); + $("#"+file.uniqueIdentifier+"pgbar").width(20+"%"); + $("#"+file.uniqueIdentifier+"pgbar").children("span").text("ERROR UPLOAD"); + }); } }) '; From 393b0e7c4c48e7b826805795d3af095d69f0088b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 12:56:11 +0100 Subject: [PATCH 099/300] NEW Support multiselect in the warehouse selection combo box --- .../product/class/html.formproduct.class.php | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index b4da53f4635..beb84f3e455 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -260,7 +260,7 @@ class FormProduct /** * Return list of warehouses * - * @param string|int $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup) + * @param string|int|array $selected Id of preselected warehouse ('' or '-1' for no value, 'ifone' and 'ifonenodefault' = select value if one value otherwise no value, '-2' to use the default value from setup) * @param string $htmlname Name of html select html * @param string $filterstatus warehouse status filter, following comma separated filter options can be used * 'warehouseopen' = select products from open warehouses, @@ -272,17 +272,18 @@ class FormProduct * @param string $empty_label Empty label if needed (only if $empty=1) * @param int $showstock 1=Show stock count * @param int $forcecombo 1=Force combo iso ajax select2 - * @param array $events Events to add to select2 - * @param string $morecss Add more css classes to HTML select + * @param array $events Events to add to select2 + * @param string $morecss Add more css classes to HTML select * @param array $exclude Warehouses ids to exclude * @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse * @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock * @param string $orderBy [='e.ref'] Order by + * @param int $multiselect 1=Allow multiselect * @return string HTML select * * @throws Exception */ - public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') + public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref', $multiselect = 0) { global $conf, $langs, $user, $hookmanager; @@ -307,17 +308,20 @@ class FormProduct if (strpos($htmlname, 'search_') !== 0) { if (empty($user->fk_warehouse) || $user->fk_warehouse == -1) { - if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { + if (is_scalar($selected) && ($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { $selected = $conf->global->MAIN_DEFAULT_WAREHOUSE; } } else { - if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + if (is_scalar($selected) && ($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { $selected = $user->fk_warehouse; } } } - $out .= ''; } @@ -330,15 +334,21 @@ class FormProduct } if (($fk_product || ($showstock > 0)) && ($arraytypes['stock'] != 0 || ($showstock > 0))) { if ($arraytypes['stock'] <= 0) { - $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; + $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } else { - $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; + $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } } $out .= ''; $fieldtosortcurrentstock = 'stock'; -if ($fk_warehouse > 0) { +if (!empty($search_fk_warehouse)) { $fieldtosortcurrentstock = 'stock_reel'; } @@ -506,9 +525,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) { }*/ $currentstock = ''; - if ($fk_warehouse > 0) { + if (!empty($search_fk_warehouse)) { //if ($productid > 0) { - $currentstock = $stock_prod_warehouse[$objp->rowid][$fk_warehouse]; + foreach ($search_fk_warehouse as $val) { + if (!is_numeric($currentstock)) { + $currentstock = 0; + } + $currentstock += $stock_prod_warehouse[$objp->rowid][$val]; + } //} else { // $currentstock = $objp->stock_reel; //} @@ -521,17 +545,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } if ($mode == 'future') { - $prod->load_stock('warehouseopen, warehouseinternal', 0, $dateendofday); - $stock = $prod->stock_theorique; - $prod->load_stock('warehouseopen, warehouseinternal', 0); - $virtualstock = $prod->stock_theorique; + $prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0, $dateendofday); + $stock = $prod->stock_theorique; // virtual stock at a date + $prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0); + $virtualstock = $prod->stock_theorique; // virtual stock in infinite future } else { - if ($fk_warehouse > 0) { - $stock = $currentstock - $movements_prod_warehouse[$objp->rowid][$fk_warehouse]; - $nbofmovement = $movements_prod_warehouse_nb[$objp->rowid][$fk_warehouse]; + $stock = $currentstock; + $nbofmovement = 0; + if (!empty($search_fk_warehouse)) { + foreach ($search_fk_warehouse as $val) { + $stock -= $movements_prod_warehouse[$objp->rowid][$val]; + $nbofmovement += $movements_prod_warehouse_nb[$objp->rowid][$val]; + } } else { - $stock = $currentstock - $movements_prod[$objp->rowid]; - $nbofmovement = $movements_prod_nb[$objp->rowid]; + $stock -= $movements_prod[$objp->rowid]; + $nbofmovement += $movements_prod_nb[$objp->rowid]; } } @@ -585,7 +613,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; From 904babed3ecb0cd78b8918a2ca768ba0e7f1ff14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 13:28:19 +0100 Subject: [PATCH 101/300] Fix filter on warehouse must not be visible on stock at date in future --- htdocs/product/stock/stockatdate.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 69893559dfa..1f9b82a4392 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -361,10 +361,14 @@ print img_picto('', 'product', 'class="pictofiwedwidth"').' '; print ' '; print $form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, $langs->trans('Product'), 0, 'maxwidth300', 0, '', null, 1); -print '   '; -print img_picto('', 'stock', 'class="pictofiwedwidth"'); -print ' '; -print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifonenodefault'), 'fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref'); +if ($mode != 'future') { + // A virtual stock in future has no sense on a per warehouse view, so no filter on warehouse is available for stock at date in future + print '   '; + print img_picto('', 'stock', 'class="pictofiwedwidth"'); + print ' '; + print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifonenodefault'), 'fk_warehouse', '', 1, 0, 0, $langs->trans('Warehouse'), 0, 0, null, '', null, 1, false, 'e.ref'); +} + print ''; $parameters = array(); From ad84346cae11869e3594ab5efa1b4075071a1deb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:31:46 +0100 Subject: [PATCH 102/300] Fix sql error --- htdocs/product/stock/stockatdate.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 1f9b82a4392..4138841b3bb 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -276,10 +276,10 @@ if (!empty($canvas)) { $sql .= " AND p.canvas = '".$db->escape($canvas)."'"; } if ($fk_warehouse > 0) { - $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } else { - $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms, p.duration, p.tobuy, p.stock'; } // Add where from hooks From a3a9d6e6a28448fde9650eff54fb4a729bf44d1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 11:27:14 +0100 Subject: [PATCH 103/300] CSS --- htdocs/product/reassort.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index f3c354b88a4..b0f6f4b3283 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -464,7 +464,7 @@ if ($resql) { print $product->getNomUrl(1, '', 16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''; - print ''; + print ''; if (isModEnabled("service") && $type == 1) { print ''; } } @@ -514,7 +514,7 @@ if ($resql) { if (!empty($conf->global->PRODUCT_USE_UNITS)) { print ''; } - print ''; From fae051deb4eeef7f6ac729c355a3fd577ef2e93c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2023 15:14:18 +0100 Subject: [PATCH 104/300] Fix warning --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3d4a094c30b..deba6883277 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3411,8 +3411,8 @@ if (!function_exists("llxFooter")) { } // Wrapper to add log when clicking on download or preview - if (isModEnabled('blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0 && $object->statut > 0) { - if (in_array($object->element, array('facture'))) { // Restrict for the moment to element 'facture' + if (isModEnabled('blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0) { + if (in_array($object->element, array('facture')) && $object->statut > 0) { // Restrict for the moment to element 'facture' print "\n\n"; ?> '."\n"; + } + print "\n"; print "\n"; } @@ -507,7 +514,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio llxHeaderVierge($langs->trans("NewSubscription")); print '
'; -print load_fiche_titre($langs->trans("NewSubscription"), '', '', 0, 0, 'center'); +print load_fiche_titre(img_picto('', 'member_nocolor', 'class="pictofixedwidth"').'   '.$langs->trans("NewSubscription"), '', '', 0, 0, 'center'); print '
'; @@ -532,7 +539,9 @@ print ''; if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEWFORM_FORCETYPE) || $action == 'create') { print ''; print '
'; - print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; + + $messagemandatory = ''.$langs->trans("FieldsWithAreMandatory", '*').''; + //print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; print dol_get_fiche_head(''); @@ -579,7 +588,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW $defaulttype = $tmp[0]; $isempty = 0; } - print '
'."\n"; } else { @@ -591,7 +600,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''."\n"; } else { @@ -609,21 +618,21 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').''."\n"; // Lastname - print ''."\n"; + print ''."\n"; // Firstname - print ''."\n"; + print ''."\n"; // EMail - print ''."\n"; // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; } // Gender @@ -699,7 +708,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW // TODO Move this into generic feature. if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); - print ''; - print ''; // Recipients / adressed-to @@ -1489,8 +1489,8 @@ class FormTicket } } - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) { - $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO.' (generic email)'; + if (getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')) { + $sendto[] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO').' (generic email)'; } // Print recipient list diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index a78a610ed1c..ce872c7ac38 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -46,6 +46,9 @@ $track_id = GETPOST('track_id', 'alpha', 3); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); +// Store current page url +$url_page_current = DOL_URL_ROOT.'/ticket/agenda.php'; + $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index b5453ed638b..38d00de71fa 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -252,7 +252,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { $linkback = ''.$langs->trans("BackToList").' '; - dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, ''); + dol_banner_tab($object, 'ref', $linkback, (!empty($user->socid) ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1, ''); print dol_get_fiche_end(); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 1c7a25323e2..9c2208e9864 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -49,6 +49,9 @@ $track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +// Store current page url +$url_page_current = DOL_URL_ROOT.'/ticket/document.php'; + // Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 1ad01a7ae67..b42cff070f2 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -46,6 +46,9 @@ $track_id = GETPOST('track_id', 'alpha', 3); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); +// Store current page url +$url_page_current = DOL_URL_ROOT.'/ticket/messaging.php'; + $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", "aZ09comma"); $sortorder = GETPOST("sortorder", 'aZ09comma'); From a5703a9618a6c50d230d5c24a090f6483f1f7f48 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 1 Mar 2023 18:15:15 +0100 Subject: [PATCH 203/300] fix message for delete api --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 87311ce1259..16464caa03a 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1005,7 +1005,7 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) { $check = dolReplaceInFile($file_api, array($allContent => '')); if ($check) { dolReplaceInFile($file_api, array($begin => '', $end => '')); - setEventMessages($langs->trans("ApiObjectDeleted"), null); + setEventMessages($langs->trans("ApiObjectDeleted", $langs->transnoentities($objectname)), null); } fclose($handle); } From 64440da194c2274f0ae5e9118f21246f06246b07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 18:43:52 +0100 Subject: [PATCH 204/300] css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 307d2b25b69..6a31211db45 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7123,7 +7123,7 @@ div.tabsElem a.tab { } .publicnewmemberform #tablesubscribe { - color: #888; + color: #666; } /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5f3f965c021..3702f5bfdbb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -7043,6 +7043,10 @@ border-top-right-radius: 6px; border: 1px solid #888; } +.publicnewmemberform #tablesubscribe { + color: #666; +} + /* ============================================================================== */ /* Ticket module */ From f6271d83dbebb2bb2ea90791c32a62e722cf16bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 19:28:32 +0100 Subject: [PATCH 205/300] Debug v17 --- htdocs/admin/agenda.php | 4 + htdocs/core/modules/modPartnership.class.php | 30 +++--- ...terface_50_modAgenda_ActionsAuto.class.php | 4 +- .../mysql/data/llx_c_action_trigger.sql | 9 ++ .../modulebuilder/template/myobject_card.php | 2 +- htdocs/partnership/admin/about.php | 74 ------------- htdocs/partnership/partnership_card.php | 100 ++++++++++-------- 7 files changed, 85 insertions(+), 138 deletions(-) delete mode 100644 htdocs/partnership/admin/about.php diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 0969dc9c66b..7a29c881f77 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -194,6 +194,10 @@ if (!empty($triggers)) { if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { continue; } + if ($trigger['code'] == 'ACTION_CREATE') { + // This is the trigger to add an event, enabling it will create infinite loop + continue; + } if ($search_event === '' || preg_match('/'.preg_quote($search_event, '/').'/i', $trigger['code'])) { print ''; diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 8e8421540c7..44ef6b527db 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -212,7 +212,7 @@ class modPartnership extends DolibarrModules // Dictionaries $this->dictionaries=array( - 'langs'=>'partnership@partnership', + 'langs'=>'partnership', // List of tables we want to see into dictonnary editor 'tabname'=>array("c_partnership_type"), // Label of tables @@ -291,7 +291,7 @@ class modPartnership extends DolibarrModules // 'leftmenu'=>'partnership', // 'url'=>'/partnership/partnership_list.php', // // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - // 'langs'=>'partnership@partnership', + // 'langs'=>'partnership', // 'position'=>1100+$r, // // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. // 'enabled'=>'$conf->partnership->enabled', @@ -349,18 +349,18 @@ class modPartnership extends DolibarrModules $r = 1; /* BEGIN MODULEBUILDER EXPORT PARTNERSHIP */ /* - $langs->load("partnership@partnership"); + $langs->load("partnership"); $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='partnership@partnership'; + $this->export_icon[$r]='partnership'; // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array - $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership@partnership'; + $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; //unset($this->export_fields_array[$r]['t.fieldtoremove']); //$keyforclass = 'PartnershipLine'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnershipline@partnership'; $keyforalias='tl'; //include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership@partnership'; + $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; //$keyforselect='partnershipline'; $keyforaliasextra='extraline'; $keyforelement='partnershipline@partnership'; //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; @@ -380,13 +380,13 @@ class modPartnership extends DolibarrModules $r = 1; /* BEGIN MODULEBUILDER IMPORT PARTNERSHIP */ /* - $langs->load("partnership@partnership"); + $langs->load("partnership"); $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='partnership@partnership'; - $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership@partnership'; + $this->export_icon[$r]='partnership'; + $keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership@partnership'; + $keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) $this->export_sql_start[$r]='SELECT DISTINCT '; @@ -417,11 +417,11 @@ class modPartnership extends DolibarrModules // Create extrafields during init //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); - //$result1=$extrafields->addExtraField('partnership_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); - //$result2=$extrafields->addExtraField('partnership_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); - //$result3=$extrafields->addExtraField('partnership_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); - //$result4=$extrafields->addExtraField('partnership_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); - //$result5=$extrafields->addExtraField('partnership_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled'); + //$result1=$extrafields->addExtraField('partnership_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); + //$result2=$extrafields->addExtraField('partnership_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); + //$result3=$extrafields->addExtraField('partnership_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); + //$result4=$extrafields->addExtraField('partnership_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); + //$result5=$extrafields->addExtraField('partnership_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership', '$conf->partnership->enabled'); // Permissions $this->remove($options); diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index d8b57918d83..f4c515c1f24 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -981,6 +981,8 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->trackid = 'sub'.$object->id; } elseif (preg_match('/^MEMBER_/', $action)) { $object->trackid = 'mem'.$object->id; + } elseif (preg_match('/^PARTNERSHIP_/', $action)) { + $object->trackid = 'pship'.$object->id; } elseif (preg_match('/^PROJECT_/', $action)) { $object->trackid = 'proj'.$object->id; } elseif (preg_match('/^TASK_/', $action)) { @@ -1079,7 +1081,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to; } - // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table + // Object linked (if link is for thirdparty, contact or project, it is a recording error. We should not have links in link table // for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources. if (!in_array($elementtype, array('societe', 'contact', 'project'))) { $actioncomm->fk_element = $elementid; diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 9aa28c116c8..ad33a4e4f6a 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -150,6 +150,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact address record','contact',52); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',53); + +-- recruitment module insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504); @@ -178,3 +180,10 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903); + +-- partnership module +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_CREATE','Partnership created','Executed when a partnership is created','partnership',58000); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_MODIFY','Partnership modified','Executed when a partnership is modified','partnership',58002); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_SENTBYMAIL','Mails sent from partnership file','Executed when you send email from partnership file','partnership',58004); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PARTNERSHIP_DELETE','Partnership deleted','Executed when a partnership is deleted','partnership',58006); + diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 6bb89d1aaf7..dc8dafd433e 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -511,7 +511,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); } // Back to draft diff --git a/htdocs/partnership/admin/about.php b/htdocs/partnership/admin/about.php deleted file mode 100644 index 47423bf4709..00000000000 --- a/htdocs/partnership/admin/about.php +++ /dev/null @@ -1,74 +0,0 @@ - - * Copyright (C) 2021 Dorian Laurent - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file partnership/admin/about.php - * \ingroup partnership - * \brief About page of module Partnership. - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once '../lib/partnership.lib.php'; - -// Translations -$langs->loadLangs(array("errors", "admin", "partnership@partnership")); - -// Access control -if (!$user->admin) { - accessforbidden(); -} - -// Parameters -$action = GETPOST('action', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); - - -/* - * Actions - */ - - -/* - * View - */ - -$form = new Form($db); - -$page_name = "PartnershipAbout"; -llxHeader('', $langs->trans($page_name)); - -// Subheader -$linkback = ''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); - -// Configuration header -$head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'about', '', 0, 'partnership@partnership'); - -require_once DOL_DOCUMENT_ROOT.'/core/modules/modPartnership.class.php'; -$tmpmodule = new modPartnership($db); -print $tmpmodule->getDescLong(); - -// Page end -print dol_get_fiche_end(); -llxFooter(); -$db->close(); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index b544ad94fc7..7679b63da09 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -39,10 +39,11 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'partnershipcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $lineid = GETPOST('lineid', 'int'); +$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); // Initialize technical objects $object = new Partnership($db); @@ -73,20 +74,25 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$permissiontoread = $user->rights->partnership->read; -$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php +$permissiontoread = $user->hasRight('partnership', 'read'); +$permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('partnership', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$permissionnote = $user->hasRight('partnership', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('partnership', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); -// Security check - Protection if external user +// Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; -//$result = restrictedArea($user, 'partnership', $object->id); -if (empty($conf->partnership->enabled)) accessforbidden(); -if (empty($permissiontoread)) accessforbidden(); +//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0); +//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft); +if (!isModEnabled('partnership')) { + accessforbidden(); +} +if (!$permissiontoread) { + accessforbidden(); +} if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); @@ -119,11 +125,11 @@ if (empty($reshook)) { $fk_partner = ($managedfor == 'member') ? GETPOST('fk_member', 'int') : GETPOST('fk_soc', 'int'); $obj_partner = ($managedfor == 'member') ? $object->fk_member : $object->fk_soc; + $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record + // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; - $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record - // Action accept object if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) { $result = $object->validate($user); @@ -264,6 +270,10 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { + if (empty($permissiontoadd)) { + accessforbidden('NotEnoughPermissions', 0, 1); + } + print load_fiche_titre($langs->trans("NewPartnership"), '', 'object_'.$object->picto); print ''; @@ -333,9 +343,8 @@ if (($id || $ref) && $action == 'edit') { // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - $res = $object->fetch_optionals(); - $head = partnershipPrepareHead($object); + print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto); $formconfirm = ''; @@ -405,38 +414,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref = '
'; /* // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { + $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; + } // Project - if (!empty($conf->project->enabled)) { - $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project') . ' '; - if ($permissiontoadd) { - //if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; - $morehtmlref .= ' : '; - if ($action == 'classify') { - //$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 0, 1, '', 'maxwidth300'); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(); - } else { - $morehtmlref .= ''; - } - } - }*/ + if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
'; + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } + } + } + */ $morehtmlref .= '
'; if (!isset($npfilter)) { $npfilter = ""; @@ -632,8 +638,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->partnership->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->partnership->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->partnership->write; // If you can create/edit, you can remove a file on card + $genallowed = $permissiontoread; // If you can read, you can build the PDF to read content + $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card print $formfile->showdocuments('partnership:Partnership', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } @@ -651,7 +657,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); print ''; } From 12bd795afc7d34014e4400565651c9ea96bbcc87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 20:10:37 +0100 Subject: [PATCH 206/300] Work on Kanban view --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/adherents/class/adherent_type.class.php | 2 +- htdocs/bom/class/bom.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/compta/bank/class/account.class.php | 4 ++-- htdocs/compta/bank/list.php | 2 +- htdocs/compta/cashcontrol/class/cashcontrol.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- .../compta/paiement/cheque/class/remisecheque.class.php | 2 +- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 +-- htdocs/compta/sociales/class/chargesociales.class.php | 2 +- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/core/class/html.formcategory.class.php | 2 +- htdocs/don/class/don.class.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/expensereport/class/paymentexpensereport.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/holiday/class/holiday.class.php | 2 +- htdocs/hrm/class/evaluation.class.php | 2 +- .../knowledgemanagement/class/knowledgerecord.class.php | 2 +- htdocs/loan/class/loan.class.php | 2 +- htdocs/modulebuilder/template/class/myobject.class.php | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/recruitment/class/recruitmentcandidature.class.php | 2 +- htdocs/recruitment/class/recruitmentjobposition.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- .../supplier_proposal/class/supplier_proposal.class.php | 2 +- htdocs/theme/eldy/global.inc.php | 8 ++++---- htdocs/ticket/class/ticket.class.php | 2 +- htdocs/user/class/user.class.php | 2 +- 40 files changed, 44 insertions(+), 45 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index f2e84e5127a..89a1ed2904d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3323,7 +3323,7 @@ class Adherent extends CommonObject $return .= '
'.$this->getmorphylib('', 2).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index eda018e6dca..396dea45b0e 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -1016,7 +1016,7 @@ class AdherentType extends CommonObject } } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index d5e3532dbd6..361ac64928e 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1589,7 +1589,7 @@ class BOM extends CommonObject $return .= '
'.$prod->getNomUrl(1).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 46f06614941..5fc0de4c43f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3976,7 +3976,7 @@ class Propal extends CommonObject $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 89b2a5f31d9..3ee2ad037b5 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1844,10 +1844,10 @@ class Account extends CommonObject } if (method_exists($this, 'solde')) { $return .= '
'; - $return .= ''.$langs->trans("Balance").' : '.price($this->solde(1), 0, $langs, 1, -1, -1, $this->currency_code).''; + $return .= ''.$langs->trans("Balance").' : '.price(price2num($this->solde(1), 'MT'), 0, $langs, 1, -1, -1, $this->currency_code).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 668ada03fdb..bc2c2528d07 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -787,7 +787,7 @@ foreach ($accounts as $key => $type) { if (!empty($arrayfields['balance']['checked'])) { print '
'; if (!$i) { diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 8cc3c93b59c..deb86fba456 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -495,7 +495,7 @@ class CashControl extends CommonObject $return .= '
'.$langs->trans("Year").' : '.$this->year_close.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ed4d8bfd498..265b5732f24 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5819,7 +5819,7 @@ class Facture extends CommonInvoice $return .= '
'.$this->fk_user_author.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 53751cce194..5c885267559 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -1050,7 +1050,7 @@ class RemiseCheque extends CommonObject $return .= ' | '.$this->account_id.''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } if (property_exists($this, 'amount')) { $return .= ' |
'.$langs->trans("Amount").' : '.price($this->amount).'
'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 7d7127fc6ba..cbe2eda9533 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2524,7 +2524,6 @@ class BonPrelevement extends CommonObject { global $langs; - $return = '
'; $return .= '
'; $return .= ''; @@ -2540,7 +2539,7 @@ class BonPrelevement extends CommonObject $return .= '
'.$langs->trans("Amount").' : '.price($this->total).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->statut, 5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= '
'; $return .= '
'; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 3619ebfad7a..140f1cffec6 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -779,7 +779,7 @@ class ChargeSociales extends CommonObject $return .= ''.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 2ec1199dd29..220863a0cb2 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -935,7 +935,7 @@ class Tva extends CommonObject $return .= '
'.$langs->trans("DateEnd").' : '.dol_print_date($this->datev).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->paiementtype, 5, $this->alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index b44d22da312..407eed06921 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -2202,7 +2202,7 @@ class Contact extends CommonObject $return .= ' : '.$this->LibPubPriv($this->priv).''; }*/ if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f494bf22ef5..14f5cb62bfa 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2844,7 +2844,7 @@ class Contrat extends CommonObject $return .= '
'.$langs->trans("DateContract").' : '.dol_print_date($this->date_contrat, 'day').''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 695b1ab657b..ef252765ea0 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -41,7 +41,7 @@ class FormCategory extends Form * @param string $showempty 1 or 'string' to add an empty entry * @return string A HTML filter box (Note: selected results can get with GETPOST("search_category_".$type."_list")) */ - public function getFilterBox($type, array $preSelected, $morecss = "minwidth300 widthcentpercentminusx", $searchCategoryProductOperator = -1, $multiselect = 1, $nocateg = 1, $showempty = '') + public function getFilterBox($type, array $preSelected, $morecss = "minwidth300imp widthcentpercentminusx", $searchCategoryProductOperator = -1, $multiselect = 1, $nocateg = 1, $showempty = '') { global $langs, $db; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 08491e9b4a3..01b1e1bf6cc 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -1171,7 +1171,7 @@ class Don extends CommonObject $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->labelStatus, 5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 76a0614da18..4bac14b34f1 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2793,7 +2793,7 @@ class ExpenseReport extends CommonObject $return .= ''.dol_print_date($this->date_fin, 'day').''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 053f46d20cf..955181cf632 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -744,7 +744,7 @@ class PaymentExpenseReport extends CommonObject $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index bd76ca7bbc3..e739ee0806e 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1503,7 +1503,7 @@ class Fichinter extends CommonObject $return .= '
'.$langs->trans("Duration").' : '.convertSecondToTime($this->duration, 'allhourmin').''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 170f60912aa..17033086e69 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3648,7 +3648,7 @@ class CommandeFournisseur extends CommonOrder $return .= '
'.$langs->trans("Billed").' : '.yn($this->billed).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 34af6f4cbda..7e4dad3f219 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3307,7 +3307,7 @@ class FactureFournisseur extends CommonInvoice $return .= '
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 4717db8bea0..619d8a3fc85 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2493,7 +2493,7 @@ class Holiday extends CommonObject $return .= ''.dol_print_date($this->date_fin, 'day').''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index a62b16b54f1..ab87aaeeef5 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -1084,7 +1084,7 @@ class Evaluation extends CommonObject } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 275b0a2a2e3..15682d00fc9 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -1145,7 +1145,7 @@ class KnowledgeRecord extends CommonObject $return .= ''.dolGetFirstLineOfText($this->question).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 951d430e96f..ef44b2fb196 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -751,7 +751,7 @@ class Loan extends CommonObject } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->totalpaid, 5, $this->alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2dcb87ea523..19d99557569 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -921,7 +921,7 @@ class MyObject extends CommonObject $return .= ''.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 2e9072ac0f2..e5af1f2bddf 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1661,7 +1661,7 @@ class Mo extends CommonObject $return .= '
'.$langs->trans('Quantity').' : '.$this->qty.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 26650f81d2a..6a5f4623618 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -1343,7 +1343,7 @@ class Partnership extends CommonObject $return .= '
'.$this->label.'
'; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8939132cff9..d4a30517068 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -6404,7 +6404,7 @@ class Product extends CommonObject $return .= '
'.$langs->trans('PhysicalStock').' : '.$this->stock_reel.''; } if (method_exists($this, 'getLibStatut')) { - $return .='
'.$this->getLibStatut(5, 1).' '.$this->getLibStatut(5, 0).''; + $return .='
'.$this->getLibStatut(3, 1).' '.$this->getLibStatut(3, 0).''; } $return .= ''; $return .= ''; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 6b0d558c689..416d96ad55b 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -977,7 +977,7 @@ class Entrepot extends CommonObject $return .= '
'.price($this->sellvalue).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c9a811ad245..fc4f6acb426 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2419,7 +2419,7 @@ class Project extends CommonObject $return .= '
'.price($this->opp_amount).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index abb07d36480..1f203113b3a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1002,7 +1002,7 @@ if ($user->rights->user->user->lire) { // Filter on categories if (isModEnabled('categorie') && $user->rights->categorie->lire) { $formcategory = new FormCategory($db); - $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array); + $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth300imp widthcentpercentminusx'); } // Filter on customer categories if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST) && !empty($conf->categorie->enabled) && $user->rights->categorie->lire) { diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index e3dfd4bd135..809b8d0cd54 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -1053,7 +1053,7 @@ class RecruitmentCandidature extends CommonObject $return .= '
'.$langs->trans("phone").' : '.$this->phone.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 69ec74deb9d..b0ca58d6b8f 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -1138,7 +1138,7 @@ class RecruitmentJobPosition extends CommonObject $return .= ' | '.$langs->trans("Remuneration").' : '.$this->remuneration_suggested.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).' | '.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).' : '.$obj->nbapplications.'
'; + $return .= '
'.$this->getLibStatut(3).' | '.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).' : '.$obj->nbapplications.'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 90666a6853d..7192a14e9d3 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -770,7 +770,7 @@ class Salary extends CommonObject $return .= '
'.$langs->trans("Amount").' : '.price($this->amount).''; } if (method_exists($this, 'LibStatut')) { - $return .= '
'.$this->LibStatut($this->paye, 5, $this->alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $this->alreadypaid).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 01f35b9ea17..6ae3cad817a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5225,7 +5225,7 @@ class Societe extends CommonObject } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 892c3f77687..fbcf04aacd2 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2789,7 +2789,7 @@ class SupplierProposal extends CommonObject $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ttc).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 6a31211db45..4ce4a7ed19e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4253,15 +4253,15 @@ div.liste_titre_bydiv { border-top-style: solid; border-left: px solid var(--colortopbordertitle1); - /* border-right: px solid var(--colortopbordertitle1); */ + border-right: px solid var(--colortopbordertitle1); border-collapse: collapse; - display: table; padding: 2px 0px 2px 0; box-shadow: none; - /*width: calc(100% - 1px); 1px more, i don't know why so i remove */ - width: calc(100%); + /*width: calc(100% - 1px); 1px less because display is table and with100%, it generated a right border 1px left compared to the div-table-responsive under */ + width: unset; + /* display: table; */ } tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable.tr, tagtr.liste_titre { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6f309b7656f..207ba4d6a50 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -3021,7 +3021,7 @@ class Ticket extends CommonObject $return .= '
'.$langs->getLabelFromKey($this->db, 'TicketTypeShort'.$this->type_code, 'c_ticket_type', 'code', 'label', $this->type_code).'
'; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 648fd61fa6c..3fc11f9eadd 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3089,7 +3089,7 @@ class User extends CommonObject $return .= '
'.img_picto('', 'email').' '.$this->email.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(5).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; From 03bf66a6b10af27d253677ae21f31439ad47a467 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 21:20:16 +0100 Subject: [PATCH 207/300] css --- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4ce4a7ed19e..aafabf45d63 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -7115,7 +7115,7 @@ div.tabsElem a.tab { border: 1px solid #888; } .publicnewmemberform div.tabBarWithBottom { - border: 1px solid #f0f0f0; + border: 1px solid #e8e8e8; padding: 30px; border-radius: 8px; background-color: #f8f8f8; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3702f5bfdbb..2a46cf83911 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -7042,6 +7042,13 @@ border-top-right-radius: 6px; .public_border { border: 1px solid #888; } +.publicnewmemberform div.tabBarWithBottom { + border: 1px solid #e8e8e8; + padding: 30px; + border-radius: 8px; + background-color: #f8f8f8; + /*box-shadow: 2px 2px 10px #ddd;*/ +} .publicnewmemberform #tablesubscribe { color: #666; From a62d029d7d7ee744d40e57704f7c99f193f0718d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 21:37:18 +0100 Subject: [PATCH 208/300] Disable non secured feature --- htdocs/core/ajax/fileupload.php | 6 +++- htdocs/core/class/fileupload.class.php | 38 ++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 67f95700976..379a2e689a3 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -45,9 +45,13 @@ error_reporting(E_ALL | E_STRICT); $fk_element = GETPOST('fk_element', 'int'); $element = GETPOST('element', 'alpha'); - $upload_handler = new FileUpload(null, $fk_element, $element); +// Feature not enabled. Warning feature not used and not secured so disabled. +if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; +} + /* * View diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index ccea7de2d84..5a8e75b1e69 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -46,6 +46,12 @@ class FileUpload global $db, $conf; global $object; global $hookmanager; + + // Feature not enabled. Warning feature not used and not secured so disabled. + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $hookmanager->initHooks(array('fileupload')); $this->fk_element = $fk_element; @@ -238,6 +244,10 @@ class FileUpload */ protected function getFileObject($file_name) { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file_path = $this->options['upload_dir'].$file_name; if (is_file($file_path) && $file_name[0] !== '.') { $file = new stdClass(); @@ -278,6 +288,10 @@ class FileUpload { global $maxwidthmini, $maxheightmini; + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file_path = $this->options['upload_dir'].$file_name; $new_file_path = $options['upload_dir'].$file_name; @@ -309,6 +323,10 @@ class FileUpload */ protected function validate($uploaded_file, $file, $error, $index) { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + if ($error) { $file->error = $error; return false; @@ -399,8 +417,8 @@ class FileUpload // Also remove control characters and spaces (\x00..\x20) around the filename: $file_name = trim(basename(stripslashes($name)), ".\x00..\x20"); // Add missing file extension for known image types: - if (strpos($file_name, '.') === false && - preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { + $matches = array(); + if (strpos($file_name, '.') === false && preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { $file_name .= '.'.$matches[1]; } if ($this->options['discard_aborted_uploads']) { @@ -424,6 +442,10 @@ class FileUpload */ protected function handleFileUpload($uploaded_file, $name, $size, $type, $error, $index) { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file = new stdClass(); $file->name = $this->trimFileName($name, $type, $index); $file->mime = dol_mimetype($file->name, '', 2); @@ -470,6 +492,10 @@ class FileUpload */ public function get() { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null; if ($file_name) { @@ -488,6 +514,10 @@ class FileUpload */ public function post() { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { return $this->delete(); } @@ -543,6 +573,10 @@ class FileUpload */ public function delete() { + if (!getDolGlobalInt('MAIN_USE_JQUERY_FILEUPLOAD')) { + return; + } + $file_name = isset($_REQUEST['file']) ? basename(stripslashes($_REQUEST['file'])) : null; $file_path = $this->options['upload_dir'].$file_name; From 0d3a4d68b2281332611edf0314b9faca6c2e0ca6 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Wed, 1 Mar 2023 23:20:42 +0100 Subject: [PATCH 209/300] add comment in api_mymodule for seperate methods --- .../template/class/api_mymodule.class.php | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index fdb56ff3c67..a48b2f5010b 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -54,6 +54,8 @@ class MyModuleApi extends DolibarrApi $this->myobject = new MyObject($this->db); } + /*begin methods CRUD*/ + /** * Get properties of a myobject object * @@ -307,6 +309,31 @@ class MyModuleApi extends DolibarrApi } + /** + * Validate fields before create or update object + * + * @param array $data Array of data to validate + * @return array + * + * @throws RestException + */ + private function _validate($data) + { + $myobject = array(); + foreach ($this->myobject->fields as $field => $propfield) { + if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) { + continue; // Not a mandatory field + } + if (!isset($data[$field])) { + throw new RestException(400, "$field field missing"); + } + $myobject[$field] = $data[$field]; + } + return $myobject; + } + + /*end methods CRUD*/ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas @@ -369,27 +396,4 @@ class MyModuleApi extends DolibarrApi return $object; } - - /** - * Validate fields before create or update object - * - * @param array $data Array of data to validate - * @return array - * - * @throws RestException - */ - private function _validate($data) - { - $myobject = array(); - foreach ($this->myobject->fields as $field => $propfield) { - if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) { - continue; // Not a mandatory field - } - if (!isset($data[$field])) { - throw new RestException(400, "$field field missing"); - } - $myobject[$field] = $data[$field]; - } - return $myobject; - } } From 14a59483f58e99cc95af9c6fdc43274432ff25b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 23:50:02 +0100 Subject: [PATCH 210/300] Debug v17 --- htdocs/admin/pdf.php | 10 ++++++++ htdocs/admin/system/security.php | 4 ++-- htdocs/core/ajax/onlineSign.php | 23 +++++++++++++------ ...e_20_modWorkflow_WorkflowManager.class.php | 5 +++- htdocs/core/website.inc.php | 8 +++---- htdocs/includes/tcpdi/tcpdi.php | 2 +- htdocs/main.inc.php | 8 +++---- 7 files changed, 41 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index d8cc8d554a2..a015e2319b0 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -271,9 +271,19 @@ print ''; clearstatcache(); +if (getDolGlobalString('PDF_SECURITY_ENCRYPTION')) { + print '
'; + print 'The not supported and hidden option PDF_SECURITY_ENCRYPTION has been enabled. This means a lof of feature related to PDF will be broken, like mass PDF generation or online signature of PDF.'."\n"; + print 'You should disable this option.'; + print '
'; +} + + + // Misc options print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', ''); + print '
'; print '
'.$langs->trans("MailTitle").''.$object->title.'
'.$langs->trans("MailTitle").''.$object->title.'
'.$langs->trans("MailFrom").''; $emailarray = CMailFile::getArrayAddress($object->email_from); diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 86ce2eb70b2..b2f051bc3a6 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -58,6 +58,12 @@ if ($object->fetch($id) >= 0) { $linkback = ''.$langs->trans("BackToList").''; + $morehtmlref = '
'; + // Ref customer + $morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= '
'; + $morehtmlright = ''; $nbtry = $nbok = 0; if ($object->statut == 2 || $object->statut == 3) { @@ -71,7 +77,7 @@ if ($object->fetch($id) >= 0) { $morehtmlright .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); print '

'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c0e1ee67660..855fb711a86 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -168,7 +168,11 @@ class Form $ret .= 'id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; } if (!empty($notabletag) && $notabletag == 1) { - $ret .= ' : '; + if ($text) { + $ret .= ' : '; + } else { + $ret .= ' '; + } } if (!empty($notabletag) && $notabletag == 3) { $ret .= ' '; @@ -9350,7 +9354,7 @@ class Form // Left part of banner if ($morehtmlleft) { if ($conf->browser->layout == 'phone') { - $ret .= '
'.$morehtmlleft.'
'; // class="center" to have photo in middle + $ret .= '
'.$morehtmlleft.'
'; } else { $ret .= '
'.$morehtmlleft.'
'; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 1750cf00c7f..ad88ea06e1c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -249,7 +249,7 @@ input { padding: 4px; padding-left: 5px; } -.tableforfield input { +.tableforfield input, .refidno input { padding: 2px; } select { @@ -624,7 +624,7 @@ table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { text-transform: uppercase; color: #444; } -.valuefield .button, .valuefieldcreate .button, .refidno .button { +.valuefield .button, .valuefieldcreate .button, .refidno .button:not(.smallpaddingimp) { margin-top: 0 !important; margin-bottom: 0 !important; font-size: 0.85em !important; @@ -2954,9 +2954,12 @@ if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { .login_table .tdinputlogin input#securitycode { font-size: 1em; } +/* For the static info message */ .login_main_home { word-break: break-word; + width: fit-content; } +/* For the result or error message */ .login_main_message { text-align: center; max-width: 570px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 24078c3ca8f..2e0809ec311 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -456,6 +456,10 @@ a.commonlink { color: var(--colortextlink) !important; text-decoration: none; } input { font-size: unset; } +.tableforfield input, .refidno input { + padding: 2px; +} + /* input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FDFDFD; @@ -875,6 +879,9 @@ table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } +.refidno .button.smallpaddingimp { + font-size: 0.85em !important; +} .button:focus, .buttonDelete:focus { -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); @@ -3066,6 +3073,7 @@ form#login { .login_main_home { word-break: break-word; + width: fit-content; } .login_main_message { text-align: center; From 790a28f4577df845150ddc213e453c9f40e56979 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 12:17:35 +0100 Subject: [PATCH 064/300] Look and feel v18 --- htdocs/theme/md/style.css.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 2e0809ec311..9a06b361f66 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -547,8 +547,8 @@ input, select { border: none; text-shadow: none; text-transform: uppercase; - font-weight: bold; - margin: 0em 0.9em; + /* font-weight: bold; */ + margin: 0em 0.8em; padding: 0.6em 0.7em; line-height: 17px; } From 45cdbd8a600cd60bff7c3b3c511613b7279d92ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 12:18:02 +0100 Subject: [PATCH 065/300] Fix checkbox --- htdocs/core/lib/usergroups.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 273e7285273..64747c1bbf6 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -366,7 +366,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print '
'.$langs->trans("DefaultSkin").''.$conf->global->MAIN_THEME.' '.$langs->trans("UsePersonalValue").'  
'; + print '
'; print $form->editfieldkey("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); print ''; print $form->editfieldval("MailFrom", 'email_from', $object->email_from, $object, $user->hasRight('mailing', 'creer') && $object->statut < 3, 'string'); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 71e8617f927..79905182ee3 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -241,7 +241,7 @@ if ($object->fetch($id) >= 0) { //print '
'.$langs->trans("MailTitle").''.$object->title.'
'.$langs->trans("MailFrom").''; + print '
'.$langs->trans("MailFrom").''; $emailarray = CMailFile::getArrayAddress($object->email_from); foreach ($emailarray as $email => $name) { if ($name && $name != $email) { @@ -291,7 +291,7 @@ if ($object->fetch($id) >= 0) { } } if (empty($nbemail)) { - $nbemail .= ' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + $nbemail .= ' '.img_warning('');//.' '.$langs->trans("NoTargetYet").''; } if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 137e5f7d779..96d6d4c0d89 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -540,11 +540,15 @@ class FormMail extends Form // Substitution array/string $helpforsubstitution = ''; if (is_array($this->substit) && count($this->substit)) { - $helpforsubstitution .= $langs->trans('AvailableVariables').' :
'."\n"; + $helpforsubstitution .= $langs->trans('AvailableVariables').' :

'."\n"; } foreach ($this->substit as $key => $val) { $helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'
'; } + if (is_array($this->substit) && count($this->substit)) { + $helpforsubstitution .= '
'; + } + if (!empty($this->withsubstit)) { // Unset or set ->withsubstit=0 to disable this. $out .= '
'; //$out.='
'; @@ -1599,7 +1603,7 @@ class FormMail extends Form $tmparray = getCommonSubstitutionArray($langs, 2, array('object', 'objectamount'), $object); // Note: On email templated edition, this is null because it is related to all type of objects complete_substitutions_array($tmparray, $langs, null, $parameters); - // For mass emailing, we have different keys + // For mass emailing, we have different keys specific to the data into tagerts list $tmparray['__ID__'] = 'IdRecord'; $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode'; $tmparray['__EMAIL__'] = 'EMailRecipient'; @@ -1611,8 +1615,6 @@ class FormMail extends Form $tmparray['__OTHER3__'] = 'Other3'; $tmparray['__OTHER4__'] = 'Other4'; $tmparray['__OTHER5__'] = 'Other5'; - $tmparray['__USER_SIGNATURE__'] = 'TagUserSignature'; - $tmparray['__SENDEREMAIL_SIGNATURE__'] = 'TagEmailSenderSignature'; $tmparray['__CHECK_READ__'] = 'TagCheckMail'; $tmparray['__UNSUBSCRIBE__'] = 'TagUnsubscribe'; //,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 9fe6a615f5d..8d55ac65864 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -201,11 +201,11 @@ class mailing_fraise extends MailingTargets $s .= ''; - $s .= '
'; + $s .= '
'; $s .= $langs->trans("DateEndSubscription").':  '; - $s .= $langs->trans("After").' > '.$form->selectDate(-1, 'subscriptionafter', 0, 0, 1, 'fraise', 1, 0, 0); + $s .= $langs->trans("After").' > '.$form->selectDate(-1, 'subscriptionafter', 0, 0, 1, 'fraise', 1, 0, 0); $s .= '   '; - $s .= $langs->trans("Before").' < '.$form->selectDate(-1, 'subscriptionbefore', 0, 0, 1, 'fraise', 1, 0, 0); + $s .= ''.$langs->trans("Before").' < '.$form->selectDate(-1, 'subscriptionbefore', 0, 0, 1, 'fraise', 1, 0, 0); return $s; } diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 7fdcdeb0c60..907028ca881 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -118,7 +118,7 @@ class mailing_pomme extends MailingTargets $langs->load("users"); $s = ''; - $s .= ''; $s .= ''; $s .= ''; $s .= ''; @@ -126,7 +126,7 @@ class mailing_pomme extends MailingTargets $s .= ajax_combobox("filter_pomme"); $s .= ' '; - $s .= ''; $s .= ''; $s .= ''; $s .= ''; From 9216a6f8708c6866d52f3203933be9529a4059b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 13:21:45 +0100 Subject: [PATCH 068/300] FIX Bad value for phone in substitutions keys --- htdocs/core/lib/functions.lib.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d503026a868..c06630e96a2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3572,15 +3572,15 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli $picto = ''; } } - if ($adddivfloat) { + if ($adddivfloat == 1) { $rep .= '
'; - } else { + } elseif (empty($adddivfloat)) { $rep .= ''; } $rep .= ($withpicto ?img_picto($titlealt, 'object_'.$picto.'.png').' ' : '').$newphone; - if ($adddivfloat) { + if ($adddivfloat == 1) { $rep .= '
'; - } else { + } elseif (empty($adddivfloat)) { $rep .= ''; } } @@ -7586,9 +7586,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, '__USER_ID__' => (string) $user->id, '__USER_LOGIN__' => (string) $user->login, '__USER_EMAIL__' => (string) $user->email, - '__USER_PHONE__' => (string) dol_print_phone($user->office_phone), - '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile), - '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile), + '__USER_PHONE__' => (string) dol_print_phone($user->office_phone, '', 0, 0, '', " ", '', '', -1), + '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile, '', 0, 0, '', " ", '', '', -1), + '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile, '', 0, 0, '', " ", '', '', -1), '__USER_FAX__' => (string) $user->office_fax, '__USER_LASTNAME__' => (string) $user->lastname, '__USER_FIRSTNAME__' => (string) $user->firstname, @@ -7603,8 +7603,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray = array_merge($substitutionarray, array( '__MYCOMPANY_NAME__' => $mysoc->name, '__MYCOMPANY_EMAIL__' => $mysoc->email, - '__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone), - '__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax), + '__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone, '', 0, 0, '', " ", '', '', -1), + '__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax, '', 0, 0, '', " ", '', '', -1), '__MYCOMPANY_PROFID1__' => $mysoc->idprof1, '__MYCOMPANY_PROFID2__' => $mysoc->idprof2, '__MYCOMPANY_PROFID3__' => $mysoc->idprof3, From 6afb899f0540da6dab0568beb1a9e23fdebcef76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 15:50:57 +0100 Subject: [PATCH 069/300] Fix tags --- htdocs/comm/mailing/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d46ea99c213..06d72826101 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -373,7 +373,7 @@ if (empty($reshook)) { if (!$resql2) { dol_print_error($db); } else { - //if cheack read is use then update prospect contact status + //if check read is use then update prospect contact status if (strpos($message, '__CHECK_READ__') !== false) { //Update status communication of thirdparty prospect $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".((int) $obj->rowid).")"; @@ -480,6 +480,9 @@ if (empty($reshook)) { // other are set at begin of page $substitutionarray['__EMAIL__'] = $object->sendto; $substitutionarray['__MAILTOEMAIL__'] = ''.$object->sendto.''; + $substitutionarray['__CHECK_READ__'] = ''; + $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; + $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->sendto).'&mtid=0'; // Subject and message substitutions complete_substitutions_array($substitutionarray, $langs, $targetobject); From 4252db1c7938d691c452e816624ee96dfa7737e8 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 23 Feb 2023 15:51:52 +0100 Subject: [PATCH 070/300] FIX : Impossible to create value for product attribute (variant) --- htdocs/variants/card.php | 4 +--- .../tpl/productattributevalueline_create.tpl.php | 14 -------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 5f1065f5171..8daf1239deb 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -330,9 +330,7 @@ if ($action == 'create') { print ''; } - if (!empty($object->lines)) { - $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/variants/tpl', ($permissiontoedit ? 1 : 0)); - } + $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/variants/tpl', ($permissiontoedit ? 1 : 0)); if (!empty($object->lines) || ($permissiontoedit && $action != 'selectlines' && $action != 'editline')) { print '
'; diff --git a/htdocs/variants/tpl/productattributevalueline_create.tpl.php b/htdocs/variants/tpl/productattributevalueline_create.tpl.php index f23e7175f58..21ea651f3ef 100644 --- a/htdocs/variants/tpl/productattributevalueline_create.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_create.tpl.php @@ -40,20 +40,6 @@ $objectline = null; print "\n"; $nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines); -if ($nolinesbefore) { - ?> -
-
trans('AddNewLine'); ?> -
trans('Value'); ?> 
webmaster@example.com>'.dol_escape_htmltag('').'
'; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index e9a8132188c..06f4dfdea85 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -48,13 +48,14 @@ if ($action == 'test' || ($action == 'send' && $trackid = 'test')) { $substitutionarrayfortest = array( '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, - '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '' : '', + '__CHECK_READ__' => '', '__USER_LOGIN__' => $user->login, '__USER_EMAIL__' => $user->email, '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__ID__' => 'RecipientIdRecord', //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails + '__LOGIN__' => $user->login, '__LASTNAME__' => 'RecipientLastname', '__FIRSTNAME__' => 'RecipientFirstname', '__ADDRESS__'=> 'RecipientAddress', diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index b9cb57e0d80..1f638be3286 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -42,11 +42,13 @@ if ($action == 'test' || $action == 'send') { $substitutionarrayfortest = array( '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, - '__ID__' => 'RecipientIdRecord', - //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails - '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '' : '', + '__CHECK_READ__' => '', + '__USER_LOGIN__' => $user->login, + '__USER_EMAIL__' => $user->email, '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails '__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails + '__ID__' => 'RecipientIdRecord', + //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails '__LOGIN__' => $user->login, '__LASTNAME__' => 'RecipientLastname', '__FIRSTNAME__' => 'RecipientFirstname', diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 1fec22ea979..066fbedef51 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -248,9 +248,9 @@ if (empty($reshook)) { $substitutionarray['__OTHER5__'] = $other5; $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter) $substitutionarray['__SENDEREMAIL_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter) - $substitutionarray['__CHECK_READ__'] = ''; - $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; - $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid; + $substitutionarray['__CHECK_READ__'] = ''; + $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; + $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY.'-'.$obj->tag.'-'.$obj->email.'-'.$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid); $onlinepaymentenabled = 0; if (isModEnabled('paypal')) { @@ -480,9 +480,9 @@ if (empty($reshook)) { // other are set at begin of page $substitutionarray['__EMAIL__'] = $object->sendto; $substitutionarray['__MAILTOEMAIL__'] = ''.$object->sendto.''; - $substitutionarray['__CHECK_READ__'] = ''; - $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; - $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->sendto).'&mtid=0'; + $substitutionarray['__CHECK_READ__'] = 'sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0" width="1" height="1" style="width:1px;height:1px" border="0"/>'; + $substitutionarray['__UNSUBSCRIBE__'] = 'sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0" target="_blank" rel="noopener noreferrer">'.$langs->trans("MailUnsubcribe").''; + $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag=undefinedintestmode&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-undefinedintestmode-".$obj->sendto."-0", 'md5').'&email='.urlencode($obj->sendto).'&mtid=0'; // Subject and message substitutions complete_substitutions_array($substitutionarray, $langs, $targetobject); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c526f9312a0..460b6407789 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -469,7 +469,7 @@ if (!$error && $massaction == 'confirm_presend') { $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ', array_keys($listofqualifiedobj)) : $objecttmp->id); $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); $substitutionarray['__EMAIL__'] = $thirdparty->email; - $substitutionarray['__CHECK_READ__'] = ''; + $substitutionarray['__CHECK_READ__'] = ''; $parameters = array('mode'=>'formemail'); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 4f7580bb8ca..ab8a30455ff 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -346,7 +346,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO // Make substitution in email content $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); $substitutionarray['__EMAIL__'] = $sendto; - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; $parameters = array('mode'=>'formemail'); complete_substitutions_array($substitutionarray, $langs, $object, $parameters); diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index ce36d2bb899..817ec534b4b 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -282,7 +282,7 @@ if ($massaction == 'presend') { $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); $substitutionarray['__EMAIL__'] = $sendto; - $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; + $substitutionarray['__CHECK_READ__'] = ''; $substitutionarray['__PERSONALIZED__'] = ''; // deprecated $substitutionarray['__CONTACTCIVNAME__'] = ''; diff --git a/htdocs/eventorganization/core/actions_massactions_mail.inc.php b/htdocs/eventorganization/core/actions_massactions_mail.inc.php index 5398291e69f..2e03777c572 100644 --- a/htdocs/eventorganization/core/actions_massactions_mail.inc.php +++ b/htdocs/eventorganization/core/actions_massactions_mail.inc.php @@ -191,7 +191,6 @@ if (!$error && $massaction == 'confirm_presend_attendees') { } $substitutionarray['__EVENTORGANIZATION_ICS_LINK__'] = $html_link; $substitutionarray['__EVENTORGANIZATION_URL_LINK__'] = $url_link; - $substitutionarray['__CHECK_READ__'] = ''; $parameters = array('mode' => 'formemail'); diff --git a/htdocs/public/emailing/mailing-read.php b/htdocs/public/emailing/mailing-read.php index 5829c62dbd7..2382639ab6e 100644 --- a/htdocs/public/emailing/mailing-read.php +++ b/htdocs/public/emailing/mailing-read.php @@ -85,17 +85,17 @@ $securitykey = GETPOST('securitykey'); dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); -if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) { +if ($securitykey != dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-".$tag."-".$email."-".$mtid, 'md5')) { print 'Bad security key value.'; exit; } -if (!empty($tag)) { +if (!empty($tag) && $tag != 'undefined') { dol_syslog("public/emailing/mailing-read.php : Update status of email target and thirdparty for tag ".$tag, LOG_DEBUG); $sql = "SELECT mc.rowid, mc.email, mc.statut, mc.source_type, mc.source_id, m.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m"; - $sql .= " WHERE mc.fk_mailing = m.rowid AND mc.tag='".$db->escape($tag)."'"; + $sql .= " WHERE mc.fk_mailing = m.rowid AND mc.tag = '".$db->escape($tag)."'"; $resql = $db->query($sql); if (!$resql) dol_print_error($db); diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index a5291d06b7f..f4ca2b10031 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -61,6 +61,8 @@ global $user, $conf, $langs; $langs->loadLangs(array("main", "mails")); +$mtid = GETPOST('mtid'); +$email = GETPOST('email'); $tag = GETPOST('tag'); // To retreive the emailing, and recipient $unsuscrib = GETPOST('unsuscrib'); $securitykey = GETPOST('securitykey'); @@ -70,9 +72,9 @@ $securitykey = GETPOST('securitykey'); * Actions */ -dol_syslog("public/emailing/mailing-read.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); +dol_syslog("public/emailing/mailing-unsubscribe.php : tag=".$tag." securitykey=".$securitykey, LOG_DEBUG); -if ($securitykey != getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')) { +if ($securitykey != dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-".$tag."-".$email."-".$mtid, 'md5')) { print 'Bad security key value.'; exit; } diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 3e79be8472c..f2aeecec444 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -229,9 +229,9 @@ if ($resql) { $substitutionarray['__OTHER5__'] = $other5; $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter) $substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility - $substitutionarray['__CHECK_READ__'] = ''; - $substitutionarray['__UNSUBSCRIBE__'] = ''.$langs->trans("MailUnsubcribe").''; - $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'&email='.urlencode($obj->email).'&mtid='.$obj->rowid; + $substitutionarray['__CHECK_READ__'] = 'tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" width="1" height="1" style="width:1px;height:1px" border="0"/>'; + $substitutionarray['__UNSUBSCRIBE__'] = 'tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" target="_blank">'.$langs->trans("MailUnsubcribe").''; + $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY."-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid); $onlinepaymentenabled = 0; if (!empty($conf->paypal->enabled)) { From 7ec32d2458807731446be5c0f8cc214c9cbd23cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 21:28:58 +0100 Subject: [PATCH 080/300] Fix phpunit --- htdocs/projet/class/task.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index fea80f6d13a..7ff5d651fed 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -811,6 +811,8 @@ class Task extends CommonObjectLine * @param array $search_array_options Array of search * @param int $loadextras Fetch all Extrafields on each task * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action + * @param string $sortfield Sort field + * @param string $sortorder Sort order * @return array Array of tasks */ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadextras = 0, $loadRoleMode = 1, $sortfield = '', $sortorder = '') From 52f325c74eaab83172f2d1d4d2fb4b4a7e6207f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Feb 2023 21:34:54 +0100 Subject: [PATCH 081/300] clean code --- htdocs/loan/card.php | 14 +++++++------- htdocs/loan/class/loan.class.php | 6 ++++-- htdocs/loan/class/loanschedule.class.php | 2 +- htdocs/loan/schedule.php | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 921784e4c21..661a727268f 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -350,22 +350,22 @@ if ($action == 'create') { // Accountancy_account_capital print '
'.$langs->trans("LoanAccountancyCapitalCode").''; - print $formaccounting->select_account(GETPOST('accountancy_account_capital') ?GETPOST('accountancy_account_capital') : $conf->global->LOAN_ACCOUNTING_ACCOUNT_CAPITAL, 'accountancy_account_capital', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_capital') ?GETPOST('accountancy_account_capital') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_CAPITAL'), 'accountancy_account_capital', 1, '', 1, 1); print '
'.$langs->trans("LoanAccountancyInsuranceCode").''; - print $formaccounting->select_account(GETPOST('accountancy_account_insurance') ?GETPOST('accountancy_account_insurance') : $conf->global->LOAN_ACCOUNTING_ACCOUNT_INSURANCE, 'accountancy_account_insurance', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_insurance') ?GETPOST('accountancy_account_insurance') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INSURANCE'), 'accountancy_account_insurance', 1, '', 1, 1); print '
'.$langs->trans("LoanAccountancyInterestCode").''; - print $formaccounting->select_account(GETPOST('accountancy_account_interest') ?GETPOST('accountancy_account_interest') : $conf->global->LOAN_ACCOUNTING_ACCOUNT_INTEREST, 'accountancy_account_interest', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_interest') ?GETPOST('accountancy_account_interest') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INTEREST'), 'accountancy_account_interest', 1, '', 1, 1); print '
'.$langs->trans("LoanAccountancyCapitalCode").''; @@ -441,11 +441,11 @@ if ($id > 0) { $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, -1, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); } } else { if (!empty($object->fk_project)) { diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 54ad6dfb92b..951d430e96f 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2018 Frédéric France + * Copyright (C) 2015-2023 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 @@ -66,6 +66,9 @@ class Loan extends CommonObject public $account_capital; public $account_insurance; public $account_interest; + public $accountancy_account_capital; + public $accountancy_account_insurance; + public $accountancy_account_interest; /** * @var integer|string date_creation @@ -641,7 +644,6 @@ class Loan extends CommonObject $this->fk_bank = 1; $this->label = 'SPECIMEN'; $this->specimen = 1; - $this->socid = 1; $this->account_capital = 16; $this->account_insurance = 616; $this->account_interest = 518; diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 50314ce99fc..2618d50c6fd 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2023 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/loan/schedule.php b/htdocs/loan/schedule.php index fc91fc2f86d..61d763b693e 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -161,11 +161,11 @@ if (!empty($conf->project->enabled)) { $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= $formproject->select_projects(-1, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref .= ''; $morehtmlref .= '
'; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, -1, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); } } } else { From fe5f08afe340809b84a5dff9fea7841a5f906d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Feb 2023 21:36:22 +0100 Subject: [PATCH 082/300] clean code --- htdocs/loan/card.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 661a727268f..65d9d5da9b1 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -76,7 +76,7 @@ if ($reshook < 0) { } if (empty($reshook)) { // Classify paid - if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->loan->write) { + if ($action == 'confirm_paid' && $confirm == 'yes' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setPaid($user); if ($result > 0) { @@ -87,7 +87,7 @@ if (empty($reshook)) { } // Delete loan - if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->loan->write) { + if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->delete($user); if ($result > 0) { @@ -100,12 +100,12 @@ if (empty($reshook)) { } // Add loan - if ($action == 'add' && $user->rights->loan->write) { + if ($action == 'add' && $user->hasRight('loan', 'write')) { if (!$cancel) { $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth', 'int'), GETPOST('startday', 'int'), GETPOST('startyear', 'int')); - $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); + $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); $capital = price2num(GETPOST('capital')); - $rate = price2num(GETPOST('rate')); + $rate = price2num(GETPOST('rate')); if (!$capital) { $error++; $action = 'create'; @@ -168,23 +168,23 @@ if (empty($reshook)) { header("Location: list.php"); exit(); } - } elseif ($action == 'update' && $user->rights->loan->write) { + } elseif ($action == 'update' && $user->hasRight('loan', 'write')) { // Update record if (!$cancel) { $result = $object->fetch($id); $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth', 'int'), GETPOST('startday', 'int'), GETPOST('startyear', 'int')); - $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); - $capital = price2num(GETPOST('capital')); + $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth', 'int'), GETPOST('endday', 'int'), GETPOST('endyear', 'int')); + $capital = price2num(GETPOST('capital')); if (!$capital) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); $action = 'edit'; } else { $object->datestart = $datestart; - $object->dateend = $dateend; - $object->capital = $capital; - $object->nbterm = GETPOST("nbterm", 'int'); + $object->dateend = $dateend; + $object->capital = $capital; + $object->nbterm = GETPOST("nbterm", 'int'); $object->rate = price2num(GETPOST("rate", 'alpha')); $object->insurance_amount = price2num(GETPOST('insurance_amount', 'int')); @@ -225,7 +225,7 @@ if (empty($reshook)) { } // Link to a project - if ($action == 'classin' && $user->rights->loan->write) { + if ($action == 'classin' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setProject($projectid); if ($result < 0) { @@ -233,7 +233,7 @@ if (empty($reshook)) { } } - if ($action == 'setlabel' && $user->rights->loan->write) { + if ($action == 'setlabel' && $user->hasRight('loan', 'write')) { $object->fetch($id); $result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY'); if ($result < 0) { @@ -426,13 +426,13 @@ if ($id > 0) { $morehtmlref = '
'; // Ref loan - $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->hasRight('loan', 'write'), 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->hasRight('loan', 'write'), 'string', '', null, null, '', 1); // Project if (isModEnabled('project')) { $langs->loadLangs(array("projects")); $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->loan->write) { + if ($user->hasRight('loan', 'write')) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; } @@ -740,17 +740,17 @@ if ($id > 0) { print '
'; // Edit - if (($object->paid == 0 || $object->paid == 2) && $user->rights->loan->write) { + if (($object->paid == 0 || $object->paid == 2) && $user->hasRight('loan', 'write')) { print ''; } // Emit payment - if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write) { + if (($object->paid == 0 || $object->paid == 2) && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->hasRight('loan', 'write')) { print ''; } // Classify 'paid' - if (($object->paid == 0 || $object->paid == 2) && round($staytopay) <= 0 && $user->rights->loan->write) { + if (($object->paid == 0 || $object->paid == 2) && round($staytopay) <= 0 && $user->hasRight('loan', 'write')) { print ''; } From ed60d4fe22e5a8d259967093b5530313f6efe6f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Feb 2023 21:40:56 +0100 Subject: [PATCH 083/300] Debug v18 --- htdocs/core/class/html.form.class.php | 16 +++++++++------- htdocs/projet/tasks/time.php | 14 +++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 855fb711a86..a5d93f75202 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7009,8 +7009,8 @@ class Form $retstring = ''; - $hourSelected = 0; - $minSelected = 0; + $hourSelected = ''; + $minSelected = ''; // Hours if ($iSecond != '') { @@ -7024,14 +7024,14 @@ class Form $retstring .= '"; } elseif ($typehour == 'text' || $typehour == 'textselect') { - $retstring .= ''; + $retstring .= ''; } else { return 'BadValueForParameterTypeHour'; } @@ -7046,21 +7046,23 @@ class Form if ($minunderhours) { $retstring .= '
'; } else { - $retstring .= ' '; + if ($typehour != 'text') { + $retstring .= ' '; + } } if ($typehour == 'select' || $typehour == 'textselect') { $retstring .= '"; } elseif ($typehour == 'text') { - $retstring .= ''; + $retstring .= ''; } if ($typehour != 'text') { diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 30f2a867af0..57f1a5259cb 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2021 Laurent Destailleur + * Copyright (C) 2006-2023 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018 Ferran Marcet @@ -1921,20 +1921,20 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Duration - Time spent print '
'; - $durationtouse_start = 0; + $durationtouse_start = ''; if ($search_timespent_starthour || $search_timespent_startmin) { $durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60); } - print '
'.$langs->trans('from').' '; - $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text'); + print '
'.$langs->trans('from').' '; + print $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text', 0, 1); print '
'; - $durationtouse_end = 0; + $durationtouse_end = ''; if ($search_timespent_endhour || $search_timespent_endmin) { $durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60); } - print '
'.$langs->trans('at').' '; - $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text'); + print '
'.$langs->trans('at').' '; + print $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text', 0, 1); print '
'; print '
'.$product->label.''.dol_escape_htmltag($product->label).''; @@ -502,7 +502,7 @@ if ($resql) { if ($nb_warehouse > 1) { foreach ($warehouses_list as &$wh) { print ''; - print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : $product->stock_warehouse[$wh['id']]->real, 0, $langs, 1, 0); + print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : price2num($product->stock_warehouse[$wh['id']]->real, 'MS'), 0, $langs, 1, 0); print ''.dol_escape_htmltag($objp->unit_short).''; + print ''; print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"'); print ''.$langs->trans("Movements").''; print '
'; if ($nbofmovement > 0) { - print ''.$langs->trans("Movements").''; + print ''.$langs->trans("Movements").''; print ' '.$nbofmovement.''; } print ''.$product->label.''.dol_escape_htmltag($product->label).''; @@ -495,7 +495,7 @@ if ($resql) { if ($nb_warehouse > 1) { foreach ($warehouses_list as &$wh) { print ''; - print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : $product->stock_warehouse[$wh['id']]->real, 0, $langs, 1, 0); + print price(empty($product->stock_warehouse[$wh['id']]->real) ? 0 : price2num($product->stock_warehouse[$wh['id']]->real, 'MS'), 0, $langs, 1, 0); print ''.$objp->unit_short.''; + print ''; print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"'); print ''.$langs->trans("Movements").''; print '
'.$langs->trans("Type").' *'; + print '
'.$langs->trans("Type").' *'; print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); print '
'.$langs->trans('MemberNature').' *'."\n"; + print '
'.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print '
'.$langs->trans("Lastname").' *
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? ' *' : '').''; + print '
'.$langs->trans("Email").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? ' *' : '').''; //print img_picto('', 'email', 'class="pictofixedwidth"'); print '
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordRetype").' *
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordRetype").' *
'.$langs->trans("TurnoverOrBudget").' *'; + print '
'.$langs->trans("TurnoverOrBudget").' *'; print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1); print ' € or $'; diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 4fa4d25e543..9891a9f3c9d 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -150,10 +150,17 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ */ function llxFooterVierge() { + global $conf; + print ''; printCommonFooter('public'); + if (!empty($conf->use_javascript_ajax)) { + print "\n".''."\n"; + print ''."\n"; + } + print "\n"; print "\n"; } @@ -163,6 +170,7 @@ function llxFooterVierge() /* * Actions */ + $parameters = array(); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); @@ -536,7 +544,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // fetch optio llxHeaderVierge($langs->trans("NewPartnershipRequest")); print '
'; -print load_fiche_titre($langs->trans("NewPartnershipRequest"), '', '', 0, 0, 'center'); +print load_fiche_titre(img_picto('', 'hands-helping', 'class="pictofixedwidth"').'   '.$langs->trans("NewPartnershipRequest"), '', '', 0, 0, 'center'); print '
'; @@ -560,7 +568,8 @@ print ''; print '
'; -print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; +$messagemandatory = ''.$langs->trans("FieldsWithAreMandatory", '*').''; +//print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; //print $langs->trans("FieldsWithIsForPublic",'**').'
'; print dol_get_fiche_head(''); @@ -592,20 +601,20 @@ if (getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')) { print ''."\n"; if (!getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')) { - print ''."\n"; } // Company -print ''."\n"; // Lastname -print ''."\n"; +print ''."\n"; // Firstname -print ''."\n"; +print ''."\n"; // EMail -print ''."\n"; // Address diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index cf7293109c7..2777e48c7f5 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1663,7 +1663,7 @@ if ($ispaymentok) { $content .= $companylangs->transnoentitiesnoconv("None"); } else { $topic .= ($ispostactionok ? '' : ' ('.$companylangs->trans("WarningPostActionErrorAfterPayment").')'); - $content .= ''.$companylangs->transnoentitiesnoconv("Error").''; + $content .= ''.$companylangs->transnoentitiesnoconv("Error").''; } $content .= '
'."\n"; foreach ($postactionmessages as $postactionmessage) { diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index 5644123392b..bd8ccd07901 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -486,11 +486,11 @@ jQuery(document).ready(function () { print '
'.$langs->trans('PartnershipType').' *'."\n"; + print '
'.$langs->trans('PartnershipType').' *'."\n"; print $form->selectarray("partnershiptype", $listofpartnership, GETPOSTISSET('partnershiptype') ? GETPOST('partnershiptype', 'int') : 'ifone', 1); print '
'.$langs->trans("Company").' *'; +print '
'.$langs->trans("Company").' *'; print img_picto('', 'company', 'class="pictofixedwidth"'); print '
'.$langs->trans("Lastname").' *
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").' *'; +print '
'.$langs->trans("Email").' *'; //print img_picto('', 'email', 'class="pictofixedwidth"'); print '
'."\n"; // Lastname -print ''."\n"; +print ''."\n"; // Firstname -print ''."\n"; +print ''."\n"; // EMail -print ''."\n"; +print ''."\n"; // Company print ''."\n"; // Address @@ -538,7 +538,7 @@ $parameters['tpl_context']='public'; // define template context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Comments print ''; -print ''; +print ''; print ''; print ''."\n"; diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index dd9c8c7cdb0..cc7b6bb8e01 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -595,13 +595,13 @@ jQuery(document).ready(function () { print '
'.$langs->trans("Lastname").' *
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").' *
'.$langs->trans("Email").' *
'.$langs->trans("Company").'
'.$langs->trans("Message").' *'.$langs->trans("Message").' *
'."\n"; // Name -print ''; +print ''; print ''; print ''; // Email -print ''."\n"; +print ''."\n"; // Company -print ''."\n"; // Address print ''; } // Type of event -print ''."\n"; +print ''."\n"; print ''; // Label -print ''."\n"; +print ''."\n"; print ''."\n"; // Note -print ''."\n"; +print ''."\n"; print ''."\n"; print "
lastname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
'.$langs->trans("Email").'*
'.$langs->trans("Company").'*'; +print '
'.$langs->trans("Company").'*'; print '
'.$langs->trans("Address").''."\n"; @@ -646,13 +646,13 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print '
'.$langs->trans("Format").'*
'.$langs->trans("Format").'*'.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).'
'.$langs->trans("LabelOfBooth").'*
'.$langs->trans("LabelOfBooth").'*
'.$langs->trans("Description").'*
'.$langs->trans("Description").'*
\n"; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 417466a1f44..5078164f6ce 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -528,17 +528,17 @@ jQuery(document).ready(function () { print ''."\n"; // Last Name -print ''; +print ''; print ''; print ''; // First Name -print ''; +print ''; print ''; print ''; // Email -print ''."\n"; +print ''."\n"; // Company -print ''."\n"; // Address print ''; } // Type of event -print ''."\n"; +print ''."\n"; print ''; // Label -print ''."\n"; +print ''."\n"; print ''."\n"; // Note -print ''."\n"; +print ''."\n"; print ''."\n"; print "
lastname).'" autofocus="autofocus">
firstname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
'.$langs->trans("Email").'*
'.$langs->trans("Company").'*'; +print '
'.$langs->trans("Company").'*'; print '
'.$langs->trans("Address").''."\n"; @@ -580,13 +580,13 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print '
'.$langs->trans("Format").'*
'.$langs->trans("Format").'*'.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).'
'.$langs->trans("LabelOfconference").'*
'.$langs->trans("LabelOfconference").'*
'.$langs->trans("Description").'*
'.$langs->trans("Description").'*
\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index fc0af24a3a1..307d2b25b69 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -411,8 +411,8 @@ input.buttonpaymentstripe { background-position: 8px 11px; } .logopublicpayment #dolpaymentlogo { - max-height: 100px; - max-width: 320px; + max-height: 80px; + max-width: 300px; image-rendering: -webkit-optimize-contrast; /* better rendering on public page header */ } @@ -7114,8 +7114,17 @@ div.tabsElem a.tab { .public_border { border: 1px solid #888; } +.publicnewmemberform div.tabBarWithBottom { + border: 1px solid #f0f0f0; + padding: 30px; + border-radius: 8px; + background-color: #f8f8f8; + /*box-shadow: 2px 2px 10px #ddd;*/ +} - +.publicnewmemberform #tablesubscribe { + color: #888; +} /* ============================================================================== */ /* Ticket module */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9d7737bc0ca..5f3f965c021 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -669,7 +669,8 @@ input.buttonpaymentstripe { background-position: 8px 7px; } .logopublicpayment #dolpaymentlogo { - max-height: 100px; + max-height: 80px; + max-width: 300px; image-rendering: -webkit-optimize-contrast; /* better rendering on public page header */ } a.butStatus { From f362c66b28967a1da925edfa4204285c9eeb2aa1 Mon Sep 17 00:00:00 2001 From: Maximilien Rozniecki Date: Wed, 1 Mar 2023 16:54:49 +0100 Subject: [PATCH 201/300] changed by ->db inside ticket.class.php --- htdocs/ticket/class/ticket.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index ce0997c7a02..09c9c07977f 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -3038,7 +3038,7 @@ class Ticket extends CommonObject */ public function removeClosedContact($to) { - global $db, $langs; + global $langs; $langs->load("ticket"); if (isset($this->id)) { @@ -3048,11 +3048,11 @@ class Ticket extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sc on (ec.fk_socpeople = sc.rowid AND tc.source = 'external')"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u on (ec.fk_socpeople = u.rowid AND tc.source = 'internal')"; $sql .= " WHERE IF(tc.source = 'external', sc.statut = 1, u.statut = 1)"; - $resql = $db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $num = $this->db->num_rows($resql); for ($i = 0; $num > $i; $i++) { - $non_closed_contacts[] = $db->fetch_row($resql); + $non_closed_contacts[] = $this->db->fetch_row($resql); } } $to = array_filter($to, function($v, $k) use($non_closed_contacts, $langs) { From 921cd13f266b42a234940b4b3b3fa55ecb7f7920 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 1 Mar 2023 17:38:38 +0100 Subject: [PATCH 202/300] FIX avoid php8 warnings --- htdocs/core/class/html.formticket.class.php | 8 ++++---- htdocs/ticket/agenda.php | 3 +++ htdocs/ticket/contact.php | 2 +- htdocs/ticket/document.php | 3 +++ htdocs/ticket/messaging.php | 3 +++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 4f3ae4bc5e6..0baa4dd5f8a 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1423,7 +1423,7 @@ class FormTicket $res = $ticketstat->fetch('', '', $this->track_id); print '
'; - $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ($conf->global->TICKETS_MESSAGE_FORCE_MAIL?'checked':'')); + $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : (getDolGlobalInt('TICKETS_MESSAGE_FORCE_MAIL')?'checked':'')); print ' '; print ''; $texttooltip = $langs->trans("TicketMessageSendEmailHelp", '{s1}'); @@ -1455,7 +1455,7 @@ class FormTicket // Subject print '
'; print ''; - print ''.price($solde, 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; + print ''.price(price2num($solde, 'MT'), 0, $langs, 1, -1, -1, $objecttmp->currency_code).''; print ''; print '
'; print ''; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index c185878e658..03aa1b19d76 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -574,11 +574,11 @@ print '
'; print 'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL = '.(empty($conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)' : $conf->global->MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL)."
"; print '
'; -$examplecsprule = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; +$examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; print 'MAIN_SECURITY_FORCECSPRO = '.(empty($conf->global->MAIN_SECURITY_FORCECSPRO) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCECSPRO).'   ('.$langs->trans("Example").': "'.$examplecsprule.'")
'; print '
'; -$examplecsprule = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; +$examplecsprule = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; print 'MAIN_SECURITY_FORCECSP = '.(empty($conf->global->MAIN_SECURITY_FORCECSP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_FORCECSP).'   ('.$langs->trans("Example").': "'.$examplecsprule.'")
'; print '
'; diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index c2823407ac6..89aa597661c 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -90,7 +90,8 @@ if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnable top_httphead(); if ($action == "importSignature") { - if (!empty($signature) && $signature[0] == "image/png;base64") { + $issignatureok = (!empty($signature) && $signature[0] == "image/png;base64"); + if ($issignatureok) { $signature = $signature[1]; $data = base64_decode($signature); @@ -143,7 +144,6 @@ if ($action == "importSignature") { $pdf->SetCompression(false); } - //$pdf->Open(); $pagecount = $pdf->setSourceFile($sourcefile); // original PDF @@ -155,7 +155,7 @@ if ($action == "importSignature") { $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); $pdf->useTemplate($tppl); } catch (Exception $e) { - dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); $response = $e->getMessage(); $error++; } @@ -207,9 +207,6 @@ if ($action == "importSignature") { } if (!$error) { - $db->commit(); - $response = "success"; - setEventMessages("PropalSigned", null, 'warnings'); if (method_exists($object, 'call_trigger')) { //customer is not a user !?! so could we use same user as validation ? $user = new User($db); @@ -218,13 +215,25 @@ if ($action == "importSignature") { $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); if ($result < 0) { $error++; + $response = "error in trigger ".$object->error; + } else { + $response = "success"; } + } else { + $response = "success"; } } else { - $db->rollback(); $error++; $response = "error sql"; } + + if (!$error) { + $db->commit(); + $response = "success"; + setEventMessages("PropalSigned", null, 'warnings'); + } else { + $db->rollback(); + } } } elseif ($mode == 'contract') { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index b6bd9bb73a8..f85a26697b7 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -75,7 +75,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers if (isModEnabled('commande') && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { $object->fetchObjectLinked(); if (!empty($object->linkedObjectsIds['commande'])) { - setEventMessages($langs->trans("OrderExists"), null, 'warnings'); + if (empty($object->context['closedfromonlinesignature'])) { + $langs->load("orders"); + setEventMessages($langs->trans("OrderExists"), null, 'warnings'); + } return $ret; } else { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index b934f333b1a..d9fe10c8868 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -117,8 +117,8 @@ if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { // Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins: // default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none' // - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; $contentsecuritypolicy = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSPRO'); if (!is_object($hookmanager)) { @@ -149,8 +149,8 @@ if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { // Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins: // default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none' // - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; $contentsecuritypolicy = getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCECSP'); if (!is_object($hookmanager)) { diff --git a/htdocs/includes/tcpdi/tcpdi.php b/htdocs/includes/tcpdi/tcpdi.php index aaa1d70c095..9e87ac2f221 100644 --- a/htdocs/includes/tcpdi/tcpdi.php +++ b/htdocs/includes/tcpdi/tcpdi.php @@ -333,7 +333,7 @@ class TCPDI extends FPDF_TPL { break; } } - } elseif ($tpl['x'] != 0 || $tpl['y'] != 0) { + } elseif (!empty($tpl['x']) || !empty($tpl['y'])) { $tx = -$tpl['x'] * 2; $ty = $tpl['y'] * 2; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 20b73126656..b9469cf55ea 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1474,8 +1474,8 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) // Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins: // default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none' // - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; $contentsecuritypolicy = getDolGlobalString('MAIN_SECURITY_FORCECSPRO'); if (!is_object($hookmanager)) { @@ -1511,8 +1511,8 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) // Pre-existing site that uses too much js code to fix but wants to ensure resources are loaded only over https and disable plugins: // default-src https: 'unsafe-inline' 'unsafe-eval'; object-src 'none' // - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com;"; - // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googlapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src 'self' 'unsafe-inline' 'unsafe-eval' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com;"; + // $contentsecuritypolicy = "frame-ancestors 'self'; img-src * data:; font-src *; default-src *; script-src 'self' 'unsafe-inline' *.paypal.com *.stripe.com *.google.com *.googleapis.com *.google-analytics.com *.googletagmanager.com; style-src 'self' 'unsafe-inline'; connect-src 'self';"; $contentsecuritypolicy = getDolGlobalString('MAIN_SECURITY_FORCECSP'); if (!is_object($hookmanager)) { From 6d21fd1c463f6dbf85e71bc69541e993a3fb89a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Mar 2023 03:20:26 +0100 Subject: [PATCH 211/300] Fix var_dump --- htdocs/admin/notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index a7fd042969b..965a1c8a117 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -265,7 +265,7 @@ print load_fiche_titre($title, '', 'email'); // Load array of available notifications $notificationtrigger = new InterfaceNotification($db); $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents(); -var_dump($listofnotifiedevents); + // Editing global variables not related to a specific theme $constantes = array(); foreach ($listofnotifiedevents as $notifiedevent) { From 2273201707bcdc9e0a3682e1bbdca3da15925cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 2 Mar 2023 09:49:00 +0100 Subject: [PATCH 212/300] fix ADD_UNSPLASH_LOGIN_BACKGROUND --- htdocs/core/tpl/login.tpl.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 4900acc9ec2..e18b2930de0 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -134,10 +134,12 @@ $(document).ready(function () {
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print '
'; - //var_dump($object); - print '