Addicte Posted April 17 Share Posted April 17 (edited) Bonjour, j'ai une erreur très récente lorsque je veux voir les nouvelles factures : Notice: Trying to access array offset on value of type bool Ligne 19 du fichier : override/classes/order/OrderInvoice.php $invoiceNumber = DocumentReferences::getReference($this->id, 'invoice')['reference']; * date: 2024-09-26 11:35:01 * version: 1.7.0 */ public function getInvoiceNumberFormatted($id_lang, $id_shop = null, $oldFormat = false) { $invoiceNumber = DocumentReferences::getReference($this->id, 'invoice')['reference']; if ($oldFormat || $invoiceNumber == NULL) { return parent::getInvoiceNumberFormatted($id_lang, $id_shop); } return $invoiceNumber; } Si quelqu'un a une solution je prends ^^ Edited April 21 by Addicte (see edit history) Link to comment Share on other sites More sharing options...
Eolia Posted April 17 Share Posted April 17 Ben vérifier que DocumentReferences::getReference($this->id, 'invoice') n'est pas null avant de lui demander la reference $invoiceNumber = NULL; if($document = DocumentReferences::getReference($this->id, 'invoice')) { $invoiceNumber = $document['reference']; } if ($oldFormat || $invoiceNumber == NULL) { return parent::getInvoiceNumberFormatted($id_lang, $id_shop); } return $invoiceNumber; Link to comment Share on other sites More sharing options...
Addicte Posted April 17 Author Share Posted April 17 merci, comme je n'avais pas touché cette section, je ne comprenais pas pk du jour au lendemain il plantait ^^. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted April 17 Share Posted April 17 Il semble que le mode débogage soit désormais activé. Essayez de le désactiver. Si le mode débogage est activé dès le départ, il semble que la version de PHP ait été mise à jour. Link to comment Share on other sites More sharing options...
Addicte Posted April 21 Author Share Posted April 21 le problème a été résolu merci :) Link to comment Share on other sites More sharing options...
Mediacom87 Posted April 21 Share Posted April 21 Link to comment Share on other sites More sharing options...
Addicte Posted April 21 Author Share Posted April 21 Merci, je cherchais justement comment faire ^^ Pour la solution : public function getInvoiceNumberFormatted($id_lang, $id_shop = null, $oldFormat = false) { $referenceData = DocumentReferences::getReference($this->id, 'invoice'); if (!is_array($referenceData) || !isset($referenceData['reference']) || $oldFormat || $referenceData['reference'] == null) { return parent::getInvoiceNumberFormatted($id_lang, $id_shop); } return $referenceData['reference']; } ou celle de Eolia : $invoiceNumber = NULL; if($document = DocumentReferences::getReference($this->id, 'invoice')) { $invoiceNumber = $document['reference']; } if ($oldFormat || $invoiceNumber == NULL) { return parent::getInvoiceNumberFormatted($id_lang, $id_shop); } return $invoiceNumber; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now