diff --git a/ChangeLog b/ChangeLog index 25688ef0ccb..3207490752d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,9 @@ The following changes may create regressions for some external modules, but were * The signature for all ->delete() method has been modified to match the modulebuilder template (so first paramis now always $user), except the delete for thirdparty (still accept the id of thirdparty to delete as first parameter). Will probably be modified into another version. * Route for API /thirdparties/gateways has been renamed into /thirdparties/accounts +* The $userdoneid in actioncomm class is deprecated. Please use $userownerid instead. +* The field fk_user_done in actioncomm table is deprecated. Please use fk_user_action instead. +* The AGENDA_ENABLE_DONEBY hidden option is deprecated. ***** ChangeLog for 19.0.1 compared to 19.0.0 ***** diff --git a/SECURITY.md b/SECURITY.md index 0cc37b96ce6..02a015756cf 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -104,3 +104,5 @@ Scope is the web application (backoffice) and the APIs. * SSL/TLS best practices * Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC) * Physical or social engineering attempts or issues that require physical access to a victim’s computer/device +* Vulnerabilities of type XSS exploited by using javascript into a website page (with permission to edit website pages) or by using php code into a website page + using the permission to edit php code are not qualified, except if this allow to get higher privileges (being able to set javascript or php code is the expected behaviour). diff --git a/dev/initdemo/mysqldump_dolibarr_19.0.0.sql b/dev/initdemo/mysqldump_dolibarr_19.0.0.sql index 83d4645572a..78a4358879e 100644 --- a/dev/initdemo/mysqldump_dolibarr_19.0.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_19.0.0.sql @@ -1389,7 +1389,7 @@ CREATE TABLE `llx_c_action_trigger` ( LOCK TABLES `llx_c_action_trigger` WRITE; /*!40000 ALTER TABLE `llx_c_action_trigger` DISABLE KEYS */; -INSERT INTO `llx_c_action_trigger` VALUES (131,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1,NULL),(132,'COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1,NULL),(133,'PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2,NULL),(134,'PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3,NULL),(135,'ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4,NULL),(136,'ORDER_CLOSE','Customer order classify delivered','Executed when a customer order is set delivered','commande',5,NULL),(137,'ORDER_CLASSIFY_BILLED','Customer order classify billed','Executed when a customer order is set to billed','commande',5,NULL),(138,'ORDER_CANCEL','Customer order canceled','Executed when a customer order is canceled','commande',5,NULL),(139,'ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5,NULL),(140,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6,NULL),(141,'BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7,NULL),(142,'BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8,NULL),(143,'BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9,NULL),(144,'BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9,NULL),(145,'ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11,NULL),(146,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12,NULL),(147,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13,NULL),(148,'ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14,NULL),(149,'BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15,NULL),(150,'BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16,NULL),(151,'BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17,NULL),(152,'BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17,NULL),(153,'CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18,NULL),(154,'SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20,NULL),(155,'SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21,NULL),(156,'MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22,NULL),(158,'MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24,NULL),(159,'MEMBER_MODIFY','Member modified','Executed when a member is modified','member',24,NULL),(160,'MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25,NULL),(161,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19,NULL),(162,'FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19,NULL),(163,'FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19,NULL),(164,'FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19,NULL),(165,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19,NULL),(166,'PROJECT_CREATE','Project creation','Executed when a project is created','project',140,NULL),(167,'PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2,NULL),(168,'PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2,NULL),(169,'PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2,NULL),(170,'TASK_CREATE','Task created','Executed when a project task is created','project',35,NULL),(171,'TASK_MODIFY','Task modified','Executed when a project task is modified','project',36,NULL),(172,'TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37,NULL),(173,'BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15,NULL),(174,'PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141,NULL),(175,'PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',142,NULL),(176,'ORDER_SUPPLIER_CREATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11,NULL),(177,'ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',12,NULL),(178,'ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',12,NULL),(179,'ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14,NULL),(180,'PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30,NULL),(181,'PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30,NULL),(182,'PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30,NULL),(183,'EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201,NULL),(185,'EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202,NULL),(186,'EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203,NULL),(187,'EXPENSE_REPORT_PAID','Expense report billed','Executed when an expense report is set as billed','expensereport',204,NULL),(192,'HOLIDAY_CREATE','Leave request created','Executed when a leave request is created','holiday',221,NULL),(193,'HOLIDAY_VALIDATE','Leave request validated','Executed when a leave request is validated','holiday',222,NULL),(194,'HOLIDAY_APPROVE','Leave request approved','Executed when a leave request is approved','holiday',223,NULL),(210,'MEMBER_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23,NULL),(211,'CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18,NULL),(212,'PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10,NULL),(213,'PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10,NULL),(214,'PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10,NULL),(215,'PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10,NULL),(216,'MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24,NULL),(217,'MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24,NULL),(218,'MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24,NULL),(225,'COMPANY_DELETE','Third party deleted','Executed when you delete third party','societe',1,NULL),(226,'PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2,NULL),(227,'ORDER_DELETE','Customer order deleted','Executed when a customer order is deleted','commande',5,NULL),(228,'BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9,NULL),(229,'PROPOSAL_SUPPLIER_DELETE','Price request deleted','Executed when a customer proposal delete','proposal_supplier',10,NULL),(230,'ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14,NULL),(231,'BILL_SUPPLIER_DELETE','Supplier invoice deleted','Executed when a supplier invoice is deleted','invoice_supplier',17,NULL),(232,'CONTRACT_DELETE','Contract deleted','Executed when a contract is deleted','contrat',18,NULL),(233,'FICHINTER_DELETE','Intervention is deleted','Executed when a intervention is deleted','ficheinter',35,NULL),(234,'EXPENSE_REPORT_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204,NULL),(249,'TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161,NULL),(250,'TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163,NULL),(251,'TICKET_ASSIGNED','Ticket assigned','Executed when a ticket is assigned to another user','ticket',164,NULL),(252,'TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',165,NULL),(253,'TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',166,NULL),(254,'TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',167,NULL),(261,'USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300,NULL),(262,'BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650,NULL),(263,'BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651,NULL),(264,'BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652,NULL),(265,'BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653,NULL),(266,'BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654,NULL),(351,'MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660,NULL),(352,'MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661,NULL),(353,'MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662,NULL),(354,'MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663,NULL),(365,'CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50,NULL),(366,'CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51,NULL),(367,'CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52,NULL),(368,'RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500,NULL),(369,'RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502,NULL),(370,'RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504,NULL),(371,'RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506,NULL),(372,'RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510,NULL),(373,'RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512,NULL),(374,'RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514,NULL),(375,'RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516,NULL),(392,'COMPANY_MODIFY','Third party update','Executed when you update third party','societe',1,NULL),(393,'CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51,NULL),(394,'ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13,NULL),(395,'MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27,NULL),(396,'USER_CREATE','User created','Executed when a user is created','user',301,NULL),(397,'USER_MODIFY','User update','Executed when a user is updated','user',302,NULL),(398,'USER_DELETE','User update','Executed when a user is deleted','user',303,NULL),(399,'USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304,NULL),(400,'USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305,NULL),(402,'HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801,NULL),(405,'HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802,NULL),(406,'HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804,NULL),(407,'PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2,NULL),(408,'ORDER_MODIFY','Customer order modified','Executed when a customer order is set modified','commande',5,NULL),(409,'BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7,NULL),(410,'PROPOSAL_SUPPLIER_MODIFY','Price request modified','Executed when a commercial proposal is modified','proposal_supplier',10,NULL),(411,'ORDER_SUPPLIER_MODIFY','Supplier order request modified','Executed when a supplier order is modified','order_supplier',13,NULL),(412,'BILL_SUPPLIER_MODIFY','Supplier invoice modified','Executed when a supplier invoice is modified','invoice_supplier',15,NULL),(413,'CONTRACT_MODIFY','Contract modified','Executed when a contract is modified','contrat',18,NULL),(414,'SHIPPING_MODIFY','Shipping modified','Executed when a shipping is modified','shipping',20,NULL),(415,'FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30,NULL),(417,'EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202,NULL),(455,'PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144,NULL),(511,'SHIPPING_DELETE','Shipping sent is deleted','Executed when a shipping is deleted','shipping',21,NULL),(512,'RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22,NULL),(513,'RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22,NULL),(543,'PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141,NULL),(584,'ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700,NULL),(591,'BILLREC_CREATE','Template invoices created','Executed when a Template invoices is created','facturerec',900,NULL),(592,'BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901,NULL),(593,'BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902,NULL),(594,'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,NULL),(875,'PARTNERSHIP_CREATE','Partnership created','Executed when a partnership is created','partnership',58000,NULL),(876,'PARTNERSHIP_MODIFY','Partnership modified','Executed when a partnership is modified','partnership',58002,NULL),(877,'PARTNERSHIP_SENTBYMAIL','Mails sent from partnership file','Executed when you send email from partnership file','partnership',58004,NULL),(878,'PARTNERSHIP_DELETE','Partnership deleted','Executed when a partnership is deleted','partnership',58006,NULL),(879,'PROJECT_CLOSE','Project closed','Executed when a project is closed','project',145,NULL),(881,'COMPANY_RIB_CREATE','Third party payment information created','Executed when a third party payment information is created','societe',1,NULL),(882,'COMPANY_RIB_MODIFY','Third party payment information updated','Executed when a third party payment information is updated','societe',1,NULL),(883,'COMPANY_RIB_DELETE','Third party payment information deleted','Executed when a third party payment information is deleted','societe',1,NULL),(884,'FICHINTER_CLOSE','Intervention is done','Executed when a intervention is done','ficheinter',36,NULL); +INSERT INTO `llx_c_action_trigger` VALUES (131,'COMPANY_SENTBYMAIL','Mails sent from third party card','Executed when you send email from third party card','societe',1,NULL),(132,'COMPANY_CREATE','Third party created','Executed when a third party is created','societe',1,NULL),(133,'PROPAL_VALIDATE','Customer proposal validated','Executed when a commercial proposal is validated','propal',2,NULL),(134,'PROPAL_SENTBYMAIL','Commercial proposal sent by mail','Executed when a commercial proposal is sent by mail','propal',3,NULL),(135,'ORDER_VALIDATE','Customer order validate','Executed when a customer order is validated','commande',4,NULL),(136,'ORDER_CLOSE','Customer order classify delivered','Executed when a customer order is set delivered','commande',5,NULL),(137,'ORDER_CLASSIFY_BILLED','Customer order classify billed','Executed when a customer order is set to billed','commande',5,NULL),(138,'ORDER_CANCEL','Customer order canceled','Executed when a customer order is canceled','commande',5,NULL),(139,'ORDER_SENTBYMAIL','Customer order sent by mail','Executed when a customer order is sent by mail ','commande',5,NULL),(140,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6,NULL),(141,'BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7,NULL),(142,'BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is canceled','facture',8,NULL),(143,'BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9,NULL),(144,'BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9,NULL),(145,'ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11,NULL),(146,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',12,NULL),(147,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',13,NULL),(148,'ORDER_SUPPLIER_SENTBYMAIL','Supplier order sent by mail','Executed when a supplier order is sent by mail','order_supplier',14,NULL),(149,'BILL_SUPPLIER_VALIDATE','Supplier invoice validated','Executed when a supplier invoice is validated','invoice_supplier',15,NULL),(150,'BILL_SUPPLIER_PAYED','Supplier invoice payed','Executed when a supplier invoice is payed','invoice_supplier',16,NULL),(151,'BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17,NULL),(152,'BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17,NULL),(153,'CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18,NULL),(154,'SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20,NULL),(155,'SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21,NULL),(156,'MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22,NULL),(158,'MEMBER_RESILIATE','Member resiliated','Executed when a member is resiliated','member',24,NULL),(159,'MEMBER_MODIFY','Member modified','Executed when a member is modified','member',24,NULL),(160,'MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25,NULL),(161,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',19,NULL),(162,'FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19,NULL),(163,'FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19,NULL),(164,'FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19,NULL),(165,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19,NULL),(166,'PROJECT_CREATE','Project creation','Executed when a project is created','project',140,NULL),(167,'PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2,NULL),(168,'PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2,NULL),(169,'PROPAL_CLASSIFY_BILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2,NULL),(170,'TASK_CREATE','Task created','Executed when a project task is created','project',35,NULL),(171,'TASK_MODIFY','Task modified','Executed when a project task is modified','project',36,NULL),(172,'TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37,NULL),(173,'BILL_SUPPLIER_UNVALIDATE','Supplier invoice unvalidated','Executed when a supplier invoice status is set back to draft','invoice_supplier',15,NULL),(174,'PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141,NULL),(175,'PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',142,NULL),(176,'ORDER_SUPPLIER_CREATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',11,NULL),(177,'ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',12,NULL),(178,'ORDER_SUPPLIER_RECEIVE','Supplier order request received','Executed when a supplier order is received','order_supplier',12,NULL),(179,'ORDER_SUPPLIER_CLASSIFY_BILLED','Supplier order set billed','Executed when a supplier order is set as billed','order_supplier',14,NULL),(180,'PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30,NULL),(181,'PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30,NULL),(182,'PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30,NULL),(183,'EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expensereport',201,NULL),(185,'EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202,NULL),(186,'EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203,NULL),(187,'EXPENSE_REPORT_PAID','Expense report billed','Executed when an expense report is set as billed','expensereport',204,NULL),(192,'HOLIDAY_CREATE','Leave request created','Executed when a leave request is created','holiday',221,NULL),(193,'HOLIDAY_VALIDATE','Leave request validated','Executed when a leave request is validated','holiday',222,NULL),(194,'HOLIDAY_APPROVE','Leave request approved','Executed when a leave request is approved','holiday',223,NULL),(210,'MEMBER_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23,NULL),(211,'CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18,NULL),(212,'PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10,NULL),(213,'PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10,NULL),(214,'PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10,NULL),(215,'PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10,NULL),(216,'MEMBER_SUBSCRIPTION_CREATE','Member subscribtion recorded','Executed when a member subscribtion is deleted','member',24,NULL),(217,'MEMBER_SUBSCRIPTION_MODIFY','Member subscribtion modified','Executed when a member subscribtion is modified','member',24,NULL),(218,'MEMBER_SUBSCRIPTION_DELETE','Member subscribtion deleted','Executed when a member subscribtion is deleted','member',24,NULL),(225,'COMPANY_DELETE','Third party deleted','Executed when you delete third party','societe',1,NULL),(226,'PROPAL_DELETE','Customer proposal deleted','Executed when a customer proposal is deleted','propal',2,NULL),(227,'ORDER_DELETE','Customer order deleted','Executed when a customer order is deleted','commande',5,NULL),(228,'BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9,NULL),(229,'PROPOSAL_SUPPLIER_DELETE','Price request deleted','Executed when a customer proposal delete','proposal_supplier',10,NULL),(230,'ORDER_SUPPLIER_DELETE','Supplier order deleted','Executed when a supplier order is deleted','order_supplier',14,NULL),(231,'BILL_SUPPLIER_DELETE','Supplier invoice deleted','Executed when a supplier invoice is deleted','invoice_supplier',17,NULL),(232,'CONTRACT_DELETE','Contract deleted','Executed when a contract is deleted','contrat',18,NULL),(233,'FICHINTER_DELETE','Intervention is deleted','Executed when a intervention is deleted','ficheinter',35,NULL),(234,'EXPENSE_REPORT_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204,NULL),(249,'TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161,NULL),(250,'TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163,NULL),(251,'TICKET_ASSIGNED','Ticket assigned','Executed when a ticket is assigned to another user','ticket',164,NULL),(252,'TICKET_CLOSE','Ticket closed','Executed when a ticket is closed','ticket',165,NULL),(253,'TICKET_SENTBYMAIL','Ticket message sent by email','Executed when a message is sent from the ticket record','ticket',166,NULL),(254,'TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',167,NULL),(261,'USER_SENTBYMAIL','Email sent','Executed when an email is sent from user card','user',300,NULL),(262,'BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650,NULL),(263,'BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651,NULL),(264,'BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652,NULL),(265,'BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653,NULL),(266,'BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654,NULL),(351,'MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660,NULL),(352,'MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661,NULL),(353,'MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662,NULL),(354,'MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663,NULL),(365,'CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50,NULL),(366,'CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51,NULL),(367,'CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52,NULL),(368,'RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500,NULL),(369,'RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502,NULL),(370,'RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504,NULL),(371,'RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506,NULL),(372,'RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510,NULL),(373,'RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512,NULL),(374,'RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514,NULL),(375,'RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516,NULL),(392,'COMPANY_MODIFY','Third party update','Executed when you update third party','societe',1,NULL),(393,'CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51,NULL),(394,'ORDER_SUPPLIER_CANCEL','Supplier order request canceled','Executed when a supplier order is canceled','order_supplier',13,NULL),(395,'MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27,NULL),(396,'USER_CREATE','User created','Executed when a user is created','user',301,NULL),(397,'USER_MODIFY','User update','Executed when a user is updated','user',302,NULL),(398,'USER_DELETE','User update','Executed when a user is deleted','user',303,NULL),(399,'USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304,NULL),(400,'USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305,NULL),(402,'HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801,NULL),(405,'HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802,NULL),(406,'HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804,NULL),(407,'PROPAL_MODIFY','Customer proposal modified','Executed when a customer proposal is modified','propal',2,NULL),(408,'ORDER_MODIFY','Customer order modified','Executed when a customer order is set modified','commande',5,NULL),(409,'BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7,NULL),(410,'PROPOSAL_SUPPLIER_MODIFY','Price request modified','Executed when a commercial proposal is modified','proposal_supplier',10,NULL),(411,'ORDER_SUPPLIER_MODIFY','Supplier order request modified','Executed when a supplier order is modified','order_supplier',13,NULL),(412,'BILL_SUPPLIER_MODIFY','Supplier invoice modified','Executed when a supplier invoice is modified','invoice_supplier',15,NULL),(413,'CONTRACT_MODIFY','Contract modified','Executed when a contract is modified','contrat',18,NULL),(414,'SHIPPING_MODIFY','Shipping modified','Executed when a shipping is modified','shipping',20,NULL),(415,'FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30,NULL),(417,'EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202,NULL),(455,'PROJECT_SENTBYMAIL','Project sent by mail','Executed when a project is sent by email','project',144,NULL),(511,'SHIPPING_DELETE','Shipping sent is deleted','Executed when a shipping is deleted','shipping',21,NULL),(512,'RECEPTION_VALIDATE','Reception validated','Executed when a reception is validated','reception',22,NULL),(513,'RECEPTION_SENTBYMAIL','Reception sent by mail','Executed when a reception is sent by mail','reception',22,NULL),(543,'PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141,NULL),(584,'ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700,NULL),(591,'BILLREC_CREATE','Template invoices created','Executed when a Template invoices is created','facturerec',900,NULL),(592,'BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901,NULL),(593,'BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902,NULL),(594,'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,NULL),(875,'PARTNERSHIP_CREATE','Partnership created','Executed when a partnership is created','partnership',58000,NULL),(876,'PARTNERSHIP_MODIFY','Partnership modified','Executed when a partnership is modified','partnership',58002,NULL),(877,'PARTNERSHIP_SENTBYMAIL','Mails sent from partnership file','Executed when you send email from partnership file','partnership',58004,NULL),(878,'PARTNERSHIP_DELETE','Partnership deleted','Executed when a partnership is deleted','partnership',58006,NULL),(879,'PROJECT_CLOSE','Project closed','Executed when a project is closed','project',145,NULL),(881,'COMPANY_RIB_CREATE','Third party payment information created','Executed when a third party payment information is created','societe',1,NULL),(882,'COMPANY_RIB_MODIFY','Third party payment information updated','Executed when a third party payment information is updated','societe',1,NULL),(883,'COMPANY_RIB_DELETE','Third party payment information deleted','Executed when a third party payment information is deleted','societe',1,NULL),(884,'FICHINTER_CLOSE','Intervention is done','Executed when a intervention is done','ficheinter',36,NULL); /*!40000 ALTER TABLE `llx_c_action_trigger` ENABLE KEYS */; UNLOCK TABLES; diff --git a/dev/tools/codespell/codespell-ignore.txt b/dev/tools/codespell/codespell-ignore.txt index c71e990a467..0c84807010b 100644 --- a/dev/tools/codespell/codespell-ignore.txt +++ b/dev/tools/codespell/codespell-ignore.txt @@ -57,3 +57,4 @@ dur fonction espace methode +datee diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index 2c0fb95a96f..80e4f25e296 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -79,6 +79,7 @@ $object->periode = $dateperiod; $return .= '
'.$langs->trans("Payement").' : '.$this->type_payment.''; $sortfield = "datea"; + $sql = "SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; $sql .= " '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " , datee = ".(!empty($obj->datee) ? "'".$this->db->escape($obj->datee)."'" : "null"); $sql .= " AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; @@ -325,6 +326,7 @@ $usercanread = (($user->hasRight('stock', 'mouvement', 'lire'))); * The hook contaxt thirdpartycard has been renamed thirdpartycontact * The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere. - New: Add proposals into referer page of thirdparty. +NEW: ModuleBuilder: Checkin comments begin and end before each actions for /F "tokens=2 delims=," %%i in ('tasklist /FI "IMAGENAME eq php.exe" /FO CSV /NH') do ( foreach ($TWeek as $week_number) { function checkES($IentOfi, $InumCta) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 68fc0c015e7..be0a4d597ba 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,12 +9,12 @@ */ return [ // # Issue statistics: - // PhanPluginSuspiciousParamPosition : 45+ occurrences + // PhanPluginDuplicateIfStatements : 30+ occurrences // PhanParamSignatureMismatch : 25+ occurrences + // PhanPluginSuspiciousParamPosition : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences - // PhanTypeInvalidUnaryOperandNumeric : 8 occurrences // PhanRedefineFunctionInternal : 6 occurrences // PhanPluginUnsafeEval : 5 occurrences // PhanParamSuspiciousOrder : 4 occurrences @@ -23,7 +23,6 @@ return [ // PhanUndeclaredFunctionInCallable : 4 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanAccessPropertyStaticAsNonStatic : 1 occurrence - // PhanNoopArray : 1 occurrence // PhanNoopArrayAccess : 1 occurrence // PhanNoopStringLiteral : 1 occurrence // PhanPluginAlwaysReturnFunction : 1 occurrence @@ -33,42 +32,28 @@ return [ 'htdocs/adherents/stats/geo.php' => ['PhanTypeArraySuspiciousNull'], 'htdocs/adherents/type.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/admin/receiptprinter.php' => ['PhanRedefineFunctionInternal'], - 'htdocs/admin/translation.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/api/class/api_documents.class.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/barcode/printsheet.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/categories/class/api_categories.class.php' => ['PhanAccessMethodProtected'], 'htdocs/categories/viewcat.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/collab/index.php' => ['PhanParamTooMany'], - 'htdocs/comm/action/index.php' => ['PhanPluginSuspiciousParamPosition', 'PhanTypeArraySuspiciousNull', 'PhanTypeInvalidUnaryOperandNumeric'], + 'htdocs/comm/action/index.php' => ['PhanTypeArraySuspiciousNull'], 'htdocs/comm/mailing/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/comm/mailing/cibles.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/comm/mailing/info.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/accounting-files.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/compta/bank/various_payment/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp'], - 'htdocs/compta/facture/agenda-rec.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/prelevement/class/bonprelevement.class.php' => ['PhanParamTooMany'], 'htdocs/compta/prelevement/create.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/sociales/class/paymentsocialcontribution.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/compta/sociales/document.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/sociales/info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/compta/sociales/note.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/compta/tva/document.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/actions_massactions.inc.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/class/commondocgenerator.class.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/core/class/commonobject.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/class/evalmath.class.php' => ['PhanPluginUnsafeEval'], 'htdocs/core/class/html.form.class.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/core/class/html.formmail.class.php' => ['PhanNoopArray'], + 'htdocs/core/class/html.formprojet.class.php' => ['PhanTypeMismatchReturnNullable'], 'htdocs/core/class/rssparser.class.php' => ['PhanUndeclaredFunctionInCallable'], 'htdocs/core/db/mysqli.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/db/pgsql.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/db/sqlite3.class.php' => ['PhanParamSignatureMismatch'], - 'htdocs/core/filemanagerdol/connectors/php/connector.lib.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/get_info.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/core/lib/functions.lib.php' => ['PhanParamTooMany', 'PhanPluginAlwaysReturnFunction', 'PhanPluginUnsafeEval', 'PhanRedefineFunctionInternal'], @@ -78,33 +63,25 @@ return [ 'htdocs/core/menus/standard/eldy_menu.php' => ['PhanParamSuspiciousOrder'], 'htdocs/core/menus/standard/empty.php' => ['PhanParamSuspiciousOrder'], 'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanParamSignatureMismatch'], - 'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/core/modules/member/doc/pdf_standard.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/core/modules/movement/doc/pdf_standard.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeArraySuspiciousNull'], 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanParamSignatureMismatch', 'PhanParamSuspiciousOrder'], 'htdocs/core/modules/syslog/mod_syslog_syslog.php' => ['PhanParamSignatureMismatch'], + 'htdocs/core/triggers/interface_80_modStripe_Stripe.class.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchPropertyProbablyReal'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], - 'htdocs/expensereport/class/paymentexpensereport.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginSuspiciousParamOrder'], - 'htdocs/fourn/facture/card-rec.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/intracommreport/list.php' => ['PhanAccessPropertyStaticAsNonStatic'], - 'htdocs/loan/card.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/loan/class/paymentloan.class.php' => ['PhanTypeInvalidUnaryOperandNumeric'], - 'htdocs/loan/document.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/info.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/note.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/payment/card.php' => ['PhanPluginSuspiciousParamPosition'], - 'htdocs/loan/schedule.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/mrp/class/mo.class.php' => ['PhanParamSignatureMismatch'], 'htdocs/product/admin/product_tools.php' => ['PhanNoopStringLiteral'], - 'htdocs/product/card.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/projet/tasks/list.php' => ['PhanTypeArraySuspiciousNull'], - 'htdocs/public/bookcal/index.php' => ['PhanTypeInvalidUnaryOperandNumeric'], 'htdocs/public/opensurvey/index.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/public/payment/paymentok.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/public/recruitment/index.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/societe/paymentmodes.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchPropertyProbablyReal'], 'htdocs/societe/class/companybankaccount.class.php' => ['PhanParamSignatureMismatch'], + 'htdocs/stripe/admin/stripe.php' => ['PhanDeprecatedFunction'], 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/takepos/invoice.php' => ['PhanPluginSuspiciousParamPosition'], 'htdocs/user/class/user.class.php' => ['PhanParamSignatureMismatch'], diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 5c021217ac4..50787253740 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -408,7 +408,7 @@ return [ 'suppress_issue_types' => [ // Dolibarr uses a lot of internal deprecated stuff, not reporting 'PhanDeprecatedProperty', - 'PhanDeprecatedFunction', + // 'PhanDeprecatedFunction', //'PhanCompatibleNegativeStringOffset', // 'PhanPluginDuplicateExpressionAssignment', // Nulls are likely mostly false positives @@ -446,18 +446,18 @@ return [ 'PhanRedefinedClassReference', // 'PhanPluginNoCommentOnClass', // 'PhanPluginNotFullyQualifiedGlobalConstant', - 'PhanTypeMismatchDefault', + // 'PhanTypeMismatchDefault', // 'PhanPluginPHPDocHashComment', 'PhanPluginShortArrayList', 'PhanPluginUnknownArrayPropertyType', 'PhanTypeInvalidDimOffset', // 'PhanPluginNoCommentOnProtectedProperty', // 'PhanPluginDescriptionlessCommentOnPublicMethod', - 'PhanPluginUnknownClosureParamType', + // 'PhanPluginUnknownClosureParamType', 'PhanPluginUnknownClosureReturnType', // 'PhanPluginNoCommentOnProtectedMethod', // 'PhanTypeArraySuspicious', - 'PhanTypeMismatchPropertyProbablyReal', + // 'PhanTypeMismatchPropertyProbablyReal', // 'PhanPluginNoCommentOnPrivateMethod', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeInvalidLeftOperandOfAdd', @@ -482,7 +482,7 @@ return [ 'PhanTypeInvalidPropertyName', 'PhanPluginDuplicateCatchStatementBody', 'PhanPluginUndeclaredVariableIsset', - 'PhanTypeInvalidUnaryOperandIncOrDec', + // 'PhanTypeInvalidUnaryOperandIncOrDec', // 'PhanPluginDescriptionlessCommentOnClass', 'PhanPluginEmptyStatementIf', 'PhanPluginInlineHTMLTrailing', @@ -495,11 +495,11 @@ return [ 'PhanTypeInvalidLeftOperandOfBitwiseOp', // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', - 'PhanPluginPrintfIncompatibleArgumentTypeWeak', + // 'PhanPluginPrintfIncompatibleArgumentTypeWeak', 'PhanUndeclaredVariableAssignOp', 'PhanTypeExpectedObjectOrClassName', 'PhanEmptyFQSENInClasslike', - 'PhanTypeMismatchArgumentInternalReal', + // 'PhanTypeMismatchArgumentInternalReal', // 'PhanUnextractableAnnotationElementName', // 'PhanCommentParamWithoutRealParam', // 'PhanRedefinedExtendedClass', @@ -511,14 +511,14 @@ return [ 'PhanTypeSuspiciousNonTraversableForeach', 'PhanEmptyForeach', 'PhanTypeInvalidRightOperandOfBitwiseOp', - 'PhanPluginDuplicateConditionalUnnecessary', + // 'PhanPluginDuplicateConditionalUnnecessary', // 'PhanTraitParentReference', 'PhanPluginBothLiteralsBinaryOp', // 'PhanTypeMismatchDeclaredParam', // 'PhanCommentDuplicateMagicMethod', // 'PhanParamSpecial1', 'PhanPluginInlineHTMLLeading', - 'PhanPluginUseReturnValueInternalKnown', + // 'PhanPluginUseReturnValueInternalKnown', // 'PhanRedefinedInheritedInterface', // 'PhanTypeComparisonToArray', 'PhanTypeConversionFromArray', @@ -526,11 +526,11 @@ return [ // 'PhanTypeMismatchArgumentInternalProbablyReal', 'PhanTypeMismatchBitwiseBinaryOperands', 'PhanTypeMismatchDimEmpty', - 'PhanTypeSuspiciousEcho', - 'PhanNoopBinaryOperator', + // 'PhanTypeSuspiciousEcho', + // 'PhanNoopBinaryOperator', // 'PhanTypeInvalidBitwiseBinaryOperator', // 'PhanPluginDescriptionlessCommentOnFunction', - 'PhanPluginPHPDocInWrongComment', + // 'PhanPluginPHPDocInWrongComment', 'PhanRedefineClassInternal', // 'PhanTypeInvalidThrowsIsInterface', // 'PhanPluginRedundantAssignmentInLoop', @@ -549,15 +549,15 @@ return [ // 'PhanSyntaxReturnValueInVoid', // 'PhanTypeInstantiateTraitStaticOrSelf', // 'PhanUndeclaredInvokeInCallable', - 'PhanNoopProperty', - 'PhanNoopVariable', + // 'PhanNoopProperty', + // 'PhanNoopVariable', // 'PhanPluginPrintfUnusedArgument', // 'PhanSyntaxReturnExpectedValue', // 'PhanAccessClassInternal', // 'PhanCompatibleAccessMethodOnTraitDefinition', // 'PhanNoopSwitchCases', // 'PhanNoopTernary', - 'PhanNoopUnaryOperator', + // 'PhanNoopUnaryOperator', // 'PhanParamNameIndicatingUnusedInClosure', // 'PhanParamSignatureRealMismatchTooFewParametersInternal', // 'PhanPluginEmptyStatementSwitch', @@ -591,7 +591,7 @@ return [ // 'PhanPluginPossiblyStaticProtectedMethod', 'PhanTypeMismatchReturn', // 'PhanPluginMoreSpecificActualReturnType', - 'PhanTypeMismatchReturnProbablyReal', + // 'PhanTypeMismatchReturnProbablyReal', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', // 'PhanPluginUnreachableCode', @@ -601,10 +601,10 @@ return [ 'PhanUndeclaredMethod', 'PhanTypeMismatchArgumentProbablyReal', 'PhanPluginDuplicateExpressionAssignmentOperation', // Suggestions for optimisation - 'PhanTypeMismatchPropertyDefault', + // 'PhanTypeMismatchPropertyDefault', // 'PhanPluginAlwaysReturnMethod', // 'PhanPluginMissingReturnMethod', - 'PhanUndeclaredTypeReturnType', + // 'PhanUndeclaredTypeReturnType', 'PhanUndeclaredClassProperty', 'PhanTypeArraySuspiciousNullable', // 'PhanPluginInconsistentReturnMethod', diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index b9e92619b06..91b2894cd26 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -368,6 +368,7 @@ return [ 'PhanPluginDuplicateConditionalTernaryDuplication', // 2750+ occurrences 'PhanPluginDuplicateConditionalNullCoalescing', // Not essential - 990+ occurrences 'PhanPluginRedundantAssignmentInGlobalScope', // Not essential, a lot of false warning + 'PhanPluginDuplicateCatchStatementBody', // Requires PHP7.1 - 50+ occurrences ], // You can put relative paths to internal stubs in this config option. // Phan will continue using its detailed type annotations, diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 20d561ed752..567af5d4d10 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -67,7 +67,7 @@ if (!$user->hasRight('accounting', 'chartofaccount')) { } // Load variable for pagination -$limit = GETPOSTINT('limit', $conf->liste_limit); +$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index dbe02a3ff02..e14477b9158 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -191,10 +191,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd', 'alpha')) { + $newid = 0; if ($tabrowid[$id]) { // Get free id for insert - $newid = 0; - $sql = "SELECT MAX(".$db->sanitize($tabrowid[$id]).") newid FROM ".$db->sanitize($tabname[$id]); + $sql = "SELECT MAX(".$db->sanitize($tabrowid[$id]).") as newid FROM ".$db->sanitize($tabname[$id]); $result = $db->query($sql); if ($result) { $obj = $db->fetch_object($result); diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 18d793fc43e..8204c4ba6a2 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -201,9 +201,10 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd', 'alpha')) { + $newid = 0; + if ($tabrowid[$id]) { // Get free id for insert - $newid = 0; $sql = "SELECT MAX(".$db->sanitize($tabrowid[$id]).") newid FROM ".$db->sanitize($tabname[$id]); $result = $db->query($sql); if ($result) { @@ -309,11 +310,7 @@ if (GETPOST('actioncancel', 'alpha')) { } if ($action == 'confirm_delete' && $confirm == 'yes') { // delete - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $rowidcol = "rowid"; $sql = "DELETE from ".$db->sanitize($tabname[$id])." WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -330,11 +327,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { // delete // activate if ($action == $acts[0]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 1 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -342,19 +335,17 @@ if ($action == $acts[0]) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 1 WHERE code = '".$db->escape($code)."'"; } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + if ($sql) { + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } // disable if ($action == $acts[1]) { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 0 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -362,19 +353,17 @@ if ($action == $acts[1]) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET active = 0 WHERE code = '".$db->escape($code)."'"; } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + if ($sql) { + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } // favorite if ($action == 'activate_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 1 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -382,19 +371,17 @@ if ($action == 'activate_favorite') { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 1 WHERE code = '".$db->escape($code)."'"; } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + if ($sql) { + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } // disable favorite if ($action == 'disable_favorite') { - if ($tabrowid[$id]) { - $rowidcol = $tabrowid[$id]; - } else { - $rowidcol = "rowid"; - } + $rowidcol = "rowid"; if ($rowid) { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 0 WHERE ".$db->sanitize($rowidcol)." = ".((int) $rowid); @@ -402,9 +389,11 @@ if ($action == 'disable_favorite') { $sql = "UPDATE ".$db->sanitize($tabname[$id])." SET favorite = 0 WHERE code = '".$db->escape($code)."'"; } - $result = $db->query($sql); - if (!$result) { - dol_print_error($db); + if ($sql) { + $result = $db->query($sql); + if (!$result) { + dol_print_error($db); + } } } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index bbf41060a4c..7ac6bc27cea 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -484,7 +484,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; break; - } elseif (isset($object->date_validation) || $object->date_validation != '') { + } elseif (isset($object->date_validation) && $object->date_validation != '') { setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors'); $error++; break; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 40b7599040c..bb549a3bc6d 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -447,7 +447,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; break; - } elseif (isset($object->date_validation) || $object->date_validation != '') { + } elseif (isset($object->date_validation) && $object->date_validation != '') { setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors'); $error++; break; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6d47b7fe700..6a261a146cd 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1514,7 +1514,7 @@ class BookKeeping extends CommonObject * @param string $field Field * @param string $value Value * @param string $mode Mode ('' or _tmp') - * @return number Return integer <0 if KO, >0 if OK + * @return int Return integer <0 if KO, >0 if OK */ public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '') { diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1937924df3b..b5f319bb70c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -316,12 +316,12 @@ class Adherent extends CommonObject /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), - 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => 1, 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 12, 'index' => 1), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'default' => '1', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 12, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25), 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'showoncombobox' => 1), @@ -760,13 +760,13 @@ class Adherent extends CommonObject $this->lastname = trim($this->lastname) ? trim($this->lastname) : trim($this->lastname); $this->firstname = trim($this->firstname) ? trim($this->firstname) : trim($this->firstname); $this->gender = trim($this->gender); - $this->address = ($this->address ? $this->address : $this->address); - $this->zip = ($this->zip ? $this->zip : $this->zip); - $this->town = ($this->town ? $this->town : $this->town); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); - $this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id); - $this->note_public = ($this->note_public ? $this->note_public : $this->note_public); - $this->note_private = ($this->note_private ? $this->note_private : $this->note_private); + // $this->address = ($this->address ? $this->address : $this->address); + // $this->zip = ($this->zip ? $this->zip : $this->zip); + // $this->town = ($this->town ? $this->town : $this->town); + // $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + // $this->state_id = ($this->state_id > 0 ? $this->state_id : $this->state_id); + // $this->note_public = ($this->note_public ? $this->note_public : $this->note_public); + // $this->note_private = ($this->note_private ? $this->note_private : $this->note_private); $this->url = $this->url ? clean_url($this->url, 0) : ''; $this->setUpperOrLowerCase(); // Check parameters diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 40aa0ab512a..c268ac3ab6e 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -104,7 +104,7 @@ class Subscription extends CommonObject public $fk_bank; /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index edfa8adbb2f..f94cc476321 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -120,12 +120,13 @@ print '
'; print ''; // Login -print ''; +print ''; // If there is a link to the unencrypted password, we show the value in database here so we can compare because it is shown nowhere else +// This is for very old situation. Password are now encrypted and $object->pass is empty. if (getDolGlobalString('LDAP_MEMBER_FIELD_PASSWORD')) { print ''; - print ''; + print ''; print "\n"; } diff --git a/htdocs/adherents/vcard.php b/htdocs/adherents/vcard.php index cd39e578045..56f82a7665d 100644 --- a/htdocs/adherents/vcard.php +++ b/htdocs/adherents/vcard.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2020-2021 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,6 +99,7 @@ $v->setPhoneNumber($object->fax, "TYPE=WORK;FAX"); $country = $object->country_code ? $object->country : ''; $v->setAddress("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK;POSTAL"); +// @phan-suppress-next-line PhanDeprecatedFunction (setLabel is the old method, new is setAddress) $v->setLabel("", "", $object->address, $object->town, $object->state, $object->zip, $country, "TYPE=WORK"); $v->setEmail($object->email); diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 983a93a9c02..f6e6361fa34 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -102,41 +102,6 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/eventorganization/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele; - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated $tmpobjectkey = GETPOST('object'); diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 5dc257a55d2..d11c3adf4ca 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2019 Christophe Battarel + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doleditor.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'fckeditor')); +$langs->loadLangs(array('admin', 'fckeditor', 'errors')); $action = GETPOST('action', 'aZ09'); // Possible modes are: @@ -221,12 +222,12 @@ if (empty($conf->use_javascript_ajax)) { if ($mode != 'Full_inline') { $uselocalbrowser = true; $readonly = ($mode == 'dolibarr_readonly' ? 1 : 0); - $editor = new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST : 'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly); + $editor = new DolEditor('formtestfield', getDolGlobalString('FCKEDITOR_TEST', 'Test'), '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly); $editor->Create(); } else { // CKEditor inline enabled with the contenteditable="true" print '
'; - print $conf->global->FCKEDITOR_TEST; + print getDolGlobalString('FCKEDITOR_TEST'); print '
'; } print $form->buttonsSaveCancel("Save", '', null, 0, 'reposition'); diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index df883799b2b..fecafa518f5 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -66,6 +66,11 @@ $setupnotempty = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +$moduledir = 'hrm'; +$myTmpObjects = array(); +// TODO Scan list of objects to fill this array +$myTmpObjects['evaluation'] = array('label' => 'Evaluation', 'includerefgeneration' => 1, 'includedocgeneration' => 0); + /* * Actions @@ -109,38 +114,41 @@ if ($action == 'update') { } } elseif ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); + if (array_key_exists($tmpobjectkey, $myTmpObjects)) { + $nameofclass = ucfirst($tmpobjectkey); + $tmpobject = new $nameofclass($db); + $tmpobject->initAsSpecimen(); - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele; - break; + // Search template files + $file = ''; + $classname = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir."core/modules/hrm/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); + if (file_exists($file)) { + $classname = "pdf_".$modele; + break; + } } - } - if ($classname !== '') { - require_once $file; + if ($classname !== '') { + require_once $file; - $module = new $classname($db); + $module = new $classname($db); - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; + if ($module->write_file($tmpobject, $langs) > 0) { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); + return; + } else { + setEventMessages($module->error, null, 'errors'); + dol_syslog($module->error, LOG_ERR); + } } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated @@ -209,9 +217,6 @@ print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup'); $head = hrmAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "hrm"); -$moduledir = 'hrm'; -$myTmpObjects = array(); -$myTmpObjects['evaluation'] = array('label' => 'Evaluation', 'includerefgeneration' => 1, 'includedocgeneration' => 0); foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey != $type) { @@ -291,6 +296,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $nameofclass = ucfirst($myTmpObjectKey); $mytmpinstance = new $nameofclass($db); + '@phan-var-force Evaluation $mytmpinstance'; $mytmpinstance->initAsSpecimen(); // Info diff --git a/htdocs/admin/invoice.php b/htdocs/admin/invoice.php index a2f0282ba9f..fa0e810f33b 100644 --- a/htdocs/admin/invoice.php +++ b/htdocs/admin/invoice.php @@ -617,13 +617,14 @@ if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf print '
'; print ''; print ''; + print ''; print '
'; print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.dol_escape_htmltag($object->login).' 
'.$langs->trans("LDAPFieldPasswordNotCrypted").''.$object->pass.''.dol_escape_htmltag($object->pass).'
'; print ''; print ''; print ''; - print ''; + print ''; print "\n"; $listtype = array( @@ -659,6 +660,7 @@ print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice print ''; print ''; +print ''; print '
'; print '
'.$langs->trans("Type").''.$langs->trans("Name").'
'; @@ -667,17 +669,16 @@ print ''; print ''; -print ''; +print ''; print "\n"; print ''; print ""; print ""; print "
'; print ''; print $langs->trans("PaymentMode").'
".$langs->trans("SuggestPaymentByRIBOnAccount").""; if (isModEnabled('bank')) { - $sql = "SELECT rowid, label"; + $sql = "SELECT rowid, label, clos"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; - $sql .= " WHERE clos = 0"; - $sql .= " AND courant = 1"; + $sql .= " WHERE courant = 1"; $sql .= " AND entity IN (".getEntity('bank_account').")"; $resql = $db->query($sql); if ($resql) { @@ -687,15 +688,19 @@ if (isModEnabled('bank')) { print '"; + print ajax_combobox("rib"); } else { print ''.$langs->trans("NoActiveBankAccountDefined").''; } @@ -735,6 +740,8 @@ if ($resql) { } } print ""; +print ajax_combobox("chq", array(), 0, 0, 'resolve', -2); + print "
"; print ''; @@ -757,12 +764,13 @@ print "\n"; print ''; print ''; print ''; +print ''; print ''; print $langs->trans("ForceInvoiceDate"); print ''; print $form->selectyesno("forcedate", getDolGlobalInt('FAC_FORCE_DATE_VALIDATION', 0), 1); print ''; -print ''; +print ''; print "\n"; print ''; @@ -777,6 +785,7 @@ $htmltext .= ''; print '
'; print ''; print ''; +print ''; print ''; print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; $variablename = 'INVOICE_FREE_TEXT'; @@ -788,7 +797,7 @@ if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { print $doleditor->Create(); } print ''; -print ''; +print ''; print "\n"; print '
'; @@ -796,12 +805,13 @@ print ''; print '
'; print ''; print ''; +print ''; print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; print ''; print ''; -print ''; +print ''; print "\n"; print '
'; diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index 1f79f506c89..731f703f1cd 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -1,7 +1,7 @@ - * Copyright (C) 2021 SuperAdmin - * Copyright (C) 2024 MDW +/* Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +31,7 @@ global $langs, $user; // Libraries require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/lib/knowledgemanagement.lib.php"; +require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/class/knowledgerecord.class.php"; // Translations $langs->loadLangs(array("admin", "knowledgemanagement")); @@ -46,7 +47,7 @@ $scandir = GETPOST('scan_dir', 'alpha'); $type = 'knowledgemanagement'; $arrayofparameters = array( - 'KNOWLEDGEMANAGEMENT_MYPARAM1' => array('type' => 'string', 'css' => 'minwidth500' ,'enabled' => 0), + //'KNOWLEDGEMANAGEMENT_MYPARAM1' => array('type' => 'string', 'css' => 'minwidth500' ,'enabled' => 0), //'KNOWLEDGEMANAGEMENT_MYPARAM2'=>array('type'=>'textarea','enabled'=>1), //'KNOWLEDGEMANAGEMENT_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), //'KNOWLEDGEMANAGEMENT_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1), @@ -62,6 +63,11 @@ if (!$user->admin) { accessforbidden(); } +$moduledir = 'knowledgemanagement'; +$myTmpObjects = array(); +// TODO Scan list of objects to fill this array +$myTmpObjects['knowledgemanagement'] = array('label' => 'KnowledgeManagement', 'includerefgeneration' => 1, 'includedocgeneration' => 0, 'class' => 'KnowledgeRecord'); + /* * Actions @@ -71,10 +77,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { $maskconst = GETPOST('maskconst', 'aZ09'); - $maskorder = GETPOST('maskorder', 'alpha'); + $maskdata = GETPOST('maskKnowledgeRecord', 'alpha'); if ($maskconst && preg_match('/_MASK$/', $maskconst)) { - $res = dolibarr_set_const($db, $maskconst, $maskorder, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, $maskconst, $maskdata, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } @@ -87,38 +93,41 @@ if ($action == 'updateMask') { } } elseif ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); + if (array_key_exists($tmpobjectkey, $myTmpObjects)) { + $className = $myTmpObjects[$tmpobjectkey]['class']; + $tmpobject = new $className($db); + $tmpobject->initAsSpecimen(); - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele; - break; + // Search template files + $file = ''; + $className = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); + if (file_exists($file)) { + $className = "pdf_".$modele; + break; + } } - } - if ($classname !== '') { - require_once $file; + if ($className !== '') { + require_once $file; - $module = new $classname($db); + $module = new $className($db); - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; + if ($module->write_file($tmpobject, $langs) > 0) { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); + return; + } else { + setEventMessages($module->error, null, 'errors'); + dol_syslog($module->error, LOG_ERR); + } } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated @@ -332,16 +341,8 @@ if ($action == 'edit') { } -$moduledir = 'knowledgemanagement'; -$myTmpObjects = array(); -$myTmpObjects['MyObject'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); - - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } - if ($myTmpObjectArray['includerefgeneration']) { + if (!empty($myTmpObjectArray['includerefgeneration'])) { /* * Orders Numbering model */ @@ -367,7 +368,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $handle = opendir($dir); if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { - if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { + if (strpos($file, 'mod_'.strtolower($myTmpObjectArray['class']).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); require_once $dir.'/'.$file.'.php'; @@ -403,17 +404,18 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print ''."\n"; print ''; - $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON'; + $constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectArray['class']).'_ADDON'; if (getDolGlobalString($constforvar) == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } print ''; - $mytmpinstance = new $myTmpObjectKey($db); + $className = $myTmpObjectArray['class']; + $mytmpinstance = new $className($db); $mytmpinstance->initAsSpecimen(); // Info @@ -448,7 +450,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print "
\n"; } - if ($myTmpObjectArray['includedocgeneration']) { + if (!empty($myTmpObjectArray['includedocgeneration'])) { /* * Document templates generators */ @@ -507,10 +509,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { if (file_exists($dir.'/'.$file)) { $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); + $className = substr($file, 0, dol_strlen($file) - 12); require_once $dir.'/'.$file; - $module = new $classname($db); + $module = new $className($db); $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 893523f22da..435fb37e1f6 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1318,7 +1318,7 @@ if ($mode == 'deploy') { print ' '; - print ''; + print ''; if (getDolGlobalString('MAIN_UPLOAD_DOC')) { if ($user->admin) { diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 20603909699..dd803f2ad71 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips')); +$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'propal', 'receptions', 'stocks', 'trips', 'orders')); if (!$user->admin) { accessforbidden(); diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index da70b1fbbec..89912dd030e 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -308,21 +309,37 @@ print ''; // sort list if ($sortfield == "name" && $sortorder == "asc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($a->name, $b->name); - }); + usort( + $moduleList, + /** @return bool */ + function (stdClass $a, stdClass $b) { + return strcasecmp($a->name, $b->name); + } + ); } elseif ($sortfield == "name" && $sortorder == "desc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($b->name, $a->name); - }); + usort( + $moduleList, + /** @return bool */ + static function (stdClass $a, stdClass $b) { + return strcasecmp($b->name, $a->name); + } + ); } elseif ($sortfield == "version" && $sortorder == "asc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($a->version, $b->version); - }); + usort( + $moduleList, + /** @return bool */ + static function (stdClass $a, stdClass $b) { + return strcasecmp($a->version, $b->version); + } + ); } elseif ($sortfield == "version" && $sortorder == "desc") { - usort($moduleList, function (stdClass $a, stdClass $b) { - return strcasecmp($b->version, $a->version); - }); + usort( + $moduleList, + /** @return bool */ + static function (stdClass $a, stdClass $b) { + return strcasecmp($b->version, $a->version); + } + ); } elseif ($sortfield == "id" && $sortorder == "asc") { usort($moduleList, "compareIdAsc"); } elseif ($sortfield == "id" && $sortorder == "desc") { diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 0dbeab0db6d..fa6547f2eb0 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2020 Laurent Destailleur * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2017 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,14 +51,15 @@ if ($mode == 'searchkey') { $transvalue = GETPOST('transvalue', 'restricthtml'); } - +// Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -247,7 +249,7 @@ if ($transvalue) { } -print '
entity) && !empty($debug)) ? '?debug=1' : '').'" method="POST">'; +print ''; if (isset($optioncss) && $optioncss != '') { print ''; } @@ -301,7 +303,9 @@ foreach ($modulesdir as $keydir => $tmpsearchdir) { } //var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey); + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only if ($result < 0) { print 'Failed to load language file '.$tmpfile.'
'."\n"; @@ -313,6 +317,7 @@ foreach ($modulesdir as $keydir => $tmpsearchdir) { } //print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records
'."\n"; + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $result = $langsenfileonly->load($langkey, 0, 0, '', 1); // Load translation files only } $i++; @@ -396,12 +401,12 @@ if ($mode == 'overwrite') { print ''; - print ''.$obj->lang.''."\n"; + print ''.dol_escape_htmltag($obj->lang).''."\n"; print ''; if ($action == 'edit' && $obj->rowid == GETPOSTINT('rowid')) { print ''; } else { - print $obj->transkey; + print dol_escape_htmltag($obj->transkey); } print ''."\n"; @@ -416,7 +421,7 @@ if ($mode == 'overwrite') { print ''; } else { //print $obj->transkey.' '.$langsenfileonly->tab_translate[$obj->transkey]; - $titleforvalue = $langs->trans("Translation").' en_US for key '.$obj->transkey.':
'.($langsenfileonly->tab_translate[$obj->transkey] ? $langsenfileonly->trans($obj->transkey) : ''.$langs->trans("None").''); + $titleforvalue = $langs->trans("Translation").' en_US for key '.$obj->transkey.':
'.(!empty($langsenfileonly->tab_translate[$obj->transkey]) ? $langsenfileonly->trans($obj->transkey) : ''.$langs->trans("None").''); /*if ($obj->lang != 'en_US') { $titleforvalue .= '
'.$langs->trans("Translation").' '.$obj->lang.' '...; }*/ @@ -433,9 +438,9 @@ if ($mode == 'overwrite') { print '   '; print ''; } else { - print ''.img_edit().''; + print ''.img_edit().''; print '   '; - print ''.img_delete().''; + print ''.img_delete().''; } print ''; @@ -561,7 +566,7 @@ if ($mode == 'searchkey') { if ($i <= $offset) { continue; } - if ($i > ($offset + $limit)) { + if ($limit && $i > ($offset + $limit)) { break; } print ''.$langcode.''.$key.''; diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 4758220503d..879c17af00d 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -90,41 +90,6 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/webhook/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=webhook-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated $tmpobjectkey = GETPOST('object'); @@ -375,269 +340,6 @@ if ($action == 'edit') { } -$moduledir = 'webhook'; -$myTmpObjects = array(); -$myTmpObjects['MyObject'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0); - - -foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { - if ($myTmpObjectKey == 'MyObject') { - continue; - } - if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ - $setupnotempty++; - - print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''."\n"; - - clearstatcache(); - - foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/".$moduledir); - - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') { - $file = substr($file, 0, dol_strlen($file) - 4); - - require_once $dir.'/'.$file.'.php'; - - $module = new $file($db); - - // Show modules according to features level - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { - continue; - } - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { - continue; - } - - if ($module->isEnabled()) { - dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php'); - - print ''; - - // Show example of numbering model - print ''."\n"; - - print ''; - - $mytmpinstance = new $myTmpObjectKey($db); - $mytmpinstance->initAsSpecimen(); - - // Info - $htmltooltip = ''; - $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; - - $nextval = $module->getNextValue($mytmpinstance); - if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip .= ''.$langs->trans("NextValue").': '; - if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { - $nextval = $langs->trans($nextval); - } - $htmltooltip .= $nextval.'
'; - } else { - $htmltooltip .= $langs->trans($module->error).'
'; - } - } - - print ''; - - print "\n"; - } - } - } - closedir($handle); - } - } - } - print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$module->name."\n"; - print $module->info($langs); - print ''; - $tmp = $module->getExample(); - if (preg_match('/^Error/', $tmp)) { - $langs->load("errors"); - print '
'.$langs->trans($tmp).'
'; - } elseif ($tmp == 'NotConfigured') { - print $langs->trans($tmp); - } else { - print $tmp; - } - print '
'; - $constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON'; - if (getDolGlobalString($constforvar) == $file) { - print img_picto($langs->trans("Activated"), 'switch_on'); - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print '

\n"; - } - - if ($myTmpObjectArray['includedocgeneration']) { - /* - * Document templates generators - */ - $setupnotempty++; - $type = strtolower($myTmpObjectKey); - - print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', ''); - - // Load array def with activated templates - $def = array(); - $sql = "SELECT nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; - $sql .= " WHERE type = '".$db->escape($type)."'"; - $sql .= " AND entity = ".$conf->entity; - $resql = $db->query($sql); - if ($resql) { - $i = 0; - $num_rows = $db->num_rows($resql); - while ($i < $num_rows) { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; - } - } else { - dol_print_error($db); - } - - print "\n"; - print "\n"; - print ''; - print ''; - print '\n"; - print '\n"; - print ''; - print ''; - print "\n"; - - clearstatcache(); - - foreach ($dirmodels as $reldir) { - foreach (array('', '/doc') as $valdir) { - $realpath = $reldir."core/modules/".$moduledir.$valdir; - $dir = dol_buildpath($realpath); - - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - $filelist = array(); - while (($file = readdir($handle)) !== false) { - $filelist[] = $file; - } - closedir($handle); - arsort($filelist); - - foreach ($filelist as $file) { - if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { - if (file_exists($dir.'/'.$file)) { - $name = substr($file, 4, dol_strlen($file) - 16); - $classname = substr($file, 0, dol_strlen($file) - 12); - - require_once $dir.'/'.$file; - $module = new $classname($db); - - $modulequalified = 1; - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { - $modulequalified = 0; - } - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { - $modulequalified = 0; - } - - if ($modulequalified) { - print ''; - - // Active - if (in_array($name, $def)) { - print ''; - } else { - print '"; - } - - // Default - print ''; - - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); - if ($module->type == 'pdf') { - $htmltooltip .= '
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; - } - $htmltooltip .= '
'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file; - - $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; - $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); - - print ''; - - // Preview - print ''; - - print "\n"; - } - } - } - } - } - } - } - } - - print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; - print(empty($module->name) ? $name : $module->name); - print "\n"; - if (method_exists($module, 'info')) { - print $module->info($langs); - } else { - print $module->description; - } - print ''."\n"; - print ''; - print img_picto($langs->trans("Enabled"), 'switch_on'); - print ''; - print ''."\n"; - print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; - print "'; - $constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON'; - if (getDolGlobalString($constforvar) == $name) { - //print img_picto($langs->trans("Default"), 'on'); - // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; - } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; - } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print ''; - if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'pdf').''; - } else { - print img_object($langs->trans("PreviewNotAvailable"), 'generic'); - } - print '
'; - } -} - if (empty($setupnotempty)) { print '
'.$langs->trans("NothingToSetup"); } diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index e06954b0422..2e28dc8a6f9 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -3,6 +3,7 @@ * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2021 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,96 +61,96 @@ clearstatcache(); $workflowcodes = array( // Automatic creation - 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array( - 'family'=>'create', - 'position'=>10, - 'enabled'=>(isModEnabled("propal") && isModEnabled('order')), - 'picto'=>'order' + 'WORKFLOW_PROPAL_AUTOCREATE_ORDER' => array( + 'family' => 'create', + 'position' => 10, + 'enabled' => (isModEnabled("propal") && isModEnabled('order')), + 'picto' => 'order' ), - 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array( - 'family'=>'create', - 'position'=>20, - 'enabled'=>(isModEnabled('order') && isModEnabled('invoice')), - 'picto'=>'bill' + 'WORKFLOW_ORDER_AUTOCREATE_INVOICE' => array( + 'family' => 'create', + 'position' => 20, + 'enabled' => (isModEnabled('order') && isModEnabled('invoice')), + 'picto' => 'bill' ), 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array( - 'family'=>'create', - 'position'=>25, - 'enabled'=>(isModEnabled('ticket') && isModEnabled('intervention')), - 'picto'=>'ticket' + 'family' => 'create', + 'position' => 25, + 'enabled' => (isModEnabled('ticket') && isModEnabled('intervention')), + 'picto' => 'ticket' ), - 'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>'', 'enabled'=>((isModEnabled("propal") && isModEnabled('order')) || (isModEnabled('order') && isModEnabled('invoice')) || (isModEnabled('ticket') && isModEnabled('intervention')))), + 'separator1' => array('family' => 'separator', 'position' => 25, 'title' => '', 'enabled' => ((isModEnabled("propal") && isModEnabled('order')) || (isModEnabled('order') && isModEnabled('invoice')) || (isModEnabled('ticket') && isModEnabled('intervention')))), // Automatic classification of proposal - 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array( - 'family'=>'classify_proposal', - 'position'=>30, - 'enabled'=>(isModEnabled("propal") && isModEnabled('order')), - 'picto'=>'propal', - 'warning'=>'' + 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL' => array( + 'family' => 'classify_proposal', + 'position' => 30, + 'enabled' => (isModEnabled("propal") && isModEnabled('order')), + 'picto' => 'propal', + 'warning' => '' ), - 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array( - 'family'=>'classify_proposal', - 'position'=>31, - 'enabled'=>(isModEnabled("propal") && isModEnabled('invoice')), - 'picto'=>'propal', - 'warning'=>'' + 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL' => array( + 'family' => 'classify_proposal', + 'position' => 31, + 'enabled' => (isModEnabled("propal") && isModEnabled('invoice')), + 'picto' => 'propal', + 'warning' => '' ), // Automatic classification of order - 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated - 'family'=>'classify_order', - 'position'=>40, - 'enabled'=>(isModEnabled("shipping") && isModEnabled('order')), - 'picto'=>'order' + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING' => array( // when shipping validated + 'family' => 'classify_order', + 'position' => 40, + 'enabled' => (isModEnabled("shipping") && isModEnabled('order')), + 'picto' => 'order' ), - 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed - 'family'=>'classify_order', - 'position'=>41, - 'enabled'=>(isModEnabled("shipping") && isModEnabled('order')), - 'picto'=>'order' + 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED' => array( // when shipping closed + 'family' => 'classify_order', + 'position' => 41, + 'enabled' => (isModEnabled("shipping") && isModEnabled('order')), + 'picto' => 'order' ), - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( - 'family'=>'classify_order', - 'position'=>42, - 'enabled'=>(isModEnabled('invoice') && isModEnabled('order')), - 'picto'=>'order', - 'warning'=>'' + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER' => array( + 'family' => 'classify_order', + 'position' => 42, + 'enabled' => (isModEnabled('invoice') && isModEnabled('order')), + 'picto' => 'order', + 'warning' => '' ), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. // Automatic classification supplier proposal - 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array( - 'family'=>'classify_supplier_proposal', - 'position'=>60, - 'enabled'=>(isModEnabled('supplier_proposal') && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), - 'picto'=>'supplier_proposal', - 'warning'=>'' + 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL' => array( + 'family' => 'classify_supplier_proposal', + 'position' => 60, + 'enabled' => (isModEnabled('supplier_proposal') && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 'picto' => 'supplier_proposal', + 'warning' => '' ), // Automatic classification supplier order - 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array( - 'family'=>'classify_supplier_order', - 'position'=>63, - 'enabled'=>(getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')), - 'picto'=>'supplier_order', - 'warning'=>'' + 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION' => array( + 'family' => 'classify_supplier_order', + 'position' => 63, + 'enabled' => (getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')), + 'picto' => 'supplier_order', + 'warning' => '' ), - 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array( - 'family'=>'classify_supplier_order', - 'position'=>64, - 'enabled'=>(getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')), - 'picto'=>'supplier_order', - 'warning'=>'' + 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED' => array( + 'family' => 'classify_supplier_order', + 'position' => 64, + 'enabled' => (getDolGlobalString('MAIN_FEATURES_LEVEL') && isModEnabled("reception") && isModEnabled('supplier_order')), + 'picto' => 'supplier_order', + 'warning' => '' ), - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array( - 'family'=>'classify_supplier_order', - 'position'=>65, - 'enabled'=>(isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), - 'picto'=>'supplier_order', - 'warning'=>'' + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER' => array( + 'family' => 'classify_supplier_order', + 'position' => 65, + 'enabled' => (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), + 'picto' => 'supplier_order', + 'warning' => '' ), // Automatic classification shipping @@ -188,7 +189,7 @@ $workflowcodes = array( ), - 'separator2'=>array('family'=>'separator', 'position'=>400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))), + 'separator2' => array('family' => 'separator', 'position' => 400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))), // Automatic link ticket -> contract 'WORKFLOW_TICKET_LINK_CONTRACT' => array( @@ -212,9 +213,16 @@ if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['w } // remove not available workflows (based on activated modules and global defined keys) -$workflowcodes = array_filter($workflowcodes, function ($var) { - return $var['enabled']; -}); +$workflowcodes = array_filter( + $workflowcodes, + /** + * @param array{enabled:int<0,1>} $var + * @return int<0,1> + */ + static function ($var) { + return $var['enabled']; + } +); diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index 78084737c6e..c98e036c1d3 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -51,6 +51,11 @@ if (!$user->admin) { accessforbidden(); } +$moduledir = 'workstation'; +$myTmpObjects = array(); +$myTmpObjects['workstation'] = array('includerefgeneration' => 1, 'includedocgeneration' => 0); + + /* * Actions @@ -77,38 +82,41 @@ if ($action == 'updateMask') { } } elseif ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); + if (array_key_exists($tmpobjectkey, $myTmpObjects)) { + $nameofclass = ucfirst($tmpobjectkey); + $tmpobject = new $nameofclass($db); + $tmpobject->initAsSpecimen(); - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/workstation/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele; - break; + // Search template files + $file = ''; + $classname = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir."core/modules/workstation/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); + if (file_exists($file)) { + $classname = "pdf_".$modele; + break; + } } - } - if ($classname !== '') { - require_once $file; + if ($classname !== '') { + require_once $file; - $module = new $classname($db); + $module = new $classname($db); - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; + if ($module->write_file($tmpobject, $langs) > 0) { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); + return; + } else { + setEventMessages($module->error, null, 'errors'); + dol_syslog($module->error, LOG_ERR); + } } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } elseif ($action == 'set') { // Activate a model @@ -219,11 +227,6 @@ if ($action == 'edit') { } -$moduledir = 'workstation'; -$myTmpObjects = array(); -$myTmpObjects['workstation'] = array('includerefgeneration' => 1, 'includedocgeneration' => 0); - - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'MyObject') { continue; diff --git a/htdocs/ai/admin/custom_prompt.php b/htdocs/ai/admin/custom_prompt.php index ee62b646604..5836a0d5b26 100644 --- a/htdocs/ai/admin/custom_prompt.php +++ b/htdocs/ai/admin/custom_prompt.php @@ -1,6 +1,7 @@ * Copyright (C) 2022 Alice Adminson + * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,8 +81,8 @@ $arrayofaifeatures = array( */ $functioncode = GETPOST('functioncode', 'alpha'); -$pre_prompt = GETPOST('prePrompt', 'alpha'); -$post_prompt = GETPOST('postPrompt', 'alpha'); +$pre_prompt = GETPOST('prePrompt'); +$post_prompt = GETPOST('postPrompt'); // get all configs in const AI $currentConfigurationsJson = getDolGlobalString('AI_CONFIGURATIONS_PROMPT'); @@ -126,10 +127,31 @@ if ($action == 'update' && !GETPOST('cancel')) { $action = 'edit'; } -if ($action == 'confirm_deleteproperty') { +if ($action == 'updatePrompts') { + $key = GETPOST('key', 'alpha'); + + $currentConfigurations[$key] = [ + 'prePrompt' => $pre_prompt, + 'postPrompt' => $post_prompt, + ]; + + $newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE); + $result = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity); + if (!$error) { + $action = ''; + if ($result) { + header("Location: ".$_SERVER['PHP_SELF']); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + exit; + } else { + setEventMessages($langs->trans("ErrorUpdating"), null, 'errors'); + } + } +} + +if ($action == 'confirm_deleteproperty' && GETPOST('confirm') == 'yes') { $key = GETPOST('key', 'alpha'); - //var_dump($currentConfigurations[$key]);exit; if (isset($currentConfigurations[$key])) { unset($currentConfigurations[$key]); @@ -137,10 +159,10 @@ if ($action == 'confirm_deleteproperty') { $res = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity); if ($res) { header("Location: ".$_SERVER['PHP_SELF']); - setEventMessages($langs->trans("SetupDeleted"), null, 'mesgs'); + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); exit; } else { - setEventMessages($langs->trans("ErrorDeleting"), null, 'errors'); + setEventMessages($langs->trans("NoRecordDeleted"), null, 'errors'); } } } @@ -234,7 +256,7 @@ if ($action == 'edit') { $out .= 'pre-Prompt'; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''; @@ -242,14 +264,14 @@ if ($action == 'edit') { $out .= 'Post-prompt'; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= $form->buttonsSaveCancel("Add", ""); - + $out .= ''; $out .= '


'; print $out; @@ -269,19 +291,24 @@ if ($action == 'edit' || $action == 'create') { $out .= ''; $out .= ''; $out .= ''.$arrayofaifeatures[$key]['picto'].' '.$langs->trans($arrayofaifeatures[$key]['label']); - $out .= ''.img_edit().''; + $out .= ''.img_edit().''; $out .= ''.img_delete().''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; + + $out .= '
'; + $out .= ''; + $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= 'pre-Prompt'; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; $out .= ''; @@ -289,15 +316,17 @@ if ($action == 'edit' || $action == 'create') { $out .= 'Post-prompt'; $out .= ''; $out .= ''; - $out .= ''; + $out .= ''; + $out .= '
'; + $out .= ''; $out .= ''; + $out .= '
'; } $out .= ''; $out .= ''; } - $out .= ''; $out .= ""; print $out; diff --git a/htdocs/ai/admin/setup.php b/htdocs/ai/admin/setup.php index 9459b501b84..a2bb8f77a23 100644 --- a/htdocs/ai/admin/setup.php +++ b/htdocs/ai/admin/setup.php @@ -104,41 +104,6 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/ai/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bookcal-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated $tmpobjectkey = GETPOST('object'); @@ -208,9 +173,6 @@ print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); $head = aiAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "fa-microchip"); -// Setup page goes here -//echo ''.$langs->trans("AiSetupPage").'

'; - if ($action == 'edit') { print $formSetup->generateOutput(true); diff --git a/htdocs/ai/ajax/generate_content.php b/htdocs/ai/ajax/generate_content.php index 2d65256ad01..bba1402d340 100644 --- a/htdocs/ai/ajax/generate_content.php +++ b/htdocs/ai/ajax/generate_content.php @@ -68,10 +68,12 @@ $format = empty($jsonData['instructions']) ? '' : $jsonData['instructions']; $generatedContent = $ai->generateContent($instructions, 'auto', $function, $format); if (is_array($generatedContent) && $generatedContent['error']) { - // client errors - if ($generatedContent['code'] >= 400) { + // Output error + if ($generatedContent['code'] == 429) { + print "Quota or allowed period exceeded. Retry Later !"; + } elseif ($generatedContent['code'] >= 400) { print "Error : " . $generatedContent['message']; - print '
'.$langs->trans('Check Config of Module').''; + print '
'.$langs->trans('ErrorGoToModuleSetup').''; } else { print "Error returned by API call: " . $generatedContent['message']; } diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 82a60bc5116..8e4bdb0db9f 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2023 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,11 +20,16 @@ // Create the autoloader for Luracast require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php'; -call_user_func(function () { - $loader = Luracast\Restler\AutoLoader::instance(); - spl_autoload_register($loader); - return $loader; -}); +call_user_func( + /** + * @return Luracast\Restler\AutoLoader + */ + static function () { + $loader = Luracast\Restler\AutoLoader::instance(); + spl_autoload_register($loader); + return $loader; + } +); require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iAuthenticate.php'; require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iUseAuthentication.php'; diff --git a/htdocs/api/index.php b/htdocs/api/index.php index d55fe8d38d5..4b3385fe5ee 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2017 Regis Houssin * Copyright (C) 2021 Alexis LAURIER + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -91,11 +92,16 @@ if (!$res) { require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php'; -call_user_func(function () { - $loader = Luracast\Restler\AutoLoader::instance(); - spl_autoload_register($loader); - return $loader; -}); +call_user_func( + /** + * @return Luracast\Restler\AutoLoader + */ + static function () { + $loader = Luracast\Restler\AutoLoader::instance(); + spl_autoload_register($loader); + return $loader; + } +); require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php'; diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 40e37464e90..5850128b3d2 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -64,6 +64,10 @@ $setupnotempty = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +$moduledir = 'asset'; +$myTmpObjects = array(); +$myTmpObjects['Asset'] = array('includerefgeneration' => 1, 'includedocgeneration' => 0); + /* * Actions @@ -89,38 +93,41 @@ if ($action == 'updateMask') { } } elseif ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); + $tmpobjectkey = GETPOST('object', 'aZ09'); - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); + if (array_key_exists($tmpobjectkey, $myTmpObjects)) { + $nameofclass = ucfirst($tmpobjectkey); + $tmpobject = new $nameofclass($db); + $tmpobject->initAsSpecimen(); - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/asset/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele; - break; + // Search template files + $file = ''; + $classname = ''; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir."core/modules/asset/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); + if (file_exists($file)) { + $classname = "pdf_".$modele; + break; + } } - } - if ($classname !== '') { - require_once $file; + if ($classname !== '') { + require_once $file; - $module = new $classname($db); + $module = new $classname($db); - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; + if ($module->write_file($tmpobject, $langs) > 0) { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); + return; + } else { + setEventMessages($module->error, null, 'errors'); + dol_syslog($module->error, LOG_ERR); + } } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated @@ -194,10 +201,6 @@ print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "asse echo ''.$langs->trans("AssetSetupPage").''; -$moduledir = 'asset'; -$myTmpObjects = array(); -$myTmpObjects['Asset'] = array('includerefgeneration' => 1, 'includedocgeneration' => 0); - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectKey == 'MyObject') { diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index a915dc1412a..3d62ba4c91a 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -94,38 +94,38 @@ class Asset extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'noteditable' => '0', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'validate' => '1', 'comment' => "Reference of object"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => '1',), - 'fk_asset_model' => array('type' => 'integer:AssetModel:asset/class/assetmodel.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label' => 'AssetModel', 'enabled' => '1', 'position' => 40, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',), - 'qty' => array('type' => 'real', 'label' => 'Qty', 'enabled' => '1', 'position' => 50, 'notnull' => 1, 'visible' => 0, 'default' => '1', 'isameasure' => '1', 'css' => 'maxwidth75imp', 'validate' => '1',), - 'acquisition_type' => array('type' => 'smallint', 'label' => 'AssetAcquisitionType', 'enabled' => '1', 'position' => 60, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetAcquisitionTypeNew', '1' => 'AssetAcquisitionTypeOccasion'), 'validate' => '1',), - 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => '1', 'position' => 70, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => '1',), - 'not_depreciated' => array('type' => 'boolean', 'label' => 'AssetNotDepreciated', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => '1',), - 'date_acquisition' => array('type' => 'date', 'label' => 'AssetDateAcquisition', 'enabled' => '1', 'position' => 90, 'notnull' => 1, 'visible' => 1,), - 'date_start' => array('type' => 'date', 'label' => 'AssetDateStart', 'enabled' => '1', 'position' => 100, 'notnull' => 0, 'visible' => -1,), - 'acquisition_value_ht' => array('type' => 'price', 'label' => 'AssetAcquisitionValueHT', 'enabled' => '1', 'position' => 110, 'notnull' => 1, 'visible' => 1, 'isameasure' => '1', 'validate' => '1',), - 'recovered_vat' => array('type' => 'price', 'label' => 'AssetRecoveredVAT', 'enabled' => '1', 'position' => 120, 'notnull' => 0, 'visible' => 1, 'isameasure' => '1', 'validate' => '1',), - 'reversal_date' => array('type' => 'date', 'label' => 'AssetReversalDate', 'enabled' => '1', 'position' => 130, 'notnull' => 0, 'visible' => 1,), - 'reversal_amount_ht' => array('type' => 'price', 'label' => 'AssetReversalAmountHT', 'enabled' => '1', 'position' => 140, 'notnull' => 0, 'visible' => 1, 'isameasure' => '1', 'validate' => '1',), - 'disposal_date' => array('type' => 'date', 'label' => 'AssetDisposalDate', 'enabled' => '1', 'position' => 200, 'notnull' => 0, 'visible' => -2,), - 'disposal_amount_ht' => array('type' => 'price', 'label' => 'AssetDisposalAmount', 'enabled' => '1', 'position' => 210, 'notnull' => 0, 'visible' => -2, 'default' => '0', 'isameasure' => '1', 'validate' => '1',), - 'fk_disposal_type' => array('type' => 'sellist:c_asset_disposal_type:label:rowid::active=1', 'label' => 'AssetDisposalType', 'enabled' => '1', 'position' => 220, 'notnull' => 0, 'visible' => -2, 'index' => 1, 'validate' => '1',), - 'disposal_depreciated' => array('type' => 'boolean', 'label' => 'AssetDisposalDepreciated', 'enabled' => '1', 'position' => 230, 'notnull' => 0, 'default' => '0', 'visible' => -2, 'validate' => '1',), - 'disposal_subject_to_vat' => array('type' => 'boolean', 'label' => 'AssetDisposalSubjectToVat', 'enabled' => '1', 'position' => 240, 'notnull' => 0, 'default' => '0', 'visible' => -2, 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'default' => '0', 'visible' => 2, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'), 'validate' => '1',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'noteditable' => 0, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "Reference of object"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => 1,), + 'fk_asset_model' => array('type' => 'integer:AssetModel:asset/class/assetmodel.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label' => 'AssetModel', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => 1,), + 'qty' => array('type' => 'real', 'label' => 'Qty', 'enabled' => 1, 'position' => 50, 'notnull' => 1, 'visible' => 0, 'default' => '1', 'isameasure' => 1, 'css' => 'maxwidth75imp', 'validate' => 1,), + 'acquisition_type' => array('type' => 'smallint', 'label' => 'AssetAcquisitionType', 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetAcquisitionTypeNew', '1' => 'AssetAcquisitionTypeOccasion'), 'validate' => 1,), + 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => 1,), + 'not_depreciated' => array('type' => 'boolean', 'label' => 'AssetNotDepreciated', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'default' => '0', 'visible' => 1, 'validate' => 1,), + 'date_acquisition' => array('type' => 'date', 'label' => 'AssetDateAcquisition', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => 1,), + 'date_start' => array('type' => 'date', 'label' => 'AssetDateStart', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => -1,), + 'acquisition_value_ht' => array('type' => 'price', 'label' => 'AssetAcquisitionValueHT', 'enabled' => 1, 'position' => 110, 'notnull' => 1, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), + 'recovered_vat' => array('type' => 'price', 'label' => 'AssetRecoveredVAT', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), + 'reversal_date' => array('type' => 'date', 'label' => 'AssetReversalDate', 'enabled' => 1, 'position' => 130, 'notnull' => 0, 'visible' => 1,), + 'reversal_amount_ht' => array('type' => 'price', 'label' => 'AssetReversalAmountHT', 'enabled' => 1, 'position' => 140, 'notnull' => 0, 'visible' => 1, 'isameasure' => 1, 'validate' => 1,), + 'disposal_date' => array('type' => 'date', 'label' => 'AssetDisposalDate', 'enabled' => 1, 'position' => 200, 'notnull' => 0, 'visible' => -2,), + 'disposal_amount_ht' => array('type' => 'price', 'label' => 'AssetDisposalAmount', 'enabled' => 1, 'position' => 210, 'notnull' => 0, 'visible' => -2, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), + 'fk_disposal_type' => array('type' => 'sellist:c_asset_disposal_type:label:rowid::active=1', 'label' => 'AssetDisposalType', 'enabled' => 1, 'position' => 220, 'notnull' => 0, 'visible' => -2, 'index' => 1, 'validate' => 1,), + 'disposal_depreciated' => array('type' => 'boolean', 'label' => 'AssetDisposalDepreciated', 'enabled' => 1, 'position' => 230, 'notnull' => 0, 'default' => '0', 'visible' => -2, 'validate' => 1,), + 'disposal_subject_to_vat' => array('type' => 'boolean', 'label' => 'AssetDisposalSubjectToVat', 'enabled' => 1, 'position' => 240, 'notnull' => 0, 'default' => '0', 'visible' => -2, 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '0', 'visible' => 2, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'), 'validate' => 1,), ); public $rowid; public $ref; diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 1be3533eedd..0aa62c55919 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -65,7 +65,7 @@ class AssetDepreciationOptions extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); diff --git a/htdocs/asset/class/assetmodel.class.php b/htdocs/asset/class/assetmodel.class.php index 8315231fd76..8576e5ee37e 100644 --- a/htdocs/asset/class/assetmodel.class.php +++ b/htdocs/asset/class/assetmodel.class.php @@ -100,21 +100,21 @@ class AssetModel extends CommonObject */ /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'validate' => '1'), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => '1',), - 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'default' => '1', 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Enabled', '9' => 'Disabled'), 'validate' => '1',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2', 'validate' => 1,), + 'asset_type' => array('type' => 'smallint', 'label' => 'AssetType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'AssetTypeIntangible', '1' => 'AssetTypeTangible', '2' => 'AssetTypeInProgress', '3' => 'AssetTypeFinancial'), 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 300, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 301, 'notnull' => 0, 'visible' => 0, 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '1', 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Enabled', '9' => 'Disabled'), 'validate' => 1,), ); public $rowid; public $ref; diff --git a/htdocs/asset/tpl/accountancy_codes_view.tpl.php b/htdocs/asset/tpl/accountancy_codes_view.tpl.php index 61954bfc936..16c333b8c6b 100644 --- a/htdocs/asset/tpl/accountancy_codes_view.tpl.php +++ b/htdocs/asset/tpl/accountancy_codes_view.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,7 +59,7 @@ if (empty($reshook)) { if (empty($assetdepreciationoptions->deprecation_options[$mode_key]) && $mode_key == "accelerated_depreciation") { continue; } - $width = ($mode_key == "economic")? "pull-left" : "pull-left"; + $width = "pull-left"; print '' . "\n"; print ''; foreach ($mode_info['fields'] as $field_key => $field_info) { diff --git a/htdocs/asset/tpl/depreciation_options_view.tpl.php b/htdocs/asset/tpl/depreciation_options_view.tpl.php index a98171ed1ea..d7350801020 100644 --- a/htdocs/asset/tpl/depreciation_options_view.tpl.php +++ b/htdocs/asset/tpl/depreciation_options_view.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,7 +65,7 @@ if (empty($reshook)) { $assetdepreciationoptions->setInfosForMode($mode_key, $class_type, true); - $width = ($mode_key == "economic")? "pull-left" : "pull-left"; + $width = "pull-left"; print '
'.$langs->trans($mode_info['label']).'
' . "\n"; print ''; $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 9dbc437758c..6ee4e9c9ac7 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2006-2017 Laurent Destailleur + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -253,8 +254,6 @@ if (empty($reshook)) { } } - $i++; - // Build and output PDF if (!$error && $mode == 'label') { if (!count($arrayofrecords)) { diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index c4db4c61421..5753ce0bc89 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -2,6 +2,7 @@ /* Copyright (C) 2017-2023 Laurent Destailleur * Copyright (C) 2019 Frédéric France * Copyright (C) 2023 Charlene Benke + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -199,7 +200,7 @@ if (empty($reshook)) { } // We check if we're allowed to add this bom - $TParentBom=array(); + $TParentBom = array(); $object->getParentBomTreeRecursive($TParentBom); if ($bom_child_id > 0 && !empty($TParentBom) && in_array($bom_child_id, $TParentBom)) { $n_child = new BOM($db); @@ -306,7 +307,7 @@ $formfile = new FormFile($db); $title = $langs->trans('BOM'); -$help_url ='EN:Module_BOM'; +$help_url = 'EN:Module_BOM'; llxHeader('', $title, $help_url); // Part to create @@ -590,7 +591,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); - print '
+ print ' @@ -642,7 +643,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); - print ' + print ' diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index fda5dd93eeb..1ed600f2433 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -111,18 +111,18 @@ class BOM extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'default' => 1, 'index' => 1, 'position' => 5), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'noteditable' => 1, 'visible' => 4, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'comment' => "Reference of BOM", 'showoncombobox' => '1', 'csslist' => 'nowraponall'), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'noteditable' => 1, 'visible' => 4, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'comment' => "Reference of BOM", 'showoncombobox' => 1, 'csslist' => 'nowraponall'), 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'notnull' => 1, 'searchall' => 1, 'showoncombobox' => '2', 'autofocusoncreate' => 1, 'css' => 'minwidth300 maxwidth400', 'csslist' => 'tdoverflowmax200'), 'bomtype' => array('type' => 'integer', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 33, 'notnull' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'Manufacturing', 1 => 'Disassemble'), 'css' => 'minwidth175', 'csslist' => 'minwidth175 center'), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php:1:((finished:is:null) or (finished:!=:0))', 'label' => 'Product', 'picto' => 'product', 'enabled' => 1, 'visible' => 1, 'position' => 35, 'notnull' => 1, 'index' => 1, 'help' => 'ProductBOMHelp', 'css' => 'maxwidth500', 'csslist' => 'tdoverflowmax100'), 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 60, 'notnull' => -1,), - 'qty' => array('type' => 'real', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'default' => 1, 'position' => 55, 'notnull' => 1, 'isameasure' => '1', 'css' => 'maxwidth50imp right'), + 'qty' => array('type' => 'real', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'default' => 1, 'position' => 55, 'notnull' => 1, 'isameasure' => 1, 'css' => 'maxwidth50imp right'), //'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'), 'duration' => array('type' => 'duration', 'label' => 'EstimatedDuration', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'notnull' => -1, 'css' => 'maxwidth50imp', 'help' => 'EstimatedDurationDesc'), 'fk_warehouse' => array('type' => 'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label' => 'WarehouseForProduction', 'picto' => 'stock', 'enabled' => 1, 'visible' => -1, 'position' => 102, 'css' => 'maxwidth500', 'csslist' => 'tdoverflowmax100'), @@ -1714,7 +1714,7 @@ class BOMLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'LineID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), @@ -1722,12 +1722,12 @@ class BOMLine extends CommonObjectLine 'fk_product' => array('type' => 'integer:Product:product/class/product.class.php', 'label' => 'Product', 'enabled' => 1, 'visible' => 1, 'position' => 20, 'notnull' => 1, 'index' => 1,), 'fk_bom_child' => array('type' => 'integer:BOM:bom/class/bom.class.php', 'label' => 'BillOfMaterials', 'enabled' => 1, 'visible' => -1, 'position' => 40, 'notnull' => -1,), 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 60, 'notnull' => -1,), - 'qty' => array('type' => 'double(24,8)', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'position' => 100, 'notnull' => 1, 'isameasure' => '1',), - 'qty_frozen' => array('type' => 'smallint', 'label' => 'QuantityFrozen', 'enabled' => 1, 'visible' => 1, 'default' => 0, 'position' => 105, 'css' => 'maxwidth50imp', 'help' => 'QuantityConsumedInvariable'), - 'disable_stock_change' => array('type' => 'smallint', 'label' => 'DisableStockChange', 'enabled' => 1, 'visible' => 1, 'default' => 0, 'position' => 108, 'css' => 'maxwidth50imp', 'help' => 'DisableStockChangeHelp'), - 'efficiency' => array('type' => 'double(24,8)', 'label' => 'ManufacturingEfficiency', 'enabled' => 1, 'visible' => 0, 'default' => 1, 'position' => 110, 'notnull' => 1, 'css' => 'maxwidth50imp', 'help' => 'ValueOfEfficiencyConsumedMeans'), + 'qty' => array('type' => 'double(24,8)', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'position' => 100, 'notnull' => 1, 'isameasure' => 1,), + 'qty_frozen' => array('type' => 'smallint', 'label' => 'QuantityFrozen', 'enabled' => 1, 'visible' => 1, 'default' => '0', 'position' => 105, 'css' => 'maxwidth50imp', 'help' => 'QuantityConsumedInvariable'), + 'disable_stock_change' => array('type' => 'smallint', 'label' => 'DisableStockChange', 'enabled' => 1, 'visible' => 1, 'default' => '0', 'position' => 108, 'css' => 'maxwidth50imp', 'help' => 'DisableStockChangeHelp'), + 'efficiency' => array('type' => 'double(24,8)', 'label' => 'ManufacturingEfficiency', 'enabled' => 1, 'visible' => 0, 'default' => '1', 'position' => 110, 'notnull' => 1, 'css' => 'maxwidth50imp', 'help' => 'ValueOfEfficiencyConsumedMeans'), 'fk_unit' => array('type' => 'integer', 'label' => 'Unit', 'enabled' => 1, 'visible' => 1, 'position' => 120, 'notnull' => -1,), - 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => 0, 'position' => 200, 'notnull' => 1,), + 'position' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'default' => '0', 'position' => 200, 'notnull' => 1,), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,), 'fk_default_workstation' => array('type' => 'integer', 'label' => 'DefaultWorkstation', 'enabled' => 1, 'visible' => 1, 'notnull' => 0, 'position' => 1050) ); diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index 1b445686550..737ad9558a8 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -136,41 +136,6 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { - $modele = GETPOST('module', 'alpha'); - $tmpobjectkey = GETPOST('object'); - - $tmpobject = new $tmpobjectkey($db); - $tmpobject->initAsSpecimen(); - - // Search template files - $file = ''; - $classname = ''; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/bookcal/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0); - if (file_exists($file)) { - $classname = "pdf_".$modele."_".strtolower($tmpobjectkey); - break; - } - } - - if ($classname !== '') { - require_once $file; - - $module = new $classname($db); - - if ($module->write_file($tmpobject, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bookcal-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf"); - return; - } else { - setEventMessages($module->error, null, 'errors'); - dol_syslog($module->error, LOG_ERR); - } - } else { - setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); - dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); - } } elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated by calling method canBeActivated $tmpobjectkey = GETPOST('object'); diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index 8845a16723b..bc62dd76842 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -105,6 +105,10 @@ if (!$permissiontoread) { } + + + + /* * Actions */ @@ -132,8 +136,39 @@ if (empty($reshook)) { $triggermodname = 'BOOKCAL_AVAILABILITIES_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'; + + $startday = GETPOST('startday', 'int'); + $startmonth = GETPOST('startmonth', 'int'); + $startyear = GETPOST('startyear', 'int'); + $starthour = GETPOST('startHour', 'int'); + + $dateStartTimestamp = dol_mktime($starthour, 0, 0, $startmonth, $startday, $startyear); + + $endday = GETPOST('endday', 'int'); + $endmonth = GETPOST('endmonth', 'int'); + $endyear = GETPOST('endyear', 'int'); + $endhour = GETPOST('endHour', 'int'); + + + $dateEndTimestamp = dol_mktime($endhour, 0, 0, $endmonth, $endday, $endyear); + + // check hours + if ($starthour > $endhour) { + if ($dateStartTimestamp === $dateEndTimestamp) { + $error++; + setEventMessages($langs->trans("ErrorEndTimeMustBeGreaterThanStartTime"), null, 'errors'); + } + } + + // check date + if ($dateStartTimestamp > $dateEndTimestamp) { + $error++; + setEventMessages($langs->trans("ErrorIncoherentDates"), null, 'errors'); + } + + + // 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'; // Actions when linking object each other include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; @@ -202,10 +237,13 @@ if ($action == 'create') { } print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Availabilities")), '', 'object_'.$object->picto); - print ''; print ''; - print ''; + if ($error != 0) { + print ''; + } else { + print ''; + } if ($backtopage) { print ''; } diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index c131598facf..3582ea707ec 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -112,28 +112,28 @@ class Availabilities extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 20, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax150', 'cssview' => 'wordbreak', 'help' => "BookcalLabelAvailabilityHelp", 'showoncombobox' => '2', 'validate' => '1',), - 'fk_bookcal_calendar' => array('type' => 'integer:Calendar:bookcal/class/calendar.class.php:1', 'label' => 'Calendar', 'enabled' => '1', 'position' => 25, 'notnull' => 1, 'visible' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax100'), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), - 'start' => array('type' => 'date', 'label' => 'Start Date', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'searchall' => 1,), - 'end' => array('type' => 'date', 'label' => 'End Date', 'enabled' => '1', 'position' => 45, 'notnull' => 1, 'visible' => 1, 'searchall' => 1,), - 'duration' => array('type' => 'integer', 'label' => 'DurationOfRange', 'enabled' => '1', 'position' => 47, 'notnull' => 1, 'visible' => 1, 'default' => '30', 'css' => 'width50 right'), - 'startHour' => array('type' => 'integer', 'label' => 'Start Hour', 'enabled' => '1', 'position' => 46, 'notnull' => 1, 'visible' => 1,), - 'endHour' => array('type' => 'integer', 'label' => 'End Hour', 'enabled' => '1', 'position' => 46.5, 'notnull' => 1, 'visible' => 1,), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => '1', 'position' => 2000, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Closed'), 'default' => 1, 'validate' => '1'), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 20, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax150', 'cssview' => 'wordbreak', 'help' => "BookcalLabelAvailabilityHelp", 'showoncombobox' => 2, 'validate' => 1,), + 'fk_bookcal_calendar' => array('type' => 'integer:Calendar:bookcal/class/calendar.class.php:1', 'label' => 'Calendar', 'enabled' => 1, 'position' => 25, 'notnull' => 1, 'visible' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax100'), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'start' => array('type' => 'date', 'label' => 'Start Date', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'searchall' => 1,), + 'end' => array('type' => 'date', 'label' => 'End Date', 'enabled' => 1, 'position' => 45, 'notnull' => 1, 'visible' => 1, 'searchall' => 1,), + 'duration' => array('type' => 'integer', 'label' => 'DurationOfRange', 'enabled' => 1, 'position' => 47, 'notnull' => 1, 'visible' => 1, 'default' => '30', 'css' => 'width50 right'), + 'startHour' => array('type' => 'integer', 'label' => 'Start Hour', 'enabled' => 1, 'position' => 46, 'notnull' => 1, 'visible' => 1,), + 'endHour' => array('type' => 'integer', 'label' => 'End Hour', 'enabled' => 1, 'position' => 46.5, 'notnull' => 1, 'visible' => 1,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 2000, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Closed'), 'default' => '1', 'validate' => 1), ); public $rowid; public $label; @@ -529,7 +529,7 @@ class Availabilities extends CommonObject if (!empty($num)) { // Validate $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " SET ref = '".$this->db->escape($num)."',"; + $sql .= " SET label = '".$this->db->escape($num)."',"; $sql .= " status = ".self::STATUS_VALIDATED; if (!empty($this->fields['date_validation'])) { $sql .= ", date_validation = '".$this->db->idate($now)."'"; diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index f4777bfa003..539ef39e5ed 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -112,25 +112,25 @@ class Calendar extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'right', 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'validate' => '1', 'comment' => "Reference of object", 'css' => 'width100'), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 0, 'visible' => 1, 'alwayseditable' => '1', 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => '2', 'validate' => '1',), - 'visibility' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Owner', 'enabled' => '1', 'position' => 40, 'notnull' => 1, 'visible' => 1, 'picto' => 'user', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), - 'type' => array('type' => 'integer', 'label' => 'Type', 'enabled' => '1', 'position' => 42, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'Customer', '1' => 'Supplier', '3' => 'Other'),), - 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'picto' => 'company', 'enabled' => 'isModEnabled("societe")', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150', 'help' => "ThirdPartyBookCalHelp", 'validate' => '1',), - 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'picto' => 'project', 'enabled' => 'isModEnabled("project")', 'position' => 52, 'notnull' => -1, 'visible' => -1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150', 'validate' => '1',), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => '1',), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => '1',), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax150',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax150',), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => '1', 'position' => 2000, 'notnull' => 1, 'default' => 0, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Closed'), 'validate' => '1',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'right', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'validate' => 1, 'comment' => "Reference of object", 'css' => 'width100'), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => 1, 'alwayseditable' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'help' => "Help text", 'showoncombobox' => 2, 'validate' => 1,), + 'visibility' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Owner', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'picto' => 'user', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), + 'type' => array('type' => 'integer', 'label' => 'Type', 'enabled' => 1, 'position' => 42, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array('0' => 'Customer', '1' => 'Supplier', '3' => 'Other'),), + 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'picto' => 'company', 'enabled' => 'isModEnabled("societe")', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150', 'help' => "ThirdPartyBookCalHelp", 'validate' => 1,), + 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'picto' => 'project', 'enabled' => 'isModEnabled("project")', 'position' => 52, 'notnull' => -1, 'visible' => -1, 'index' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150', 'validate' => 1,), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3, 'validate' => 1,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0, 'cssview' => 'wordbreak', 'validate' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'picto' => 'user', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax150',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'picto' => 'user', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax150',), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 2000, 'notnull' => 1, 'default' => '0', 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Closed'), 'validate' => 1,), ); public $rowid; public $ref; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f65789c855c..57365ce5f50 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -256,7 +256,7 @@ class Categorie extends CommonObject public $type; /** - * @var array Categories table in memory + * @var array Categories table in memory */ public $cats = array(); @@ -970,7 +970,7 @@ class Categorie extends CommonObject * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @return array|int Array of categories, 0 if no cat, -1 on error + * @return int<-1,0>|array,visible:int,ref_ext:string,picto:string,multilangs?:string}> Array of categories, 0 if no cat, -1 on error */ public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { @@ -1139,7 +1139,7 @@ class Categorie extends CommonObject * - string (categories ids separated by comma) * - array (list of categories ids) * @param int $include [=0] Removed or 1=Keep only - * @return array|int Array of categories. this->cats and this->motherof are set, -1 on error + * @return int<-1,-1>|array Array of categories. this->cats and this->motherof are set, -1 on error */ public function get_full_arbo($type, $markafterid = 0, $include = 0) { @@ -1222,9 +1222,10 @@ class Categorie extends CommonObject $keyfilter2 = '_'.$keyfiltercatid.'$'; $keyfilter3 = '^'.$keyfiltercatid.'_'; $keyfilter4 = '_'.$keyfiltercatid.'_'; - foreach ($this->cats as $key => $val) { - $test = (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) - || preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])); + foreach (array_keys($this->cats) as $key) { + $fullpath = $this->cats[$key]['fullpath']; + $test = (preg_match('/'.$keyfilter1.'/', $fullpath) || preg_match('/'.$keyfilter2.'/', $fullpath) + || preg_match('/'.$keyfilter3.'/', $fullpath) || preg_match('/'.$keyfilter4.'/', $fullpath)); if (($test && !$include) || (!$test && $include)) { unset($this->cats[$key]); @@ -1245,7 +1246,7 @@ class Categorie extends CommonObject * * @param int $id_categ id_categ entry to update * @param int $protection Deep counter to avoid infinite loop - * @return int Return integer <0 if KO, >0 if OK + * @return int<-1,1> Return integer <0 if KO, >0 if OK * @see get_full_arbo() */ private function buildPathFromId($id_categ, $protection = 1000) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index efcd10ddbb9..a277b9b03c8 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -102,7 +102,7 @@ if ($confirm == 'no') { } } -$parameters = array(); +$parameters = array('type' => $type, 'id' => $id, 'label' => $label); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Remove element from category if ($id > 0 && $removeelem > 0 && $action == 'unlink') { @@ -1355,6 +1355,10 @@ if ($type == Categorie::TYPE_TICKET) { } } +// Note that $action and $object may have been modified by some hooks +$parameters = array('type' => $type, 'id' => $id, 'label' => $label); +$reshook = $hookmanager->executeHooks('addMoreCategoriesList', $parameters, $object, $action); + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f5d96eec190..1e27f3d54f8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -426,12 +426,6 @@ if (empty($reshook) && $action == 'add') { } } - if (!$error && getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - if (GETPOST("doneby") > 0) { - $object->userdoneid = GETPOSTINT("doneby"); - } - } - $object->note_private = trim(GETPOST("note", "restricthtml")); if (GETPOSTISSET("contactid")) { @@ -877,12 +871,6 @@ if (empty($reshook) && $action == 'update') { $object->transparency = $transparency; // We set transparency on event (even if we can also store it on each user, standard says this property is for event) // TODO store also transparency on owner user - if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - if (GETPOST("doneby")) { - $object->userdoneid = GETPOSTINT("doneby"); - } - } - // Check parameters if (GETPOSTISSET('actioncode') && !GETPOST('actioncode', 'aZ09')) { // actioncode is '0' $error++; @@ -1230,16 +1218,6 @@ if ($action == 'create') { setdatefields(); }); - $("#selectcomplete").change(function() { - console.log("we change the complete status - set the doneby"); - if ($("#selectcomplete").val() == 100) { - if ($("#doneby").val() <= 0) $("#doneby").val(\''.((int) $user->id).'\'); - } - if ($("#selectcomplete").val() == 0) { - $("#doneby").val(-1); - } - }); - $("#actioncode").change(function() { if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired"); else $("#dateend").removeClass("fieldrequired"); @@ -1444,13 +1422,6 @@ if ($action == 'create') { print ''; print ''; - // Done by - if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - print '
'; - } - // Location if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) { print ''; @@ -1995,13 +1966,6 @@ if ($id > 0) { }*/ print ''; - // Realised by - if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - print ''; - } - // Location if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) { print ''; @@ -2427,17 +2391,6 @@ if ($id > 0) { */ print ' '; - // Done by - if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { - print ''; - } - // Categories if (isModEnabled('category')) { print ''; @@ -1023,20 +1023,20 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1); $morehtmlref .= ''; - $morehtmlright = ''; + $morehtmlstatus = ''; $nbtry = $nbok = 0; if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); - $morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail; + $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail; if ($nbko) { - $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error"); } - $morehtmlright .= ')   '; + $morehtmlstatus .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; @@ -1345,20 +1345,20 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1); $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; $nbtry = $nbok = 0; if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); - $morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail; + $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail; if ($nbko) { - $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error"); } - $morehtmlright .= ')   '; + $morehtmlstatus .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 95ffc1f0c38..4b36bba8cda 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2023 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2014 Florian Henry + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -278,21 +279,21 @@ if ($object->fetch($id) >= 0) { $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1); $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; $nbtry = $nbok = 0; if ($object->status == $object::STATUS_SENTPARTIALY || $object->status == $object::STATUS_SENTCOMPLETELY) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); $nbok = ($nbtry - $nbko); - $morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail; + $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail; if ($nbko) { - $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error"); } - $morehtmlright .= ')   '; + $morehtmlstatus .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; @@ -364,6 +365,7 @@ if ($object->fetch($id) >= 0) { $nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' '.$langs->trans("NoTargetYet").''; } if ($text) { + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition print $form->textwithpicto($nbemail, $text, 1, 'warning'); } else { print $nbemail; diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 0bf7e9cb4ad..08aaad90c2a 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -64,20 +64,20 @@ if ($object->fetch($id) >= 0) { $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1); $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; $nbtry = $nbok = 0; if ($object->status == 2 || $object->status == 3) { $nbtry = $object->countNbOfTargets('alreadysent'); $nbko = $object->countNbOfTargets('alreadysentko'); - $morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail; + $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail; if ($nbko) { - $morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error"); } - $morehtmlright .= ')   '; + $morehtmlstatus .= ')   '; } - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '

'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e62067bd89a..6d3048b8e65 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2903,19 +2903,23 @@ if ($action == 'create') { print '
'; print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + $object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); + + print ''; } print ''; + } - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + $object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); + + print ''; } + print ''; } print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 51cb5484af0..69d3e5b59c9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -281,18 +281,6 @@ class Propal extends CommonObject public $labelStatus = array(); public $labelStatusShort = array(); - // Multicurrency - /** - * @var int ID - */ - public $fk_multicurrency; - - public $multicurrency_code; - public $multicurrency_tx; - public $multicurrency_total_ht; - public $multicurrency_total_tva; - public $multicurrency_total_ttc; - /** * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') @@ -320,11 +308,11 @@ class Propal extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 20), 'ref_client' => array('type' => 'varchar(255)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 22), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 40), @@ -2473,136 +2461,6 @@ class Propal extends CommonObject return -1; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Set an overall discount on the proposal - * - * @param User $user Object user that modify - * @param double $remise Amount discount - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int Return integer <0 if ko, >0 if ok - * @deprecated remise_percent is a deprecated field for object parent - */ - /* - public function set_remise_percent($user, $remise, $notrigger = 0) - { - // phpcs:enable - $remise = trim($remise) ?trim($remise) : 0; - - if ($user->hasRight('propal', 'creer')) { - $remise = price2num($remise, 2); - - $error = 0; - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".((float) $remise); - $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $this->errors[] = $this->db->error(); - $error++; - } - - if (!$error) { - $this->oldcopy = clone $this; - $this->remise_percent = $remise; - $this->update_price(1); - } - - if (!$notrigger && empty($error)) { - // Call trigger - $result = $this->call_trigger('PROPAL_MODIFY', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - - if (!$error) { - $this->db->commit(); - return 1; - } else { - foreach ($this->errors as $errmsg) { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } - } - - return -1; - } - */ - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Set an absolute overall discount on the proposal - * - * @param User $user Object user that modify - * @param double $remise Amount discount - * @param int $notrigger 1=Does not execute triggers, 0= execute triggers - * @return int Return integer <0 if ko, >0 if ok - */ - /* - public function set_remise_absolue($user, $remise, $notrigger = 0) - { - // phpcs:enable - if (empty($remise)) { - $remise = 0; - } - $remise = price2num($remise); - - if ($user->hasRight('propal', 'creer')) { - $error = 0; - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET remise_absolue = ".((float) $remise); - $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $this->errors[] = $this->db->error(); - $error++; - } - - if (!$error) { - $this->oldcopy = clone $this; - $this->update_price(1); - } - - if (!$notrigger && empty($error)) { - // Call trigger - $result = $this->call_trigger('PROPAL_MODIFY', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - - if (!$error) { - $this->db->commit(); - return 1; - } else { - foreach ($this->errors as $errmsg) { - dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } - } - - return -1; - } - */ - /** * Reopen the commercial proposal diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1f13f844c5c..f918d886795 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2804,20 +2804,24 @@ if ($action == 'create' && $usercancreate) { print ''; print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + $object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); + + print ''; } print ''; + } - // Amount Local Taxes - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; + // Amount Local Taxes + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + $object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); + + print ''; } + print ''; } print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b7d2e37c24d..8f89a1bb336 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -253,20 +253,6 @@ class Commande extends CommonOrder */ public $lines = array(); - // Multicurrency - /** - * @var int Currency ID - */ - public $fk_multicurrency; - - /** - * @var string multicurrency code - */ - public $multicurrency_code; - public $multicurrency_tx; - public $multicurrency_total_ht; - public $multicurrency_total_tva; - public $multicurrency_total_ttc; //! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...) public $module_source; @@ -311,11 +297,11 @@ class Commande extends CommonOrder // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 25), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 26), 'ref_client' => array('type' => 'varchar(255)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 28), @@ -1317,8 +1303,8 @@ class Commande extends CommonOrder { global $conf, $hookmanager; - dol_include_once('/multicurrency/class/multicurrency.class.php'); - dol_include_once('/core/class/extrafields.class.php'); + require_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $error = 0; @@ -2438,7 +2424,7 @@ class Commande extends CommonOrder /** * Applique une remise relative * - * @deprecated + * @deprecated Use setDiscount() instead. * @see setDiscount() * @param User $user User qui positionne la remise * @param float $remise Discount (percent) @@ -2449,6 +2435,7 @@ class Commande extends CommonOrder { // phpcs:enable dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE); + // @phan-suppress-next-line PhanDeprecatedFunction return $this->setDiscount($user, $remise, $notrigger); } @@ -2459,7 +2446,6 @@ class Commande extends CommonOrder * @param float $remise Discount (percent) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int Return integer <0 if KO, >0 if OK - * @deprecated remise_percent is a deprecated field for object parent */ public function setDiscount($user, $remise, $notrigger = 0) { diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 2adbd25a7d0..2046845b8db 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -12,6 +12,7 @@ * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018-2023 Charlene Benke * Copyright (C) 2021-2023 Anthony Berton + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1107,7 +1108,7 @@ if ($resql) { // Payment term if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { print ''; } // Payment mode diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index bb4b30474b7..05351d41713 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -5,6 +5,7 @@ * Copyright (C) 2020 Maxime DEMAREST * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2022-2024 Alexandre Spangaro + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,15 +97,15 @@ if (!$sortorder) { $arrayfields = array( - 'type'=>array('label'=>"Type", 'checked'=>1), - 'date'=>array('label'=>"Date", 'checked'=>1), - 'date_due'=>array('label'=>"DateDue", 'checked'=>1), - 'ref'=>array('label'=>"Ref", 'checked'=>1), - 'documents'=>array('label'=>"Documents", 'checked'=>1), - 'paid'=>array('label'=>"Paid", 'checked'=>1), - 'total_ht'=>array('label'=>"TotalHT", 'checked'=>1), - 'total_ttc'=>array('label'=>"TotalTTC", 'checked'=>1), - 'total_vat'=>array('label'=>"TotalVAT", 'checked'=>1), + 'type' => array('label' => "Type", 'checked' => 1), + 'date' => array('label' => "Date", 'checked' => 1), + 'date_due' => array('label' => "DateDue", 'checked' => 1), + 'ref' => array('label' => "Ref", 'checked' => 1), + 'documents' => array('label' => "Documents", 'checked' => 1), + 'paid' => array('label' => "Paid", 'checked' => 1), + 'total_ht' => array('label' => "TotalHT", 'checked' => 1), + 'total_ttc' => array('label' => "TotalTTC", 'checked' => 1), + 'total_vat' => array('label' => "TotalVAT", 'checked' => 1), //... ); @@ -135,14 +136,14 @@ if (empty($entity)) { $error = 0; $listofchoices = array( - 'selectinvoices'=>array('label'=>'Invoices', 'picto'=>'bill', 'lang'=>'bills', 'enabled' => isModEnabled('invoice'), 'perms' => $user->hasRight('facture', 'lire')), - 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'picto'=>'supplier_invoice', 'lang'=>'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')), - 'selectexpensereports'=>array('label'=>'ExpenseReports', 'picto'=>'expensereport', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')), - 'selectdonations'=>array('label'=>'Donations', 'picto'=>'donation', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')), - 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'picto'=>'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')), - 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'picto'=>'salary', 'lang'=>'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')), - 'selectvariouspayment'=>array('label'=>'VariousPayment', 'picto'=>'payment', 'enabled' => isModEnabled('bank'), 'perms' => $user->hasRight('banque', 'lire')), - 'selectloanspayment'=>array('label'=>'PaymentLoan','picto'=>'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')), + 'selectinvoices' => array('label' => 'Invoices', 'picto' => 'bill', 'lang' => 'bills', 'enabled' => isModEnabled('invoice'), 'perms' => $user->hasRight('facture', 'lire')), + 'selectsupplierinvoices' => array('label' => 'BillsSuppliers', 'picto' => 'supplier_invoice', 'lang' => 'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => $user->hasRight('fournisseur', 'facture', 'lire')), + 'selectexpensereports' => array('label' => 'ExpenseReports', 'picto' => 'expensereport', 'lang' => 'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => $user->hasRight('expensereport', 'lire')), + 'selectdonations' => array('label' => 'Donations', 'picto' => 'donation', 'lang' => 'donation', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('don', 'lire')), + 'selectsocialcontributions' => array('label' => 'SocialContributions', 'picto' => 'bill', 'enabled' => isModEnabled('tax'), 'perms' => $user->hasRight('tax', 'charges', 'lire')), + 'selectpaymentsofsalaries' => array('label' => 'SalariesPayments', 'picto' => 'salary', 'lang' => 'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => $user->hasRight('salaries', 'read')), + 'selectvariouspayment' => array('label' => 'VariousPayment', 'picto' => 'payment', 'enabled' => isModEnabled('bank'), 'perms' => $user->hasRight('banque', 'lire')), + 'selectloanspayment' => array('label' => 'PaymentLoan','picto' => 'loan', 'enabled' => isModEnabled('don'), 'perms' => $user->hasRight('loan', 'read')), ); @@ -157,6 +158,9 @@ $listofchoices = array( //if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $filesarray = array(); + +'@phan-var-force array $filesarray'; + $result = false; if (($action == 'searchfiles' || $action == 'dl')) { if (empty($date_start)) { @@ -411,6 +415,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { $nofile['link'] = ''; $nofile['name'] = ''; + $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile; } else { foreach ($files as $key => $file) { @@ -446,8 +451,8 @@ if (($action == 'searchfiles' || $action == 'dl')) { } $filesarray[$file['item'].'_'.$file['id']]['files'][] = array( 'link' => $link.urlencode($file['name']), - 'name'=>$file['name'], - 'ref'=>$file['ref'], + 'name' => $file['name'], + 'ref' => $file['ref'], 'fullname' => $file['fullname'], 'relpath' => '/'.$file['name'], 'relpathnamelang' => $langs->trans($file['item']).'/'.$file['name'], @@ -522,7 +527,7 @@ if ($result && $action == "dl" && !$error) { $zipname .= '_'.$project->ref; } } - $zipname .='_export.zip'; + $zipname .= '_export.zip'; dol_delete_file($zipname); @@ -689,6 +694,7 @@ if (!empty($date_start) && !empty($date_stop)) { } $TData = dol_sort_array($filesarray, $sortfield, $sortorder); + '@phan-var-force array $TData'; $filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip'; diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 5978fcc75b8..ff8260fce9d 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013-2023 Charlene BENKE + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -205,7 +206,7 @@ for ($mois = 1; $mois < 13; $mois++) { print ""; for ($annee = $year_start; $annee <= $year_end; $annee++) { - $case = sprintf("%04s-%02s", $annee, $mois); + $case = sprintf("%04d-%02d", $annee, $mois); print ''; print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + $object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT'); + + print ''; } print ''; - - if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; - } } + if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + $object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT'); + + print ''; + } + print ''; + } // Add the revenue stamp if ($selleruserevenustamp) { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index e48c0d52c5e..bb7a8ab2ace 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -172,12 +172,12 @@ class FactureRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), 'titre' => array('type' => 'varchar(100)', 'label' => 'Titre', 'enabled' => 1, 'showoncombobox' => 1, 'visible' => -1, 'position' => 15), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 25), 'subtype' => array('type' => 'smallint(6)', 'label' => 'InvoiceSubtype', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 30), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 35), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8aee3548b16..9b3e6733698 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -194,6 +194,7 @@ class Facture extends CommonInvoice public $date_pointoftax; + /** * @var int Situation cycle reference number */ @@ -290,12 +291,12 @@ class Facture extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 1), 'ref' => array('type' => 'varchar(30)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 5), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 20, 'index' => 1), 'ref_client' => array('type' => 'varchar(255)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 10), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 12), 'type' => array('type' => 'smallint(6)', 'label' => 'Type', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 15), @@ -458,8 +459,8 @@ class Facture extends CommonInvoice $this->ref_client = trim($this->ref_client); - $this->note = (isset($this->note) ? trim($this->note) : trim($this->note_private)); // deprecated - $this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note_private)); + $this->note_private = (isset($this->note_private) ? trim($this->note_private) : ''); + $this->note = (isset($this->note) ? trim($this->note) : $this->note_private); // deprecated $this->note_public = trim($this->note_public); if (!$this->cond_reglement_id) { $this->cond_reglement_id = 0; @@ -4413,6 +4414,7 @@ class Facture extends CommonInvoice { // phpcs:enable dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE); + // @phan-suppress-next-line PhanDeprecatedFunction return $this->setDiscount($user, $remise, $notrigger); } @@ -4423,7 +4425,6 @@ class Facture extends CommonInvoice * @param float $remise Discount * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int Return integer <0 if KO, >0 if OK - * @deprecated remise_percent is a deprecated field for object parent */ public function setDiscount($user, $remise, $notrigger = 0) { diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 33ec278f646..2371f6ff59a 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2017 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -314,7 +314,9 @@ if ($object->id > 0) { } $author = new User($db); - if ($object->fk_user_author) { + if (!empty($object->user_creation_id)) { + $author->fetch($object->user_creation_id); + } elseif (!empty($object->fk_user_author)) { $author->fetch($object->fk_user_author); } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 0594855dce2..d60aa17ce3b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -68,12 +68,12 @@ class Paiement extends CommonObject public $socid; /** - * @var int + * @var int|string */ public $datepaye; /** - * @var int same than $datepaye + * @var int|string same than $datepaye */ public $date; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 0094a541cf6..31b4daceabf 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2018 Frédéric France + * Copyright (C) 2016-2024 Frédéric France * Copyright (C) 2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -85,7 +85,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { $other_chid = substr($key, 7); - $amounts[$other_chid] = price2num(GETPOST($key)); + $amounts[$other_chid] = (float) price2num(GETPOST($key)); } } diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php index 3b98f540a22..af4e1463ae3 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2021 Frédéric France + * Copyright (C) 2016-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -80,7 +80,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y foreach ($_POST as $key => $value) { if (substr($key, 0, 7) == 'amount_') { $other_chid = substr($key, 7); - $amounts[$other_chid] = price2num(GETPOST($key)); + $amounts[$other_chid] = (float) price2num(GETPOST($key)); } } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0194541b801..a58cb34a0b5 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -145,23 +145,23 @@ class BonPrelevement extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 0,), - 'ref' => array('type' => 'varchar(12)', 'label' => 'Ref', 'enabled' => '1', 'position' => 15, 'notnull' => 0, 'visible' => -1, 'csslist' => 'tdoverflowmax150', 'showoncombobox' => '1',), - 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 25, 'notnull' => 0, 'visible' => -1,), - 'amount' => array('type' => 'double(24,8)', 'label' => 'Amount', 'enabled' => '1', 'position' => 30, 'notnull' => 0, 'visible' => -1,), - 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => '1', 'position' => 500, 'notnull' => 0, 'visible' => -1, 'arrayofkeyval' => array(0 => 'Wait', 1 => 'Transfered', 2 => 'Credited')), - 'credite' => array('type' => 'smallint(6)', 'label' => 'Credite', 'enabled' => '1', 'position' => 40, 'notnull' => 0, 'visible' => -1,), - 'note' => array('type' => 'text', 'label' => 'Note', 'enabled' => '1', 'position' => 45, 'notnull' => 0, 'visible' => -1,), - 'date_trans' => array('type' => 'datetime', 'label' => 'Datetrans', 'enabled' => '1', 'position' => 50, 'notnull' => 0, 'visible' => -1,), - 'method_trans' => array('type' => 'smallint(6)', 'label' => 'Methodtrans', 'enabled' => '1', 'position' => 55, 'notnull' => 0, 'visible' => -1,), - 'fk_user_trans' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusertrans', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), - 'date_credit' => array('type' => 'datetime', 'label' => 'Datecredit', 'enabled' => '1', 'position' => 65, 'notnull' => 0, 'visible' => -1,), - 'fk_user_credit' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusercredit', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), - 'type' => array('type' => 'varchar(16)', 'label' => 'Type', 'enabled' => '1', 'position' => 75, 'notnull' => 0, 'visible' => -1,), - 'fk_bank_account' => array('type' => 'integer', 'label' => 'Fkbankaccount', 'enabled' => '1', 'position' => 80, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx',), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 0,), + 'ref' => array('type' => 'varchar(12)', 'label' => 'Ref', 'enabled' => 1, 'position' => 15, 'notnull' => 0, 'visible' => -1, 'csslist' => 'tdoverflowmax150', 'showoncombobox' => 1,), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 25, 'notnull' => 0, 'visible' => -1,), + 'amount' => array('type' => 'double(24,8)', 'label' => 'Amount', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => -1,), + 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'position' => 500, 'notnull' => 0, 'visible' => -1, 'arrayofkeyval' => array(0 => 'Wait', 1 => 'Transfered', 2 => 'Credited')), + 'credite' => array('type' => 'smallint(6)', 'label' => 'Credite', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1,), + 'note' => array('type' => 'text', 'label' => 'Note', 'enabled' => 1, 'position' => 45, 'notnull' => 0, 'visible' => -1,), + 'date_trans' => array('type' => 'datetime', 'label' => 'Datetrans', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => -1,), + 'method_trans' => array('type' => 'smallint(6)', 'label' => 'Methodtrans', 'enabled' => 1, 'position' => 55, 'notnull' => 0, 'visible' => -1,), + 'fk_user_trans' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusertrans', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), + 'date_credit' => array('type' => 'datetime', 'label' => 'Datecredit', 'enabled' => 1, 'position' => 65, 'notnull' => 0, 'visible' => -1,), + 'fk_user_credit' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Fkusercredit', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150',), + 'type' => array('type' => 'varchar(16)', 'label' => 'Type', 'enabled' => 1, 'position' => 75, 'notnull' => 0, 'visible' => -1,), + 'fk_bank_account' => array('type' => 'integer', 'label' => 'Fkbankaccount', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => -1, 'css' => 'maxwidth500 widthcentpercentminusxx',), ); public $rowid; public $ref; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 00934b0f0e6..a6b326ac456 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -6,6 +6,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2019 Markus Welters + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -241,6 +242,7 @@ if ($type == 'bank-transfer') { llxHeader('', $title); +// @phan-suppress-next-line PhanPluginSuspiciousParamPosition $head = bon_prelevement_prepare_head($bprev, $bprev->nbOfInvoiceToPay($type), $bprev->nbOfInvoiceToPay($type, 'salary')); if ($type) { print dol_get_fiche_head($head, (!GETPOSTISSET('sourcetype') ? 'invoice' : 'salary'), $langs->trans("Invoices"), -1, $bprev->picto); diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 4422ff3da33..0829b4cc8ec 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -356,6 +356,11 @@ while ($i < min($num, $limit)) { $i++; } +// If no record found +if ($num == 0) { + print ''; +} + print "
'.$langs->trans($mode_info['label']).'
'.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers(GETPOSTISSET("doneby") ? GETPOSTINT("doneby") : (!empty($object->userdoneid) && $percent == 100 ? $object->userdoneid : 0), 'doneby', 1); - print '
'.$langs->trans("Location").'
'.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1); - print '
'.$langs->trans("Location").'
'.$langs->trans("ActionDoneBy").''; - if ($object->userdoneid > 0) { - $tmpuser = new User($db); - $tmpuser->fetch($object->userdoneid); - print $tmpuser->getNomUrl(1); - } - print '
'.$langs->trans("Categories").''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 704f14baeb8..db8eadee618 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -6,7 +6,8 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 William Mead * * 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 @@ -240,11 +241,6 @@ class ActionComm extends CommonObject */ public $userownerid; - /** - * @var int Id of user that has done the event. Used only if AGENDA_ENABLE_DONEBY is set. - */ - public $userdoneid; - /** * @var int[] Array of contact ids */ @@ -493,7 +489,6 @@ class ActionComm extends CommonObject } $userownerid = $this->userownerid; - $userdoneid = $this->userdoneid; // Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...). if (empty($this->userassigned) || count($this->userassigned) == 0 || !is_array($this->userassigned)) { @@ -543,7 +538,6 @@ class ActionComm extends CommonObject $sql .= "fk_contact,"; $sql .= "fk_user_author,"; $sql .= "fk_user_action,"; - $sql .= "fk_user_done,"; $sql .= "label,percent,priority,fulldayevent,location,"; $sql .= "transparency,"; $sql .= "fk_element,"; @@ -582,7 +576,6 @@ class ActionComm extends CommonObject $sql .= ((isset($this->contact_id) && $this->contact_id > 0) ? ((int) $this->contact_id) : "null").", "; // deprecated, use ->socpeopleassigned $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", "; - $sql .= ($userdoneid > 0 ? $userdoneid : "null").", "; $sql .= "'".$this->db->escape($this->label)."', "; $sql .= "'".$this->db->escape($this->percentage)."', "; $sql .= "'".$this->db->escape($this->priority)."', "; @@ -811,7 +804,7 @@ class ActionComm extends CommonObject $sql .= " a.fk_soc,"; $sql .= " a.fk_project,"; $sql .= " a.fk_user_author, a.fk_user_mod,"; - $sql .= " a.fk_user_action, a.fk_user_done,"; + $sql .= " a.fk_user_action,"; $sql .= " a.fk_contact, a.percent as percentage,"; $sql .= " a.fk_element as elementid, a.elementtype,"; $sql .= " a.priority, a.fulldayevent, a.location, a.transparency,"; @@ -1161,16 +1154,9 @@ class ActionComm extends CommonObject $this->fk_project = 0; } - // Check parameters - if ($this->percentage == 0 && $this->userdoneid > 0) { - $this->error = "ErrorCantSaveADoneUserWithZeroPercentage"; - return -1; - } - $socid = (($this->socid > 0) ? $this->socid : 0); $contactid = (($this->contact_id > 0) ? $this->contact_id : 0); $userownerid = ($this->userownerid ? $this->userownerid : 0); - $userdoneid = ($this->userdoneid ? $this->userdoneid : 0); // If a type_id is set, we must also have the type_code set if ($this->type_id > 0) { @@ -1208,7 +1194,6 @@ class ActionComm extends CommonObject $sql .= ", transparency = '".$this->db->escape($this->transparency)."'"; $sql .= ", fk_user_mod = ".((int) $user->id); $sql .= ", fk_user_action = ".($userownerid > 0 ? ((int) $userownerid) : "null"); - $sql .= ", fk_user_done = ".($userdoneid > 0 ? ((int) $userdoneid) : "null"); if (!empty($this->fk_element)) { $sql .= ", fk_element=".($this->fk_element ? ((int) $this->fk_element) : "null"); } @@ -1431,7 +1416,7 @@ class ActionComm extends CommonObject } $sql .= " AND a.entity IN (".getEntity('agenda').")"; if (!$user->hasRight('agenda', 'allactions', 'read')) { - $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id); + $sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id); $sql .= " OR ar.fk_element = ".((int) $user->id); $sql .= ")"; } @@ -2003,7 +1988,6 @@ class ActionComm extends CommonObject $buildfile = true; $login = ''; $logina = ''; - $logind = ''; $logint = ''; $eventorganization = ''; @@ -2354,9 +2338,6 @@ class ActionComm extends CommonObject if ($logint) { $more = $langs->transnoentities("ActionsToDoBy").' '.$logint; } - if ($logind) { - $more = $langs->transnoentities("ActionsDoneBy").' '.$logind; - } if ($eventorganization) { $langs->load("eventorganization"); $title = $langs->transnoentities("OrganizedEvent").(empty($eventarray[0]['label']) ? '' : ' '.$eventarray[0]['label']); diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index cf86e744f70..1c8dd2b5b95 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -76,7 +76,7 @@ class ActionCommReminder extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => -1, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), @@ -86,7 +86,7 @@ class ActionCommReminder extends CommonObject 'fk_user' => array('type' => 'integer', 'label' => 'User', 'visible' => -1, 'enabled' => 1, 'position' => 65, 'notnull' => 1, 'index' => 1,), 'offsetvalue' => array('type' => 'integer', 'label' => 'OffsetValue', 'visible' => 1, 'enabled' => 1, 'position' => 56, 'notnull' => 1,), 'offsetunit' => array('type' => 'varchar(1)', 'label' => 'OffsetUnit', 'visible' => 1, 'enabled' => 1, 'position' => 57, 'notnull' => 1, 'comment' => "y, m, d, w, h, i",), - 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 58, 'notnull' => 1, 'default' => 0, 'index' => 0, 'arrayofkeyval' => array('0' => 'ToDo', '1' => 'Done')), + 'status' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 58, 'notnull' => 1, 'default' => '0', 'index' => 0, 'arrayofkeyval' => array('0' => 'ToDo', '1' => 'Done')), 'lasterror' => array('type' => 'varchar(128)', 'label' => 'LastError', 'visible' => -1, 'enabled' => 1, 'position' => 59, 'index' => 0), 'fk_actioncomm' => array('type' => 'integer', 'label' => 'Project', 'visible' => 1, 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'index' => 1,), 'fk_email_template' => array('type' => 'integer', 'label' => 'EmailTemplate', 'visible' => 1, 'enabled' => 1, 'position' => 80, 'notnull' => 0), diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 68e6b4d7169..78c5449ccca 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -302,8 +302,8 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) { 'src' => getDolUserString($source), 'name' => dol_string_nohtmltag(getDolUserString($name)), 'offsettz' => (int) (empty($user->conf->$offsettz) ? 0 : $user->conf->$offsettz), - // @phan-suppress-next-line PhanPluginSuspiciousParamPosition 'color' => dol_string_nohtmltag(getDolUserString($color)), + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition 'default' => dol_string_nohtmltag(getDolUserString($default)), 'buggedfile' => dol_string_nohtmltag(isset($user->conf->buggedfile) ? $user->conf->buggedfile : '') ); @@ -319,10 +319,10 @@ if (empty($mode) || $mode == 'show_month') { $next_year = $next['year']; $next_month = $next['month']; - $max_day_in_prev_month = date("t", dol_mktime(12, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month - $max_day_in_month = date("t", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')); // Nb of days in next month + $max_day_in_prev_month = (int) date("t", dol_mktime(12, 0, 0, $prev_month, 1, $prev_year, 'gmt')); // Nb of days in previous month + $max_day_in_month = (int) date("t", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')); // Nb of days in next month // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday) - $tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday + $tmpday = - (int) date("w", dol_mktime(12, 0, 0, $month, 1, $year, 'gmt')) + 2; // date('w') is 0 for sunday $tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1); if ($tmpday >= 1) { $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week. @@ -550,7 +550,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' //$param='month='.$monthshown.'&year='.$year; $hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } // Define the legend/list of calendard to show diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index eff2e4b3708..408b64c6fc9 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -724,16 +724,13 @@ $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; -//$param='month='.$monthshown.'&year='.$year; -$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation - $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; -$url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; +$url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allactions', 'create')); -$param .= '&mode='.$mode; +$param .= '&mode='.urlencode($mode); print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, is_numeric($nbtotalofrecords) ? -1 * $nbtotalofrecords : $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode); diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 7bb071f036c..990c9af705f 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -480,9 +480,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' $newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; - //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.''.$newcardbutton, '', $limit, 1, 0, 1, $viewmode); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index c191a6c35be..97098383652 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -129,8 +129,8 @@ if ($dateselect > 0) { $tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS') ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); -$begin_h = GETPOSTINT('begin_h') != '' ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9); -$end_h = GETPOSTINT('end_h') ? GETPOSTINT('end_h') : ($tmparray[1] != '' ? $tmparray[1] : 18); +$begin_h = GETPOSTISSET('begin_h') ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9); +$end_h = GETPOSTISSET('end_h') ? GETPOSTINT('end_h') : ($tmparray[1] != '' ? $tmparray[1] : 18); if ($begin_h < 0 || $begin_h > 23) { $begin_h = 9; } @@ -144,8 +144,8 @@ if ($end_h <= $begin_h) { $tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS') ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); -$begin_d = GETPOSTINT('begin_d') ? GETPOSTINT('begin_d') : ($tmparray[0] != '' ? $tmparray[0] : 1); -$end_d = GETPOSTINT('end_d') ? GETPOSTINT('end_d') : ($tmparray[1] != '' ? $tmparray[1] : 5); +$begin_d = GETPOSTISSET('begin_d') ? GETPOSTINT('begin_d') : ($tmparray[0] != '' ? $tmparray[0] : 1); +$end_d = GETPOSTISSET('end_d') ? GETPOSTINT('end_d') : ($tmparray[1] != '' ? $tmparray[1] : 5); if ($begin_d < 1 || $begin_d > 7) { $begin_d = 1; } @@ -496,9 +496,11 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda' $newparam .= '&end_d='.urlencode($end_d); } - //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; - $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); + $urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create'; + $urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; + $urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); + + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction); } $num = ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 559530a6873..d0efa85599e 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -895,10 +895,10 @@ if ($action == 'create') { '; } if ($formmail->withfckeditor) { - $out .= $formmail->getModelEmailTemplate(); + $out .= $formmail->getModelEmailTemplate('bodyemail'); } if ($formmail->withaiprompt && isModEnabled('ai')) { - $out .= $formmail->getSectionForAIPrompt(); + $out .= $formmail->getSectionForAIPrompt('', 'bodyemail'); } print $out; print '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . '' . price($object->total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '' . price($object->multicurrency_total_localtax1, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . '' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_localtax2, 0, $langs, 1, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
'; - $form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); + print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); print '".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")." '; if (isset($decaiss[$case]) && $decaiss[$case] > 0) { diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e871b6dd754..67a067854f1 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -93,8 +93,10 @@ class Account extends CommonObject public $bank; /** - * Status + * Status closed + * * @var int + * @deprecated Duplicate field. We already have the field $this->status */ public $clos = self::STATUS_OPEN; @@ -200,13 +202,6 @@ class Account extends CommonObject */ public $type_lib = array(); - /** - * Array listing all the potential status of an account. - * Defined in __construct - * @var array array: int of the status => translated label of the status - */ - public $status = array(); - /** * Accountancy code * @var string @@ -312,13 +307,13 @@ class Account extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), 'ref' => array('type' => 'varchar(12)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'showoncombobox' => 1, 'position' => 25), 'label' => array('type' => 'varchar(30)', 'label' => 'Label', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 30), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 35, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 35, 'index' => 1), 'bank' => array('type' => 'varchar(60)', 'label' => 'Bank', 'enabled' => 1, 'visible' => -1, 'position' => 40), 'code_banque' => array('type' => 'varchar(128)', 'label' => 'Code banque', 'enabled' => 1, 'visible' => -1, 'position' => 45), 'code_guichet' => array('type' => 'varchar(6)', 'label' => 'Code guichet', 'enabled' => 1, 'visible' => -1, 'position' => 50), @@ -387,17 +382,17 @@ class Account extends CommonObject $this->db = $db; - $this->solde = 0; + $this->balance = 0; $this->type_lib = array( - self::TYPE_SAVINGS => $langs->trans("BankType0"), - self::TYPE_CURRENT => $langs->trans("BankType1"), - self::TYPE_CASH => $langs->trans("BankType2"), + self::TYPE_SAVINGS => $langs->transnoentitiesnoconv("BankType0"), + self::TYPE_CURRENT => $langs->transnoentitiesnoconv("BankType1"), + self::TYPE_CASH => $langs->transnoentitiesnoconv("BankType2"), ); - $this->status = array( - self::STATUS_OPEN => $langs->trans("StatusAccountOpened"), - self::STATUS_CLOSED => $langs->trans("StatusAccountClosed") + $this->labelStatus = array( + self::STATUS_OPEN => $langs->transnoentitiesnoconv("StatusAccountOpened"), + self::STATUS_CLOSED => $langs->transnoentitiesnoconv("StatusAccountClosed") ); } @@ -2744,41 +2739,6 @@ class AccountLine extends CommonObjectLine public function LibStatut($status, $mode = 0) { // phpcs:enable - //global $langs; - - //$langs->load('companies'); - /* - if ($mode == 0) - { - if ($status==0) return $langs->trans("ActivityCeased"); - if ($status==1) return $langs->trans("InActivity"); - } - if ($mode == 1) - { - if ($status==0) return $langs->trans("ActivityCeased"); - if ($status==1) return $langs->trans("InActivity"); - } - if ($mode == 2) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); - } - if ($mode == 3) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); - } - if ($mode == 4) - { - if ($status==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); - if ($status==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); - } - if ($mode == 5) - { - if ($status==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); - if ($status==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); - }*/ - return ''; } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 7e54567fc47..6e3a2f28c67 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -198,7 +198,7 @@ class PaymentVarious extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( // TODO: fill this array diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 90817a5848d..0eeab1735c3 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -614,9 +614,9 @@ if ($id) { $morehtmlref .= ''; $linkback = ''.$langs->trans("BackToList").''; - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 83bafc6aaad..7c717d7ede0 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -128,7 +129,8 @@ if ($object->id) { $morehtmlref .= '
'; $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + $morehtmlstatus = $morehtmlright; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index 80705447223..27a8ce3a27b 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,7 +89,8 @@ if (isModEnabled('project')) { $morehtmlref .= '
'; $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); +$morehtmlstatus = $morehtmlright; +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index fe4d5a15f77..74cce92938d 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García * Copyright (C) 2018 Andreu Bisquerra + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,7 +69,7 @@ if ($contextpage == 'takepos') { $_GET['optioncss'] = 'print'; } -$arrayofpaymentmode = array('cash'=>'Cash', 'cheque'=>'Cheque', 'card'=>'CreditCard'); +$arrayofpaymentmode = array('cash' => 'Cash', 'cheque' => 'Cheque', 'card' => 'CreditCard'); $arrayofposavailable = array(); if (isModEnabled('cashdesk')) { @@ -180,7 +181,7 @@ if ($action == "start") { $db->commit(); $action = "view"; } else { - $db->rollback; + $db->rollback(); $action = "view"; } } diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 83b0a56e563..bf6a7310720 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -8,6 +8,7 @@ * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Andreu Bisquerra + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,13 +60,13 @@ $sortorder = 'ASC'; $sortfield = 'b.datev,b.dateo,b.rowid'; $arrayfields = array( - 'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1), - 'b.num_chq'=>array('label'=>$langs->trans("Number"), 'checked'=>1), - 'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1), - 'cp.code'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), - 'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600), - 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), + 'b.rowid' => array('label' => $langs->trans("Ref"), 'checked' => 1), + 'b.dateo' => array('label' => $langs->trans("DateOperationShort"), 'checked' => 1), + 'b.num_chq' => array('label' => $langs->trans("Number"), 'checked' => 1), + 'ba.ref' => array('label' => $langs->trans("BankAccount"), 'checked' => 1), + 'cp.code' => array('label' => $langs->trans("PaymentMode"), 'checked' => 1), + 'b.debit' => array('label' => $langs->trans("Debit"), 'checked' => 1, 'position' => 600), + 'b.credit' => array('label' => $langs->trans("Credit"), 'checked' => 1, 'position' => 605), ); $syear = $object->year_close; @@ -209,7 +210,7 @@ if ($resql) { $transactionspertype = array(); $amountpertype = array(); - $totalarray = array(); + $totalarray = array('nbfield' => 0, 'pos' => array()); while ($i < $num) { $objp = $db->fetch_object($resql); diff --git a/htdocs/compta/facture/agenda-rec.php b/htdocs/compta/facture/agenda-rec.php index 542dfd8f6c1..3636c91fce7 100644 --- a/htdocs/compta/facture/agenda-rec.php +++ b/htdocs/compta/facture/agenda-rec.php @@ -175,9 +175,9 @@ if ($object->id > 0) { } $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; @@ -211,19 +211,19 @@ if ($object->id > 0) { //$out.=""; } - $morehtmlright = ''; + $morehtmlstatus = ''; //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; - //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$morehtmlstatus .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; - //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + //$morehtmlstatus .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); if (isModEnabled('agenda')) { /* if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + $morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } else { - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); + $morehtmlstatus .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } */ } @@ -245,8 +245,8 @@ if ($object->id > 0) { $cachekey = 'count_events_facture_'.$object->id; $nbEvent = dol_getcache($cachekey); - print_barre_liste($langs->trans("ActionsOnBillRec").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); - //print_barre_liste($langs->trans("ActionsOnBill"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnBillRec").(is_numeric($nbEvent) ? '('.$nbEvent.')' : ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlstatus, '', 0, 1, 1); + //print_barre_liste($langs->trans("ActionsOnBill"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlstatus, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 59318f1a753..3502f31d822 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1282,9 +1282,9 @@ if ($action == 'create') { } $morehtmlref .= '
'; - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 30b7d6e655a..7296c3dd820 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5014,21 +5014,24 @@ if ($action == 'create') { print '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($sign * $object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($sign * $object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($sign * $object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '' . price($sign * $object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '
'.$langs->trans("NoRecordFound").'
"; print ""; print "
"; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 21fa04cc931..daa017a0130 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -3,6 +3,7 @@ * Copyright (C) 2016-2022 Alexandre Spangaro * Copyright (C) 2018-2020 Laurent Destailleur * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -260,12 +261,12 @@ print ''.$langs->trans("PreviousPeriod").''; print ''.$langs->trans("SelectedPeriod").''; foreach ($months as $k => $v) { if (($k + 1) >= $date_startmonth && $k < $date_endmonth) { - print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).''; + print ''.$langs->trans('MonthShort'.sprintf("%02d", ($k + 1))).''; } } foreach ($months as $k => $v) { if (($k + 1) < $date_startmonth) { - print ''.$langs->trans('MonthShort'.sprintf("%02s", ($k + 1))).''; + print ''.$langs->trans('MonthShort'.sprintf("%02d", ($k + 1))).''; } } print ''; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index b08bcacfc9a..d91ce98999e 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -406,8 +406,8 @@ class ChargeSociales extends CommonObject /** * Calculate amount remaining to pay by year * - * @param int $year Year - * @return number + * @param int $year Year + * @return int|float Returns -1 when error (Note: could be mistaken with an amount) */ public function solde($year = 0) { diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 2a724f56d42..6d552f245f9 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2022 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,12 +83,19 @@ class PaymentSocialContribution extends CommonObject public $bank_line; /** - * @deprecated + * @deprecated Use $amount instead. * @see $amount + * @var float|int */ public $total; + /** + * @var float|int + */ public $amount; // Total amount of payment + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -97,7 +105,7 @@ class PaymentSocialContribution extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $num_payment instead * @see $num_payment */ public $num_paiement; @@ -178,7 +186,7 @@ class PaymentSocialContribution extends CommonObject $this->fk_charge = (int) $this->fk_charge; } if (isset($this->amount)) { - $this->amount = trim($this->amount); + $this->amount = (float) $this->amount; } if (isset($this->fk_typepaiement)) { $this->fk_typepaiement = (int) $this->fk_typepaiement; @@ -318,8 +326,10 @@ class PaymentSocialContribution extends CommonObject $this->tms = $this->db->jdate($obj->tms); $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; + $this->total = $obj->amount; $this->fk_typepaiement = $obj->fk_typepaiement; $this->num_payment = $obj->num_payment; + $this->num_paiement = $obj->num_payment; $this->note_private = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; @@ -577,7 +587,7 @@ class PaymentSocialContribution extends CommonObject $acc = new Account($this->db); $acc->fetch($accountid); - $total = $this->total; + $total = $this->amount; if ($mode == 'payment_sc') { $total = -$total; } diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index c66056c47ca..0666335cc4d 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -142,9 +142,9 @@ if ($object->id) { $object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index 24181ae4b7b..e6ad4953129 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -111,8 +111,8 @@ $linkback = ''; print '
'; diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php index 2f5487497f6..53c6fe187e6 100644 --- a/htdocs/compta/sociales/note.php +++ b/htdocs/compta/sociales/note.php @@ -116,9 +116,9 @@ if ($id > 0 || !empty($ref)) { //$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index d3f0886eae9..863eb956f33 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2015-2023 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -179,7 +179,7 @@ if (empty($reshook)) { $object->datev = $datev; $object->datep = $datep; - $amount = price2num(GETPOST("amount", 'alpha')); + $amount = (float) price2num(GETPOST("amount", 'alpha')); if ($refund == 1) { $amount = price2num(-1 * $amount); } diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index f45cc80e909..1c72b1ff444 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,12 +59,20 @@ class PaymentVAT extends CommonObject public $datep = ''; /** - * @deprecated + * @deprecated Use $amount instead * @see $amount + * @var float|int */ public $total; + /** + * @var float|int + */ public $amount; // Total amount of payment + + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -73,7 +82,7 @@ class PaymentVAT extends CommonObject /** * @var string - * @deprecated + * @deprecated Use $num_payment instead * @see $num_payment */ public $num_paiement; @@ -539,12 +548,12 @@ class PaymentVAT extends CommonObject $this->fk_tva = 0; $this->datec = dol_now(); $this->tms = dol_now(); - $this->datep = ''; - $this->amount = ''; + $this->datep = dol_now(); + $this->amount = 100; $this->fk_typepaiement = 0; - $this->num_payment = ''; - $this->note_private = ''; - $this->note_public = ''; + $this->num_payment = '123456'; + $this->note_private = 'Private note'; + $this->note_public = 'Public note'; $this->fk_bank = 0; $this->fk_user_creat = 0; $this->fk_user_modif = 0; @@ -578,7 +587,7 @@ class PaymentVAT extends CommonObject $acc = new Account($this->db); $acc->fetch($accountid); - $total = $this->total; + $total = $this->amount; if ($mode == 'payment_vat') { $total = -$total; } diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index f2670861833..b9cf49d5dff 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -126,8 +126,8 @@ if ($object->id) { $linkback = ''.$langs->trans("BackToList").''; - $morehtmlright = ''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + $morehtmlstatus = ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a7b38cc85c7..1a11ac4f65a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -52,7 +52,8 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'users', 'other', 'commercial')); -$mesg = ''; $error = 0; $errors = array(); +$error = 0; +$errors = array(); // Get parameters $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9b204deacf1..1c800456b76 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -98,11 +98,11 @@ class Contact extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'noteditable' => 1, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id', 'css' => 'left'), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 30, 'index' => 1), 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 3, 'position' => 35), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => 3, 'position' => 40), 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => 1, 'position' => 45, 'showoncombobox' => 1, 'searchall' => 1), @@ -604,7 +604,7 @@ class Contact extends CommonObject $this->fax = trim($this->fax); $this->zip = (empty($this->zip) ? '' : trim($this->zip)); $this->town = (empty($this->town) ? '' : trim($this->town)); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + $this->country_id = (empty($this->country_id) || $this->country_id < 0) ? 0 : $this->country_id; if (empty($this->statut)) { $this->statut = 0; } diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index a8434eff2d9..08e8e248d7e 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2020 Tobias Sekan + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,6 +68,7 @@ $v->setPhoneNumber($contact->fax, "TYPE=WORK;FAX"); $country = $contact->country_code ? $contact->country : ''; $v->setAddress("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK;POSTAL"); +// @phan-suppress-next-line PhanDeprecatedFunction setLabel applies the old method, setAddress is the new method. $v->setLabel("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK"); $v->setEmail($contact->email); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index bc9964d2d33..6110150e731 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -184,6 +184,12 @@ class Contrat extends CommonObject */ public $date_contrat; + /** + * Status of the contract (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll) + * @var int + */ + public $signed_status = 0; + public $commercial_signature_id; public $fk_commercial_signature; public $commercial_suivi_id; @@ -243,7 +249,7 @@ class Contrat extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), @@ -251,10 +257,11 @@ class Contrat extends CommonObject 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'ref_customer' => array('type' => 'varchar(50)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 25, 'searchall' => 1), 'ref_supplier' => array('type' => 'varchar(50)', 'label' => 'RefSupplier', 'enabled' => 1, 'visible' => -1, 'position' => 26, 'searchall' => 1), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 40), 'date_contrat' => array('type' => 'datetime', 'label' => 'Date contrat', 'enabled' => 1, 'visible' => -1, 'position' => 45), + 'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 50, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 9 => 'SignedAll')), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 70), 'fk_projet' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'visible' => -1, 'position' => 75), 'fk_commercial_signature' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative Signature', 'enabled' => 1, 'visible' => -1, 'position' => 80), @@ -275,6 +282,25 @@ class Contrat extends CommonObject const STATUS_VALIDATED = 1; const STATUS_CLOSED = 2; + /* + * No signature + */ + const STATUS_NO_SIGNATURE = 0; + + /* + * Signed by sender + */ + const STATUS_SIGNED_SENDER = 1; + + /* + * Signed by receiver + */ + const STATUS_SIGNED_RECEIVER = 2; + + /* + * Signed by all + */ + const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) /** @@ -1657,7 +1683,7 @@ class Contrat extends CommonObject $contractline->id = $contractlineid; $result = $contractline->insertExtraFields(); if ($result < 0) { - $this->error[] = $contractline->error; + $this->errors[] = $contractline->error; $error++; } } @@ -1851,7 +1877,7 @@ class Contrat extends CommonObject $result = $contractline->insertExtraFields(); if ($result < 0) { - $this->error[] = $contractline->error; + $this->errors[] = $contractline->error; $error++; } } @@ -2953,6 +2979,22 @@ class Contrat extends CommonObject $return .= '
'; return $return; } + + // @Todo getLibSignedStatus, LibSignedStatus + + /** + * Set signed status + * + * @param User $user Object user that modify + * @param int $status Newsigned status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers + * @param string $triggercode Trigger code to use + * @return int 0 < if KO, > 0 if OK + */ + public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int + { + return $this->setSignedStatusCommon($user, $status, $notrigger, $triggercode); + } } @@ -3106,11 +3148,11 @@ class ContratLigne extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35), 'qty' => array('type' => 'integer', 'label' => 'Quantity', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 35, 'isameasure' => 1), 'total_ht' => array('type' => 'integer', 'label' => 'AmountHT', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 36, 'isameasure' => 1), @@ -3129,7 +3171,7 @@ class ContratLigne extends CommonObjectLine 'fk_user_ouverture' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserStartingService', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), 'fk_user_cloture' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserClosingService', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135), 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'position' => 500, 'arrayofkeyval' => array(0 => 'Draft', 4 => 'Open', 5 => 'Closed')), - 'rang' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'position' => 500, 'default' => 0) + 'rang' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'visible' => 0, 'position' => 500, 'default' => '0') ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/contrat/ticket.php b/htdocs/contrat/ticket.php index 7c7cce00982..a4b37e28f71 100644 --- a/htdocs/contrat/ticket.php +++ b/htdocs/contrat/ticket.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2012-2023 Charlene BENKE + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,10 +38,10 @@ require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php"; $langs->loadLangs(array('companies', 'contracts', 'tickets')); -$socid=GETPOSTINT('socid'); -$id=GETPOSTINT('id'); -$ref=GETPOST('ref', 'alpha'); -$action=GETPOST('action', 'alpha'); +$socid = GETPOSTINT('socid'); +$id = GETPOSTINT('id'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); if ($id == '' && $ref == '') { dol_print_error(null, 'Bad parameter'); @@ -48,12 +49,12 @@ if ($id == '' && $ref == '') { } // Security check -$socid=0; +$socid = 0; if ($user->socid > 0) { - $socid=$user->socid; + $socid = $user->socid; } -$result=restrictedArea($user, 'contrat', $id); +$result = restrictedArea($user, 'contrat', $id); /* @@ -63,25 +64,25 @@ $result=restrictedArea($user, 'contrat', $id); llxHeader("", $langs->trans("Tickets"), "Contrat"); $form = new Form($db); -$userstatic=new User($db); +$userstatic = new User($db); -$object= new Contrat($db); -$result=$object->fetch($id, $ref); -$ret=$object->fetch_thirdparty(); +$object = new Contrat($db); +$result = $object->fetch($id, $ref); +$ret = $object->fetch_thirdparty(); $head = contract_prepare_head($object); -dol_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract'); +dol_get_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract'); $linkback = ''; -$linkback.= $langs->trans("BackToList").''; +$linkback .= $langs->trans("BackToList").''; -$morehtmlref=''; -$morehtmlref.=$object->ref; +$morehtmlref = ''; +$morehtmlref .= $object->ref; -$morehtmlref.='
'; +$morehtmlref .= '
'; // Ref customer -$morehtmlref.=$form->editfieldkey( +$morehtmlref .= $form->editfieldkey( "RefCustomer", 'ref_customer', $object->ref_customer, @@ -92,7 +93,7 @@ $morehtmlref.=$form->editfieldkey( 0, 1 ); -$morehtmlref.=$form->editfieldval( +$morehtmlref .= $form->editfieldval( "RefCustomer", 'ref_customer', $object->ref_customer, @@ -106,8 +107,8 @@ $morehtmlref.=$form->editfieldval( 1 ); // Ref supplier -$morehtmlref.='
'; -$morehtmlref.=$form->editfieldkey( +$morehtmlref .= '
'; +$morehtmlref .= $form->editfieldkey( "RefSupplier", 'ref_supplier', $object->ref_supplier, @@ -118,7 +119,7 @@ $morehtmlref.=$form->editfieldkey( 0, 1 ); -$morehtmlref.=$form->editfieldval( +$morehtmlref .= $form->editfieldval( "RefSupplier", 'ref_supplier', $object->ref_supplier, @@ -132,25 +133,25 @@ $morehtmlref.=$form->editfieldval( 1 ); // Thirdparty -$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); +$morehtmlref .= '
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' : '; + $morehtmlref .= '
'.$langs->trans('Project') . ' : '; if (! empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; } else { - $morehtmlref.=''; + $morehtmlref .= ''; } } -$morehtmlref.='
'; +$morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref); @@ -161,7 +162,7 @@ print '
'; * Referrers types */ -$title=$langs->trans("ListTicketsLinkToContract"); +$title = $langs->trans("ListTicketsLinkToContract"); print ''; print ''; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 9649ef6252c..382cb71fca4 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1040,6 +1040,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' $objecttmp = new $objectclass($db); $nbok = 0; + $nbignored = 0; $TMsg = array(); //$toselect could contain duplicate entries, cf https://github.com/Dolibarr/dolibarr/issues/26244 @@ -1200,6 +1201,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) { } if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd) { + $nbok = 0; $db->begin(); $affecttag_type = GETPOST('affecttag_type', 'alpha'); @@ -1221,7 +1223,6 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd } //For each valid categ type set common categ - $nbok = 0; if (!empty($to_affecttag_type_array)) { foreach ($to_affecttag_type_array as $categ_type) { $contcats = GETPOST('contcats_' . $categ_type, 'array'); @@ -1256,6 +1257,7 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd } if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoadd) { + $nbok = 0; $db->begin(); if (GETPOSTISSET('pricerate')) { $pricepercentage = GETPOSTINT('pricerate'); @@ -1300,6 +1302,7 @@ if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoa } if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiontoadd) { + $nbok = 0; $db->begin(); $supervisortoset = GETPOST('supervisortoset'); if (!empty($supervisortoset)) { @@ -1335,6 +1338,7 @@ if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiont } if (!$error && ($action == 'affectuser' && $confirm == 'yes') && $permissiontoadd) { + $nbok = 0; $db->begin(); $usertoaffect = GETPOST('usertoaffect'); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 2a5dc287f2b..58a877cca75 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -29,6 +30,10 @@ // $triggersendname must be set (can be '') // $actiontypecode can be set // $object and $uobject may be defined +' +@phan-var-force Societe $mysoc +@phan-var-force CommonObject $object +'; /* * Add file in email form @@ -357,7 +362,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $substitutionarray['__EMAIL__'] = $sendto; $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; - $parameters = array('mode'=>'formemail'); + $parameters = array('mode' => 'formemail'); complete_substitutions_array($substitutionarray, $langs, $object, $parameters); $subject = make_substitutions($subject, $substitutionarray); diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 680e46a244c..8161f22d703 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -218,6 +219,7 @@ if (empty($conf->use_javascript_ajax) || getDolGlobalString('MAIN_ECM_DISABLE_JS // We removed all expanded sections that are child of the closed section $oldexpandedsectionarray = $expandedsectionarray; $expandedsectionarray = array(); // Reset + // @phan-suppress-next-line PhanEmptyForeachBody foreach ($oldexpandedsectionarray as $sectioncursor) { // TODO is_in_subtree(fulltree,sectionparent,sectionchild) does nox exists. Enable or remove this... //if ($sectioncursor && ! is_in_subtree($sqltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index c3cfdf85fca..ac4f4c0da39 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -81,19 +81,20 @@ class CMailFile */ public $errors = array(); - public $smtps; // Contains SMTPs object (if this method is used) - public $phpmailer; // Contains PHPMailer object (if this method is used) + + /** + * @var SMTPS (if this method is used) + */ + public $smtps; + /** + * @var Swift_Mailer (if the method is used) + */ + public $mailer; /** * @var Swift_SmtpTransport */ public $transport; - - /** - * @var Swift_Mailer - */ - public $mailer; - /** * @var Swift_Plugins_Loggers_ArrayLogger */ @@ -108,9 +109,13 @@ class CMailFile //! Defined background directly in body tag public $bodyCSS; + /** + * @var string Message-ID of the email to send (generated) + */ public $msgid; public $headers; public $message; + /** * @var array fullfilenames list (full path of filename on file system) */ @@ -198,7 +203,7 @@ class CMailFile } } if (empty($this->sendmode)) { - $this->sendmode = (getDolGlobalString('MAIN_MAIL_SENDMODE') ? $conf->global->MAIN_MAIL_SENDMODE : 'mail'); + $this->sendmode = getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'); } // Add a Feedback-ID. Must be used for stats on spam report only. @@ -579,12 +584,15 @@ class CMailFile //$this->message = new Swift_SignedMessage(); // Adding a trackid header to a message $headers = $this->message->getHeaders(); + $headers->addTextHeader('X-Dolibarr-TRACKID', $this->trackid.'@'.$host); $this->msgid = time().'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host; $headerID = $this->msgid; $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); - $headers->addIdHeader('References', $headerID); + + // Add 'References:' header + //$headers->addIdHeader('References', $headerID); if (!empty($moreinheader)) { $moreinheaderarray = preg_split('/[\r\n]+/', $moreinheader); @@ -727,7 +735,6 @@ class CMailFile } } - /** * Send mail that was prepared by constructor. * @@ -1536,7 +1543,7 @@ class CMailFile // References is kept in response and Message-ID is returned into In-Reply-To: $this->msgid = time().'.phpmail-dolibarr-'.$trackid.'@'.$host; $out .= 'Message-ID: <'.$this->msgid.">".$this->eol2; // Uppercase seems replaced by phpmail - $out .= 'References: <'.$this->msgid.">".$this->eol2; + //$out .= 'References: <'.$this->msgid.">".$this->eol2; $out .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host.$this->eol2; } else { $this->msgid = time().'.phpmail@'.$host; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index b80ce304f94..251442a9b72 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -5,8 +5,9 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Marcos García * Copyright (C) 2016-2023 Charlene Benke - * Copyright (C) 2018-2023 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Josep Lluís Amador + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -232,6 +233,9 @@ abstract class CommonDocGenerator ); // Retrieve extrafields if (is_array($user->array_options) && count($user->array_options)) { + if (empty($extrafields->attributes[$user->table_element])) { + $extrafields->fetch_name_optionals_label($user->table_element); + } $array_user = $this->fill_substitutionarray_with_extrafields($user, $array_user, $extrafields, 'myuser', $outputlangs); } return $array_user; @@ -1488,9 +1492,17 @@ abstract class CommonDocGenerator if (!empty($fields)) { // Sort extrafields by rank - uasort($fields, function ($a, $b) { - return ($a->rank > $b->rank) ? 1 : -1; - }); + uasort( + $fields, + /** + * @param stdClass $a + * @param stdClass $b + * @return int<-1,1> + */ + static function ($a, $b) { + return ($a->rank > $b->rank) ? 1 : -1; + } + ); // define some HTML content with style $html .= !empty($params['style']) ? '' : ''; diff --git a/htdocs/core/class/commonnumrefgenerator.class.php b/htdocs/core/class/commonnumrefgenerator.class.php index 60104d09cd7..264a5417771 100644 --- a/htdocs/core/class/commonnumrefgenerator.class.php +++ b/htdocs/core/class/commonnumrefgenerator.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,7 +89,7 @@ abstract class CommonNumRefGenerator * * @param Translate $langs Object langs * @return string Model name - * @deprecated + * @deprecated Use getName() instead * @see getName() */ public function getNom($langs) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7dc6bb7f5c0..07dfa7db829 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -140,7 +140,7 @@ abstract class CommonObject /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -226,13 +226,13 @@ abstract class CommonObject /** * @var Project The related project object - * @deprecated - * @see project + * @deprecated Use $project instead + * @see $project */ public $projet; /** - * @deprecated + * @deprecated Use $fk_project instead * @see $fk_project */ public $fk_projet; @@ -274,13 +274,13 @@ abstract class CommonObject public $origin_id; /** - * @var Object Origin object. This is set by fetch_origin() from this->origin and this->origin_id. + * @var ?CommonObject Origin object. This is set by fetch_origin() from this->origin and this->origin_id. */ public $origin_object; /** - * @var string|CommonObject Sometime the type of the originating object ('commande', 'facture', ...), sometime the object (like onh MouvementStock) - * @deprecated Use now $origin_type and $origin_id; + * @var CommonObject|string|null Sometimes the type of the originating object ('commande', 'facture', ...), sometimes the object (as with MouvementStock) + * @deprecated Use now $origin_type and $origin_id; * @see fetch_origin() */ public $origin; @@ -322,7 +322,7 @@ abstract class CommonObject /** * @var int The object's status. Use status instead. - * @deprecated + * @deprecated Use $status instead * @see setStatut() */ public $statut; @@ -369,7 +369,7 @@ abstract class CommonObject /** * var int State ID - * @deprecated Use state_id. We can remove this property when the field 'fk_departement' have been renamed into 'state_id' in all tables + * @deprecated Use $state_id. We can remove this property when the field 'fk_departement' have been renamed into 'state_id' in all tables */ public $fk_departement; @@ -447,7 +447,7 @@ abstract class CommonObject /** * @var int Payment terms ID - * @deprecated Kept for compatibility + * @deprecated Use $cond_reglement_id instead - Kept for compatibility * @see cond_reglement_id; */ public $cond_reglement; @@ -504,6 +504,16 @@ abstract class CommonObject */ public $multicurrency_total_ttc; + /** + * @var float Multicurrency total localta1 + */ + public $multicurrency_total_localtax1; // not in database + + /** + * @var float Multicurrency total localtax2 + */ + public $multicurrency_total_localtax2; // not in database + /** * @var string * @see SetDocModel() @@ -720,13 +730,13 @@ abstract class CommonObject public $specimen = 0; /** - * @var int Id of contact to send object (used by the trigger of module Agenda) + * @var int[] Id of contacts to send objects (mails, etc.) */ public $sendtoid; /** * @var float Amount already paid from getSommePaiement() (used to show correct status) - * @deprecated Duplicate of $totalpaid + * @deprecated Use $totalpaid instead */ public $alreadypaid; /** @@ -8867,7 +8877,7 @@ abstract class CommonObject /** * Returns the rights used for this class * - * @return int|stdClass Object of permission for the module + * @return null|int|stdClass Object of permission for the module */ public function getRights() { @@ -9697,6 +9707,7 @@ abstract class CommonObject foreach ($fieldvalues as $k => $v) { $keys[$k] = $k; $value = $this->fields[$k]; + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $values[$k] = $this->quote($v, $value); // May return string 'NULL' if $value is null } @@ -9999,7 +10010,9 @@ abstract class CommonObject foreach ($fieldvalues as $k => $v) { $keys[$k] = $k; $value = $this->fields[$k]; + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $values[$k] = $this->quote($v, $value); + // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $tmp[] = $k.'='.$this->quote($v, $this->fields[$k]); } @@ -10376,6 +10389,55 @@ abstract class CommonObject } } + /** + * Set to a signed status + * + * @param User $user Object user that modify + * @param int $status New status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @param string $triggercode Trigger code to use + * @return int Return integer <0 if KO, >0 if OK + */ + public function setSignedStatusCommon($user, $status, $notrigger = 0, $triggercode = '') + { + $error = 0; + + $this->db->begin(); + + $statusfield = 'signed_status'; + + $sql = "UPDATE ".$this->db->prefix().$this->table_element; + $sql .= " SET ".$statusfield." = ".((int) $status); + $sql .= " WHERE rowid = ".((int) $this->id); + + if ($this->db->query($sql)) { + if (!$error) { + $this->oldcopy = clone $this; + } + + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger($triggercode, $user); + if ($result < 0) { + $error++; + } + } + + if (!$error) { + $this->status = $status; + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return -1; + } + } else { + $this->error = $this->db->error(); + $this->db->rollback(); + return -1; + } + } + /** * Initialise object with example values diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index de216b0c47c..9a47a8843e8 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -87,11 +87,11 @@ class DefaultValues extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'type' => array('type' => 'varchar(10)', 'label' => 'Type', 'enabled' => 1, 'visible' => -1, 'position' => 20), 'user_id' => array('type' => 'integer', 'label' => 'Userid', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 25), 'page' => array('type' => 'varchar(255)', 'label' => 'RelativeURL', 'enabled' => 1, 'visible' => -1, 'position' => 30), diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index dc7dc9a278e..bd4a8b48c74 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2021 Gaëtan MAISON + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -200,7 +201,7 @@ class DolEditor htmlEncodeOutput: '.dol_escape_js($htmlencode_force).', allowedContent: '.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is own when allowedContent is false */ extraAllowedContent: \'a[target];div{float,display}\', /* Add the style float and display into div to default other allowed tags */ - disallowedContent: '.($disallowAnyContent ? '\'\'' : '\'\'').', /* Tags that are not allowed */ + disallowedContent: \'\', /* Tags that are not allowed */ fullPage: '.($fullpage ? 'true' : 'false').', /* if true, the html, header and body tags are kept */ toolbar: \''.dol_escape_js($this->toolbarname).'\', toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').', @@ -280,8 +281,8 @@ class DolEditor $out .= ' diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 04d75f0e844..c6cf8c6365e 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2018 Laurent Destailleur * Copyright (C) 2012-2021 Regis Houssin * Copyright (C) 2018-2023 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,7 @@ if ($action == 'delete') { $title = ''.$langs->trans("DefineHereComplementaryAttributes", empty($textobject) ? '' : $textobject).'
'."\n"; //if ($action != 'create' && $action != 'edit') { $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('NewAttribute'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=create', '', (($action != 'create' && $action != 'edit') ? 1 : 1)); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewAttribute'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=create', '', 1); /*} else { $newcardbutton = ''; }*/ diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 225707f0828..a4c13f5cd4f 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 Frédéric France */ /* * @@ -274,7 +275,7 @@ if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { $socstatic = new Societe($db); $elementtype = $socstatic->table_element; // fetch optionals attributes and labels - dol_include_once('/core/class/extrafields.class.php'); + require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype); foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) { diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index b2072e48eed..eb0c48e27c3 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -204,7 +204,7 @@ if ($disablenofollow) { } ?> -" name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" autofocus="autofocus" /> +" name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" autofocus="autofocus" autocapitalize="off" autocomplete="on" spellcheck="false" autocorrect="off" /> diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 7a190498efe..188e3099f6c 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -150,7 +150,7 @@ if (!empty($disablenofollow)) {
-" id="username" name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" /> +" id="username" name="username" class="flat input-icon-user minwidth150" value="" tabindex="1" autocapitalize="off" autocomplete="on" spellcheck="false" autocorrect="off" />
diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index d42c2c92264..5dc15c83cce 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -226,6 +226,7 @@ class InterfaceStripe extends DolibarrTriggers dol_syslog("We got the customer, so now we update the credit card", LOG_DEBUG); $card = $stripe->cardStripe($customer, $object, $stripeacc, $servicestatus); if ($card) { + // @phan-suppress-next-line PhanTypeMismatchPropertyProbablyReal $card->metadata = array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])); try { $card->save(); diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 9a340050d22..4708d12e929 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -263,3 +263,22 @@ if (!defined('USEDOLIBARREDITOR') && empty($website->status)) { print '


'.$weblangs->trans("SorryWebsiteIsCurrentlyOffLine").'
'; exit; } + + +// Get session info and obfuscate session cookie and other variables +$prefix = dol_getprefix(''); +$sessionname = 'DOLSESSID_'.$prefix; +//$savsessionid = $_COOKIE[$sessionname]; + +$_COOKIE[$sessionname] = 'obfuscatedcookie'; +unset($conf->file->instance_unique_id); + +unset($dolibarr_main_instance_unique_id); +unset($dolibarr_main_db_host); +unset($dolibarr_main_db_port); +unset($dolibarr_main_db_name); +unset($dolibarr_main_db_user); +unset($dolibarr_main_db_pass); +unset($$dolibarr_main_db_type); +unset($dolibarr_main_document_root); +unset($dolibarr_main_document_root_alt); diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 621de20afa6..a761b7ffd4a 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1297,7 +1297,7 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs START ".$this->objectname."->".$this->methodename."(".$this->params."); (Note: Log for cron jobs may be into a different log file)", LOG_DEBUG); // Create Object for the called module - $nameofclass = $this->objectname; + $nameofclass = (string) $this->objectname; $object = new $nameofclass($this->db); if ($this->entity > 0) { $object->entity = $this->entity; // We work on a dedicated entity diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 8aa30543b4a..4e14d503f1e 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013-2021 Laurent Destailleur * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -379,8 +380,8 @@ if ($action == 'delete' && empty($toselect)) { // Used when we make a delete on $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'enable'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("CronStatusActiveBtn"), - 'disable'=>img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans("CronStatusInactiveBtn"), + 'enable' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("CronStatusActiveBtn"), + 'disable' => img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans("CronStatusInactiveBtn"), ); if ($user->hasRight('cron', 'delete')) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); @@ -471,7 +472,7 @@ print '
'; print ''; print ''; print ''; // Action column @@ -607,9 +608,9 @@ if ($num > 0) { $s = ''; if ($obj->unitfrequency == "60") { - $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('MinuteShort') : $langs->trans('MinuteShort')); + $s = ($obj->frequency)." ".$langs->trans('MinuteShort'); } elseif ($obj->unitfrequency == "3600") { - $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('HourShort') : $langs->trans('HourShort')); + $s = ($obj->frequency)." ".$langs->trans('HourShort'); } elseif ($obj->unitfrequency == "86400") { $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('DurationDays') : $langs->trans('DurationDay')); } elseif ($obj->unitfrequency == "604800") { @@ -659,7 +660,7 @@ if ($num > 0) { print ''; diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php index de7ec5c5b50..aa76563c82e 100644 --- a/htdocs/datapolicy/admin/setup.php +++ b/htdocs/datapolicy/admin/setup.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2024 MDW * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,24 +37,24 @@ $backtopage = GETPOST('backtopage', 'alpha'); $arrayofparameters = array(); $arrayofparameters['ThirdParty'] = array( - 'DATAPOLICY_TIERS_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), - 'DATAPOLICY_TIERS_PROSPECT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), - 'DATAPOLICY_TIERS_PROSPECT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), - 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'company', 'class="pictofixedwidth"')), - 'DATAPOLICY_TIERS_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'supplier', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_CLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_PROSPECT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_PROSPECT_CLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'company', 'class="pictofixedwidth"')), + 'DATAPOLICY_TIERS_FOURNISSEUR' => array('css' => 'minwidth200', 'picto' => img_picto('', 'supplier', 'class="pictofixedwidth"')), ); if (getDolGlobalString('DATAPOLICY_USE_SPECIFIC_DELAY_FOR_CONTACT')) { $arrayofparameters['Contact'] = array( - 'DATAPOLICY_CONTACT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), - 'DATAPOLICY_CONTACT_PROSPECT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), - 'DATAPOLICY_CONTACT_PROSPECT_CLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), - 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), - 'DATAPOLICY_CONTACT_FOURNISSEUR'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_CLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_PROSPECT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_PROSPECT_CLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), + 'DATAPOLICY_CONTACT_FOURNISSEUR' => array('css' => 'minwidth200', 'picto' => img_picto('', 'contact', 'class="pictofixedwidth"')), ); } if (isModEnabled('member')) { $arrayofparameters['Member'] = array( - 'DATAPOLICY_ADHERENT'=>array('css'=>'minwidth200', 'picto'=>img_picto('', 'member', 'class="pictofixedwidth"')), + 'DATAPOLICY_ADHERENT' => array('css' => 'minwidth200', 'picto' => img_picto('', 'member', 'class="pictofixedwidth"')), ); } @@ -79,15 +80,16 @@ if (!$user->admin) { } +'@phan-var-force array> $arrayofparameters'; + /* * Actions */ - foreach ($arrayofparameters as $title => $tab) { foreach ($tab as $key => $val) { // Modify constant only if key was posted (avoid resetting key to the null value) if (GETPOSTISSET($key)) { - if (preg_match('/category:/', $val['type'])) { + if (preg_match('/category:/', (string) $val['type'])) { if (GETPOSTINT($key) == '-1') { $val_const = ''; } else { diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index f4fad036d8d..5efb5016c6c 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,69 +93,76 @@ $tmpDir = $conf->dav->multidir_output[$entity]; // We need root dir, not a dir t // Authentication callback function -$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password) { - global $user, $conf; - global $dolibarr_main_authentication, $dolibarr_auto_user; +$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack( + /** + * @param string $username Username to validate as a login + * @param string $password Password to validate for $username + * @return true True if login ok, false if not + */ + static function ($username, $password) { + global $user, $conf; + global $dolibarr_main_authentication, $dolibarr_auto_user; - if (empty($user->login)) { - dol_syslog("Failed to authenticate to DAV, login is not provided", LOG_WARNING); - return false; - } - if ($user->socid > 0) { - dol_syslog("Failed to authenticate to DAV, user is an external user", LOG_WARNING); - return false; - } - if ($user->login != $username) { - dol_syslog("Failed to authenticate to DAV, login does not match the login of loaded user", LOG_WARNING); - return false; - } - - // Authentication mode - if (empty($dolibarr_main_authentication)) { - $dolibarr_main_authentication = 'dolibarr'; - } - - // Authentication mode: forceuser - if ($dolibarr_main_authentication == 'forceuser') { - if (empty($dolibarr_auto_user)) { - $dolibarr_auto_user = 'auto'; - } - if ($dolibarr_auto_user != $username) { - dol_syslog("Warning: your instance is set to use the automatic forced login '".$dolibarr_auto_user."' that is not the requested login. DAV usage is forbidden in this mode."); + if (empty($user->login)) { + dol_syslog("Failed to authenticate to DAV, login is not provided", LOG_WARNING); return false; } + if ($user->socid > 0) { + dol_syslog("Failed to authenticate to DAV, user is an external user", LOG_WARNING); + return false; + } + if ($user->login != $username) { + dol_syslog("Failed to authenticate to DAV, login does not match the login of loaded user", LOG_WARNING); + return false; + } + + // Authentication mode + if (empty($dolibarr_main_authentication)) { + $dolibarr_main_authentication = 'dolibarr'; + } + + // Authentication mode: forceuser + if ($dolibarr_main_authentication == 'forceuser') { + if (empty($dolibarr_auto_user)) { + $dolibarr_auto_user = 'auto'; + } + if ($dolibarr_auto_user != $username) { + dol_syslog("Warning: your instance is set to use the automatic forced login '".$dolibarr_auto_user."' that is not the requested login. DAV usage is forbidden in this mode."); + return false; + } + } + + $authmode = explode(',', $dolibarr_main_authentication); + $entity = (GETPOSTINT('entity') ? GETPOSTINT('entity') : (!empty($conf->entity) ? $conf->entity : 1)); + + if (checkLoginPassEntity($username, $password, $entity, $authmode, 'dav') != $username) { + return false; + } + + // Check if user status is enabled + if ($user->statut != $user::STATUS_ENABLED) { + // Status is disabled + dol_syslog("The user has been disabled."); + return false; + } + + // Check if session was unvalidated by a password change + if (($user->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION["dol_logindate"])) { + // Session is no more valid + dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions."); + return false; + } + + // Check date validity + if ($user->isNotIntoValidityDateRange()) { + // User validity dates are no more valid + dol_syslog("The user login has a validity between [".$user->datestartvalidity." and ".$user->dateendvalidity."], current date is ".dol_now()); + return false; + } + + return true; } - - $authmode = explode(',', $dolibarr_main_authentication); - $entity = (GETPOSTINT('entity') ? GETPOSTINT('entity') : (!empty($conf->entity) ? $conf->entity : 1)); - - if (checkLoginPassEntity($username, $password, $entity, $authmode, 'dav') != $username) { - return false; - } - - // Check if user status is enabled - if ($user->statut != $user::STATUS_ENABLED) { - // Status is disabled - dol_syslog("The user has been disabled."); - return false; - } - - // Check if session was unvalidated by a password change - if (($user->flagdelsessionsbefore && !empty($_SESSION["dol_logindate"]) && $user->flagdelsessionsbefore > $_SESSION["dol_logindate"])) { - // Session is no more valid - dol_syslog("The user has a date for session invalidation = ".$user->flagdelsessionsbefore." and a session date = ".$_SESSION["dol_logindate"].". We must invalidate its sessions."); - return false; - } - - // Check date validity - if ($user->isNotIntoValidityDateRange()) { - // User validity dates are no more valid - dol_syslog("The user login has a validity between [".$user->datestartvalidity." and ".$user->dateendvalidity."], current date is ".dol_now()); - return false; - } - - return true; -}); +); $authBackend->setRealm(constant('DOL_APPLICATION_TITLE').' - WebDAV'); @@ -211,7 +219,7 @@ if (isset($baseUri)) { if ((!getDolGlobalString('DAV_ALLOW_PUBLIC_DIR') || !preg_match('/'.preg_quote(DOL_URL_ROOT.'/dav/fileserver.php/public', '/').'/', $_SERVER["PHP_SELF"])) && !preg_match('/^sabreAction=asset&assetName=[a-zA-Z0-9%\-\/]+\.(png|css|woff|ico|ttf)$/', $_SERVER["QUERY_STRING"]) // URL for Sabre browser resources - ) { +) { //var_dump($_SERVER["QUERY_STRING"]);exit; $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend)); } @@ -239,7 +247,7 @@ $server->addPlugin($tempFF); */ // And off we go! -$server->exec(); +$server->start(); if (is_object($db)) { $db->close(); diff --git a/htdocs/debugbar/class/DataCollector/DolPhpCollector.php b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php index c4ff10dbc61..8adc2a3814d 100644 --- a/htdocs/debugbar/class/DataCollector/DolPhpCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolPhpCollector.php @@ -76,18 +76,26 @@ class PhpCollector extends DataCollector implements Renderable /** * Returns a list of messages ordered by their timestamp. * - * @return array A list of messages ordered by time. + * @return array A list of messages ordered by time. */ public function getMessages() { $messages = $this->messages; - usort($messages, function ($itemA, $itemB) { - if ($itemA['time'] === $itemB['time']) { - return 0; + usort( + $messages, + /** + * @param array{time:int} $itemA Message A information + * @param array{time:int} $itemB Message B information + * @return int<-1,1> -1 if Item A before Item B, 0 if same, 1 if later. + */ + static function ($itemA, $itemB) { + if ($itemA['time'] === $itemB['time']) { + return 0; + } + return $itemA['time'] < $itemB['time'] ? -1 : 1; } - return $itemA['time'] < $itemB['time'] ? -1 : 1; - }); + ); return $messages; } diff --git a/htdocs/debugbar/class/autoloader.php b/htdocs/debugbar/class/autoloader.php index a093315172a..b5e54aa29dd 100644 --- a/htdocs/debugbar/class/autoloader.php +++ b/htdocs/debugbar/class/autoloader.php @@ -1,35 +1,43 @@ + */ /** * Simple autoloader, so we don't need Composer just for this. */ -spl_autoload_register(function ($class) { - if (preg_match('/^DebugBar/', $class)) { - $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - //var_dump($class.' - '.file_exists($file).' - '.$file); - if (file_exists($file)) { - require_once $file; - return true; +spl_autoload_register( + /** + * @param string $class Class to load + * @return true If class could be loaded + */ + static function ($class) { + if (preg_match('/^DebugBar/', $class)) { + $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; + //var_dump($class.' - '.file_exists($file).' - '.$file); + if (file_exists($file)) { + require_once $file; + return true; + } + return false; } - return false; - } - if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) { - $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - //var_dump($class.' - '.file_exists($file).' - '.$file); - if (file_exists($file)) { - require_once $file; - return true; + if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) { + $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; + //var_dump($class.' - '.file_exists($file).' - '.$file); + if (file_exists($file)) { + require_once $file; + return true; + } + return false; } - return false; - } - if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) { - $class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class); - $file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; - if (file_exists($file)) { - require_once $file; - return true; + if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) { + $class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class); + $file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php'; + if (file_exists($file)) { + require_once $file; + return true; + } + return false; } - return false; + return true; } - return true; -}); +); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index b4d139a0120..d57a25e96ba 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -615,7 +616,7 @@ class Delivery extends CommonObject $result = $line->insertExtraFields(); if ($result < 0) { - $this->error[] = $line->error; + $this->errors[] = $line->error; $error++; } } @@ -826,7 +827,7 @@ class Delivery extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 3a0854cb103..b88040c2ed7 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -64,9 +64,9 @@ if ($action == 'specimen') { $dir = DOL_DOCUMENT_ROOT."/core/modules/dons/"; $file = $modele.".modules.php"; if ($modele !== '' && file_exists($dir.$file)) { - $classname = $modele; require_once $dir.$file; + $classname = (string) $modele; $obj = new $classname($db); if ($obj->write_file($don, $langs) > 0) { diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index c3bce69d1db..4bdcaa4a853 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2019 Thibault FOUCART * Copyright (C) 2019-2024 Frédéric France * Copyright (C) 2021 Maxime DEMAREST + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -382,11 +383,11 @@ class Don extends CommonObject $now = dol_now(); // Clean parameters - $this->address = ($this->address > 0 ? $this->address : $this->address); - $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); - $this->town = ($this->town > 0 ? $this->town : $this->town); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); - $this->country = ($this->country ? $this->country : $this->country); + // $this->address = ($this->address > 0 ? $this->address : $this->address); + // $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); + // $this->town = ($this->town > 0 ? $this->town : $this->town); + // $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + // $this->country = ($this->country ? $this->country : $this->country); $this->amount = (float) price2num($this->amount); // Check parameters @@ -499,11 +500,11 @@ class Don extends CommonObject $error = 0; // Clean parameters - $this->address = ($this->address > 0 ? $this->address : $this->address); - $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); - $this->town = ($this->town > 0 ? $this->town : $this->town); - $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); - $this->country = ($this->country ? $this->country : $this->country); + // $this->address = ($this->address > 0 ? $this->address : $this->address); + // $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); + // $this->town = ($this->town > 0 ? $this->town : $this->town); + // $this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id); + // $this->country = ($this->country ? $this->country : $this->country); $this->amount = (float) price2num($this->amount); // Check parameters diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 518529630fb..214b1731a94 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -120,7 +120,7 @@ class EmailCollector extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'visible' => 2, 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'index' => 1), @@ -2385,7 +2385,7 @@ class EmailCollector extends CommonObject $operationslog .= '
We have this data to search thirdparty: id='.$idtouseforthirdparty.', email='.$emailtouseforthirdparty.', name='.$nametouseforthirdparty.', name_alias='.$namealiastouseforthirdparty; $tmpobject = new stdClass(); - $tmpobject->element == 'generic'; + $tmpobject->element = 'generic'; $tmpobject->id = $idtouseforthirdparty; $tmpobject->name = $nametouseforthirdparty; $tmpobject->name_alias = $namealiastouseforthirdparty; @@ -3363,7 +3363,7 @@ class EmailCollector extends CommonObject if (empty($mode) && empty($error)) { $res = imap_mail_move($connection, $imapemail, $targetdir, CP_UID); if ($res == false) { - $errorforemail++; + // $errorforemail++; // Not in loop, not needed, not initialised $this->error = imap_last_error(); $this->errors[] = $this->error; diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index dc5e4a44c49..85c9ad7dc83 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -79,7 +79,7 @@ class EmailCollectorAction extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 10d937cd866..0089e5f0b6c 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -81,7 +81,7 @@ class EmailCollectorFilter extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), @@ -93,7 +93,7 @@ class EmailCollectorFilter extends CommonObject 'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -2, 'position' => 510, 'notnull' => 1, 'foreignkey' => 'llx_user.rowid',), 'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'position' => 511, 'notnull' => -1,), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 1000, 'notnull' => -1,), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '1', 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled')), ); public $rowid; public $fk_emailcollector; diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index e46a547045b..683a8d016fe 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -112,25 +112,25 @@ class ConferenceOrBooth extends ActionComm // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'id' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), - 'ref' => array('type' => 'integer', 'label' => 'Ref', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax150', 'help' => "OrganizationEvenLabelName", 'showoncombobox' => '1', 'autofocusoncreate' => 1), + 'id' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'integer', 'label' => 'Ref', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'csslist' => 'left', 'comment' => "Id"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'csslist' => 'tdoverflowmax150', 'help' => "OrganizationEvenLabelName", 'showoncombobox' => 1, 'autofocusoncreate' => 1), 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'position' => 52, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'picto' => 'project', 'css' => 'maxwidth500', 'csslist' => 'tdoverflowmax100'), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'enabled' => '$conf->societe->enabled', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'help' => "OrganizationEventLinkToThirdParty", 'picto' => 'company', 'csslist' => 'tdoverflowmax100', 'css' => 'maxwidth500'), - 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3), - 'fk_action' => array('type' => "sellist:c_actioncomm:libelle:id::(module:LIKE:'%@eventorganization')", 'label' => 'Format', 'enabled' => '1', 'position' => 60, 'notnull' => 1, 'visible' => 1, 'css' => 'width100', 'csslist' => 'tdoverflowmax100'), - 'datep' => array('type' => 'datetime', 'label' => 'DateStart', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '2',), - 'datep2' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => '1', 'position' => 71, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '3',), - 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2, 'csslist' => 'nowraponall'), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'), - 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax100'), - 'fk_user_mod' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax100'), - 'num_vote' => array('type' => 'smallint', 'label' => 'NbVotes', 'enabled' => '1', 'position' => 800, 'notnull' => -1, 'visible' => 5, 'default' => '0', 'index' => 0), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'EvntOrgDraft', '1' => 'EvntOrgSuggested', '2' => 'EvntOrgConfirmed', '3' => 'EvntOrgNotQualified', '4' => 'EvntOrgDone', '9' => 'EvntOrgCancelled'),), + 'note' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3), + 'fk_action' => array('type' => "sellist:c_actioncomm:libelle:id::(module:LIKE:'%@eventorganization')", 'label' => 'Format', 'enabled' => 1, 'position' => 60, 'notnull' => 1, 'visible' => 1, 'css' => 'width100', 'csslist' => 'tdoverflowmax100'), + 'datep' => array('type' => 'datetime', 'label' => 'DateStart', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '2',), + 'datep2' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'position' => 71, 'notnull' => 0, 'visible' => 1, 'showoncombobox' => '3',), + 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2, 'csslist' => 'nowraponall'), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'), + 'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid', 'csslist' => 'tdoverflowmax100'), + 'fk_user_mod' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2, 'csslist' => 'tdoverflowmax100'), + 'num_vote' => array('type' => 'smallint', 'label' => 'NbVotes', 'enabled' => 1, 'position' => 800, 'notnull' => -1, 'visible' => 5, 'default' => '0', 'index' => 0), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'EvntOrgDraft', '1' => 'EvntOrgSuggested', '2' => 'EvntOrgConfirmed', '3' => 'EvntOrgNotQualified', '4' => 'EvntOrgDone', '9' => 'EvntOrgCancelled'),), ); public $rowid; public $id; diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 02fcb8b350f..7b898c6cc12 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -100,32 +100,32 @@ class ConferenceOrBoothAttendee extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'comment' => "Reference of object"), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'comment' => "Reference of object"), //'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), 'fk_project' => array('type' => 'integer:Project:projet/class/project.class.php:1', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'position' => 20, 'notnull' => 1, 'visible' => 0, 'index' => 1, 'picto' => 'project', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'email' => array('type' => 'mail', 'label' => 'EmailAttendee', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'autofocusoncreate' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax150'), - 'firstname' => array('type' => 'varchar(100)', 'label' => 'Firstname', 'enabled' => '1', 'position' => 31, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125'), - 'lastname' => array('type' => 'varchar(100)', 'label' => 'Lastname', 'enabled' => '1', 'position' => 32, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125'), + 'email' => array('type' => 'mail', 'label' => 'EmailAttendee', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'autofocusoncreate' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax150'), + 'firstname' => array('type' => 'varchar(100)', 'label' => 'Firstname', 'enabled' => 1, 'position' => 31, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125'), + 'lastname' => array('type' => 'varchar(100)', 'label' => 'Lastname', 'enabled' => 1, 'position' => 32, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax125'), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'position' => 40, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'help' => "OrganizationEventLinkToThirdParty", 'picto' => 'company', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'email_company' => array('type' => 'mail', 'label' => 'EmailCompany', 'enabled' => '1', 'position' => 41, 'notnull' => 0, 'visible' => -2, 'searchall' => 1), - 'date_subscription' => array('type' => 'datetime', 'label' => 'DateOfRegistration', 'enabled' => '1', 'position' => 56, 'notnull' => 1, 'visible' => 1, 'showoncombobox' => '1',), + 'email_company' => array('type' => 'mail', 'label' => 'EmailCompany', 'enabled' => 1, 'position' => 41, 'notnull' => 0, 'visible' => -2, 'searchall' => 1), + 'date_subscription' => array('type' => 'datetime', 'label' => 'DateOfRegistration', 'enabled' => 1, 'position' => 56, 'notnull' => 1, 'visible' => 1, 'showoncombobox' => 1,), 'fk_invoice' => array('type' => 'integer:Facture:compta/facture/class/facture.class.php', 'label' => 'Invoice', 'enabled' => 'isModEnabled("invoice")', 'position' => 57, 'notnull' => 0, 'visible' => 1, 'index' => 0, 'picto' => 'bill', 'css' => 'maxwidth500 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'amount' => array('type' => 'price', 'label' => 'AmountPaid', 'enabled' => '1', 'position' => 57, 'notnull' => 0, 'visible' => 1, 'default' => 'null', 'isameasure' => '1', 'help' => "AmountOfRegistrationPaid",), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 3,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 3,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2, 'css' => 'nowraponall'), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => -1, 'visible' => -2), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), - 'ip' => array('type' => 'varchar(250)', 'label' => 'IPAddress', 'enabled' => '1', 'position' => 900, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'default' => 0, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'),), + 'amount' => array('type' => 'price', 'label' => 'AmountPaid', 'enabled' => 1, 'position' => 57, 'notnull' => 0, 'visible' => 1, 'default' => 'null', 'isameasure' => 1, 'help' => "AmountOfRegistrationPaid",), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 3,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 3,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2, 'css' => 'nowraponall'), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => -1, 'visible' => -2), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'ip' => array('type' => 'varchar(250)', 'label' => 'IPAddress', 'enabled' => 1, 'position' => 900, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'default' => '0', 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'),), ); public $rowid; public $ref; diff --git a/htdocs/eventorganization/conferenceorboothattendee_note.php b/htdocs/eventorganization/conferenceorboothattendee_note.php index 99768a9b738..66caf29a247 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_note.php +++ b/htdocs/eventorganization/conferenceorboothattendee_note.php @@ -1,6 +1,7 @@ * Copyright (C) ---Put here your own copyright and developer email--- + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,59 +23,12 @@ * \brief Tab for notes on ConferenceOrBoothAttendee */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; - $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; -dol_include_once('/eventorganization/class/conferenceorboothattendee.class.php'); -dol_include_once('/eventorganization/lib/eventorganization_conferenceorboothattendee.lib.php'); +require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php'; +require_once DOL_DOCUMENT_ROOT . '/eventorganization/lib/eventorganization_conferenceorboothattendee.lib.php'; // Load translation files required by the page $langs->loadLangs(array('eventorganization', 'companies')); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 6742c84011b..4f9ef208d88 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2014-2017 Francis Appels * Copyright (C) 2015 Claudio Aschieri - * Copyright (C) 2016-2022 Ferran Marcet + * Copyright (C) 2016-2024 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Lenin Rivas @@ -92,7 +92,7 @@ class Expedition extends CommonObject /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array(); @@ -921,7 +921,7 @@ class Expedition extends CommonObject if (isModEnabled('stock') && !empty($orderline->fk_product)) { $fk_product = $orderline->fk_product; - if (!($entrepot_id > 0) && !getDolGlobalString('STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS')) { + if (!($entrepot_id > 0) && !getDolGlobalString('STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS') && !(getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES') && $line->product_type == Product::TYPE_SERVICE)) { $langs->load("errors"); $this->error = $langs->trans("ErrorWarehouseRequiredIntoShipmentLine"); return -1; diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 464ca7edf60..3ccf90c0255 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Laurent Destailleur - * Copyright (C) 2020 Frédéric France + * Copyright (C) 2020-2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,7 +107,7 @@ class ExpenseReports extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @return array Array of Expense Report objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '', $properties = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = '', $sqlfilters = '', $properties = '') { if (!DolibarrApiAccess::$user->hasRight('expensereport', 'lire')) { throw new RestException(403); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 54c4a8b469a..a602edc810d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -656,8 +656,6 @@ class ExpenseReport extends CommonObject */ public function fetch($id, $ref = '') { - global $conf; - $sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT $sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS $sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS @@ -885,6 +883,8 @@ class ExpenseReport extends CommonObject $sql .= " WHERE f.rowid = ".((int) $id); $sql .= " AND f.entity = ".$conf->entity; + + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql)) { @@ -920,7 +920,7 @@ class ExpenseReport extends CommonObject */ public function initAsSpecimen() { - global $user, $langs, $conf; + global $user, $langs; $now = dol_now(); @@ -983,10 +983,10 @@ class ExpenseReport extends CommonObject * @param User $user User * @return int Return integer <0 if KO, >0 if OK */ - public function fetch_line_by_project($projectid, $user = '') + public function fetch_line_by_project($projectid, $user) { // phpcs:enable - global $conf, $db, $langs; + global $langs; $langs->load('trips'); @@ -1086,8 +1086,6 @@ class ExpenseReport extends CommonObject public function fetch_lines() { // phpcs:enable - global $conf; - $this->lines = array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; @@ -1792,7 +1790,7 @@ class ExpenseReport extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) { - global $langs, $conf, $hookmanager; + global $langs, $hookmanager; $result = ''; @@ -1906,7 +1904,7 @@ class ExpenseReport extends CommonObject * @param float $qty Qty * @param double $up Unit price (price with tax) * @param int $fk_c_type_fees Type payment - * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') + * @param int<-1,0>|string $vatrate Vat rate (Can be '10' or '10 (ABC)') * @param string $date Date * @param string $comments Description * @param int $fk_project Project id @@ -1917,7 +1915,7 @@ class ExpenseReport extends CommonObject */ public function addline($qty = 0, $up = 0, $fk_c_type_fees = 0, $vatrate = 0, $date = '', $comments = '', $fk_project = 0, $fk_c_exp_tax_cat = 0, $type = 0, $fk_ecm_files = 0) { - global $conf, $langs, $mysoc; + global $langs, $mysoc; dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG); @@ -2029,7 +2027,7 @@ class ExpenseReport extends CommonObject */ public function checkRules($type = 0, $seller = '') { - global $user, $conf, $db, $langs, $mysoc; + global $conf, $db, $langs, $mysoc; $langs->load('trips'); @@ -2105,7 +2103,7 @@ class ExpenseReport extends CommonObject */ public function applyOffset($type = 0, $seller = '') { - global $conf, $mysoc; + global $mysoc; if (!getDolGlobalString('MAIN_USE_EXPENSE_IK')) { return false; @@ -2327,10 +2325,10 @@ class ExpenseReport extends CommonObject /** * deleteline * - * @param int $rowid Row id - * @param User $fuser User - * @param int $notrigger 1=No trigger - * @return int Return integer <0 if KO, >0 if OK + * @param int $rowid Row id + * @param User|string $fuser User + * @param int<0,1> $notrigger 1=No trigger + * @return int<0,1> Return integer <0 if KO, >0 if OK */ public function deleteLine($rowid, $fuser = '', $notrigger = 0) { @@ -2473,8 +2471,6 @@ class ExpenseReport extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf; - $outputlangs->load("trips"); if (!dol_strlen($modele)) { @@ -2530,7 +2526,7 @@ class ExpenseReport extends CommonObject */ public function loadStateBoard() { - global $conf, $user; + global $user; $this->nb = array(); @@ -3040,7 +3036,7 @@ class ExpenseReportLine extends CommonObjectLine */ public function insert($notrigger = 0, $fromaddline = false) { - global $user, $conf; + global $user; $error = 0; @@ -3182,7 +3178,7 @@ class ExpenseReportLine extends CommonObjectLine */ public function update(User $user) { - global $langs, $conf; + global $langs; $error = 0; diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 438bf4af1c2..14727b498e7 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -72,12 +72,12 @@ class ExpenseReportIk extends CommonObject /** * Attribute object linked with database - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'index' => true) - ,'fk_c_exp_tax_cat' => array('type' => 'integer', 'index' => true) - ,'fk_range' => array('type' => 'integer', 'index' => true) + 'rowid' => array('type' => 'integer', 'index' => 1) + ,'fk_c_exp_tax_cat' => array('type' => 'integer', 'index' => 1) + ,'fk_range' => array('type' => 'integer', 'index' => 1) ,'coef' => array('type' => 'double') ,'ikoffset' => array('type' => 'double') ); diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index a2fdaa4d3d8..7c640527055 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -110,10 +110,10 @@ class ExpenseReportRule extends CommonObject /** * Attribute object linked with database - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'index' => true) + 'rowid' => array('type' => 'integer', 'index' => 1) ,'dates' => array('type' => 'date') ,'datee' => array('type' => 'date') ,'amount' => array('type' => 'double') diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index f480854dad8..5541cdc9ac3 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,7 +66,13 @@ class PaymentExpenseReport extends CommonObject * @var int|string */ public $datep = ''; + /** + * @var float|int + */ public $amount; // Total amount of payment + /** + * @var array + */ public $amounts = array(); // Array of amounts /** @@ -94,7 +101,14 @@ class PaymentExpenseReport extends CommonObject */ public $fk_user_modif; + /** + * @var string + */ public $type_code; + + /** + * @var string + */ public $type_label; /** @@ -293,7 +307,6 @@ class PaymentExpenseReport extends CommonObject public function update($user = null, $notrigger = 0) { // phpcs:enable - global $conf, $langs; $error = 0; // Clean parameters @@ -323,13 +336,8 @@ class PaymentExpenseReport extends CommonObject $this->fk_user_modif = (int) $this->fk_user_modif; } - - // Check parameters - // Put here code to add control on parameters values - // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."payment_expensereport SET"; - $sql .= " fk_expensereport=".(isset($this->fk_expensereport) ? $this->fk_expensereport : "null").","; $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; @@ -341,8 +349,6 @@ class PaymentExpenseReport extends CommonObject $sql .= " fk_bank=".(isset($this->fk_bank) ? $this->fk_bank : "null").","; $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").","; $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? $this->fk_user_modif : "null"); - - $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -379,7 +385,6 @@ class PaymentExpenseReport extends CommonObject public function delete($user, $notrigger = 0) { // phpcs:enable - global $conf, $langs; $error = 0; $this->db->begin(); @@ -510,13 +515,14 @@ class PaymentExpenseReport extends CommonObject $this->id = 0; $this->fk_expensereport = 0; - $this->datec = ''; + $this->datec = dol_now(); $this->tms = dol_now(); - $this->datep = ''; - $this->amount = ''; + $this->datep = dol_now(); + $this->amount = 100; $this->fk_typepayment = 0; - $this->num_payment = ''; - $this->note = ''; + $this->num_payment = '123456'; + $this->note_public = 'Public note'; + $this->note_private = 'Private note'; $this->fk_bank = 0; $this->fk_user_creat = 0; $this->fk_user_modif = 0; @@ -539,7 +545,7 @@ class PaymentExpenseReport extends CommonObject */ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { - global $langs, $conf; + global $langs; $error = 0; @@ -693,7 +699,7 @@ class PaymentExpenseReport extends CommonObject } global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/expensereport/payment/list.php b/htdocs/expensereport/payment/list.php index 88cd5ecb2d0..c1f474af0db 100644 --- a/htdocs/expensereport/payment/list.php +++ b/htdocs/expensereport/payment/list.php @@ -12,6 +12,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Tobias Sekan * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -517,9 +518,9 @@ while ($i < $imaxinloop) { if ($objp->bid) { $accountstatic->fetch($objp->bid); - $paymentexpensereportstatic->fk_bank = $accountstatic->getNomUrl(1); + $paymentexpensereportstatic->fk_bank = $accountstatic->id; } else { - $paymentexpensereportstatic->fk_bank = null; + $paymentexpensereportstatic->fk_bank = 0; } $userstatic->id = $objp->userid; diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 8e7aad352be..4c71562da9b 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -10,6 +10,7 @@ * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2024 William Mead + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -730,9 +731,7 @@ if ($action == 'create') { // Show product and description if (isset($object->lines[$i]->product_type)) { $type = $object->lines[$i]->product_type; - } else { - $object->lines[$i]->fk_product_type; - } + } // else { $object->lines[$i]->fk_product_type; } // Try to enhance type detection using date_start and date_end for free lines when type // was not saved. if (!empty($objp->date_start)) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 010427ab2a4..f5b57037c0d 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -58,6 +58,7 @@ class Fichinter extends CommonObject 'datee' => array('type' => 'date', 'label' => 'Datee', 'enabled' => 1, 'visible' => -1, 'position' => 90), 'datet' => array('type' => 'date', 'label' => 'Datet', 'enabled' => 1, 'visible' => -1, 'position' => 95), 'duree' => array('type' => 'double', 'label' => 'Duree', 'enabled' => 1, 'visible' => -1, 'position' => 100), + 'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 9 => 'SignedAll')), 'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'showoncombobox' => 2), 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110), 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 115), @@ -134,6 +135,12 @@ class Fichinter extends CommonObject */ public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate + /** + * Signed Status of the intervention (0=NoSignature, 1=SignedBySender, 2=SignedByReceiver, 9=SignedByAll) + * @var int + */ + public $signed_status = 0; + /** * @var string description */ @@ -185,6 +192,26 @@ class Fichinter extends CommonObject */ const STATUS_CLOSED = 3; + /* + * No signature + */ + const STATUS_NO_SIGNATURE = 0; + + /* + * Signed by sender + */ + CONST STATUS_SIGNED_SENDER = 1; + + /* + * Signed by receiver + */ + CONST STATUS_SIGNED_RECEIVER = 2; + + /* + * Signed by all + */ + CONST STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract) + /** * Date delivery * @var string|int Delivery int @@ -1600,6 +1627,20 @@ class Fichinter extends CommonObject $return .= ''; return $return; } + + /** + * Set signed status + * + * @param User $user Object user that modify + * @param int $status Newsigned status to set (often a constant like self::STATUS_XXX) + * @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers + * @param string $triggercode Trigger code to use + * @return int 0 < if KO, > 0 if OK + */ + public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int + { + return $this->setSignedStatusCommon($user, $status, $notrigger, $triggercode); + } } /** diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index ff496ac9673..0c6698c736c 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -9,6 +9,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Bahfir Abbes + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,6 +62,66 @@ if (defined('DOL_INC_FOR_VERSION_ERROR')) { return; } + +/** + * Replace session_start() + * + * @return void + */ +function dol_session_start() +{ + session_start(); +} + +/** + * Replace session_regenerate_id() + * + * @return bool True if success, false if failed + */ +function dol_session_regenerate_id() +{ + return session_regenerate_id(); +} + +/** + * Destroy and recreate a new session without losing content. + * Not used yet. + * + * @param $sessionname string Session name + * @return void + */ +function dol_session_rotate($sessionname = '') +{ + $oldsessionid = session_id(); + + // Backup the current session + $session_backup = $_SESSION; + + // Set current session to expire in 1 minute + $_SESSION['OBSOLETE'] = true; + $_SESSION['EXPIRES'] = time() + 60; + + // Close the current session + session_write_close(); + + // Set a new session id and start the session + session_name($sessionname); + dol_session_start(); + + // Restore the previous session backup + $_SESSION = $session_backup; + + // Clean up + unset($session_backup); + unset($_SESSION['OBSOLETE']); + unset($_SESSION['EXPIRES']); + + $newsessionid = session_id(); + //var_dump("oldsessionid=".$oldsessionid." - newsessionid=".$newsessionid); +} + + + // Define vars $conffiletoshowshort = "conf.php"; // Define localization of conf file @@ -76,7 +137,7 @@ $conffiletoshow = "htdocs/conf/conf.php"; // --- End of part replaced by Dolibarr packager makepack-dolibarr // Include configuration -$result = @include_once $conffile; // Keep @ because with some error reporting this break the redirect done when file not found +$result = @include_once $conffile; // Keep @ because with some error reporting mode, this breaks the redirect done when file is not found // Disable some not used PHP stream $listofwrappers = stream_get_wrappers(); @@ -236,7 +297,7 @@ if (!defined('NOCSRFCHECK') && isset($dolibarr_nocsrfcheck) && $dolibarr_nocsrfc if ($csrfattack) { //print 'NOCSRFCHECK='.defined('NOCSRFCHECK').' REQUEST_METHOD='.$_SERVER['REQUEST_METHOD'].' HTTP_HOST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER']; // Note: We can't use dol_escape_htmltag here to escape output because lib functions.lib.ph is not yet loaded. - dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"])?'':$_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (Bad referrer).", LOG_WARNING); + dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (Bad referrer).", LOG_WARNING); print "Access refused by CSRF protection in main.inc.php. Referrer of form (".htmlentities($_SERVER['HTTP_REFERER'], ENT_COMPAT, 'UTF-8').") is outside the server that serve this page (with method = ".htmlentities($_SERVER['REQUEST_METHOD'], ENT_COMPAT, 'UTF-8').").\n"; print "If you access your server behind a proxy using url rewriting, you might check that all HTTP headers are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file to remove this security check).\n"; die; @@ -329,22 +390,22 @@ define('MAIN_DB_PREFIX', $dolibarr_main_db_prefix); */ // Path to root libraries if (!defined('TCPDF_PATH')) { - define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/'); + define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/'); } if (!defined('TCPDI_PATH')) { - define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH.'/'); + define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH.'/'); } if (!defined('NUSOAP_PATH')) { - define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH.'/')); + define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH.'/')); } if (!defined('PHPEXCELNEW_PATH')) { - define('PHPEXCELNEW_PATH', (!isset($dolibarr_lib_PHPEXCELNEW_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/phpoffice/phpspreadsheet/src/PhpSpreadsheet/' : (empty($dolibarr_lib_PHPEXCELNEW_PATH) ? '' : $dolibarr_lib_PHPEXCELNEW_PATH.'/')); + define('PHPEXCELNEW_PATH', (!isset($dolibarr_lib_PHPEXCELNEW_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/phpoffice/phpspreadsheet/src/PhpSpreadsheet/' : (empty($dolibarr_lib_PHPEXCELNEW_PATH) ? '' : $dolibarr_lib_PHPEXCELNEW_PATH.'/')); } if (!defined('ODTPHP_PATH')) { - define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ?DOL_DOCUMENT_ROOT.'/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH.'/')); + define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ? DOL_DOCUMENT_ROOT.'/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH.'/')); } if (!defined('ODTPHP_PATHTOPCLZIP')) { - define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ?DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/')); + define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ? DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/')); } if (!defined('JS_CKEDITOR')) { define('JS_CKEDITOR', (!isset($dolibarr_js_CKEDITOR)) ? '' : (empty($dolibarr_js_CKEDITOR) ? '' : $dolibarr_js_CKEDITOR.'/')); @@ -357,10 +418,10 @@ if (!defined('JS_JQUERY_UI')) { } // Other required path if (!defined('DOL_DEFAULT_TTF')) { - define('DOL_DEFAULT_TTF', (!isset($dolibarr_font_DOL_DEFAULT_TTF)) ?DOL_DOCUMENT_ROOT.'/includes/fonts/Aerial.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF) ? '' : $dolibarr_font_DOL_DEFAULT_TTF)); + define('DOL_DEFAULT_TTF', (!isset($dolibarr_font_DOL_DEFAULT_TTF)) ? DOL_DOCUMENT_ROOT.'/includes/fonts/Aerial.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF) ? '' : $dolibarr_font_DOL_DEFAULT_TTF)); } if (!defined('DOL_DEFAULT_TTF_BOLD')) { - define('DOL_DEFAULT_TTF_BOLD', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD)) ?DOL_DOCUMENT_ROOT.'/includes/fonts/AerialBd.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF_BOLD) ? '' : $dolibarr_font_DOL_DEFAULT_TTF_BOLD)); + define('DOL_DEFAULT_TTF_BOLD', (!isset($dolibarr_font_DOL_DEFAULT_TTF_BOLD)) ? DOL_DOCUMENT_ROOT.'/includes/fonts/AerialBd.ttf' : (empty($dolibarr_font_DOL_DEFAULT_TTF_BOLD) ? '' : $dolibarr_font_DOL_DEFAULT_TTF_BOLD)); } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7f7511db38f..5c7fba47e8e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1929,7 +1929,7 @@ class CommandeFournisseur extends CommonOrder * @param int $date_end Date end of service * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param string $pu_ht_devise Amount in currency + * @param int|string $pu_ht_devise Amount in currency * @param string $origin 'order', ... * @param int $origin_id Id of origin object * @param int $rang Rank @@ -2880,13 +2880,13 @@ class CommandeFournisseur extends CommonOrder * * @param int $rowid ID de la ligne de facture * @param string $desc Line description - * @param float $pu Unit price - * @param float $qty Quantity - * @param float $remise_percent Percent discount on line - * @param float $txtva VAT rate - * @param float $txlocaltax1 Localtax1 tax - * @param float $txlocaltax2 Localtax2 tax - * @param float $price_base_type Type of price base + * @param int|float $pu Unit price + * @param int|float $qty Quantity + * @param int|float $remise_percent Percent discount on line + * @param int|float $txtva VAT rate + * @param int|float $txlocaltax1 Localtax1 tax + * @param int|float $txlocaltax2 Localtax2 tax + * @param string $price_base_type Type of price base * @param int $info_bits Miscellaneous information * @param int $type Type of line (0=product, 1=service) * @param int $notrigger Disable triggers @@ -2894,11 +2894,11 @@ class CommandeFournisseur extends CommonOrder * @param integer $date_end Date end of service * @param array $array_options Extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one - * @param float $pu_ht_devise Unit price in currency + * @param int|float $pu_ht_devise Unit price in currency * @param string $ref_supplier Supplier ref * @return int Return integer < 0 if error, > 0 if ok */ - public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') + public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = 0, $date_end = 0, $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') { global $mysoc, $conf, $langs; dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit"); @@ -3243,8 +3243,8 @@ class CommandeFournisseur extends CommonOrder /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * - * @param User $user Object user - * @param int $mode "opened", "awaiting" for orders awaiting reception + * @param User $user Object user + * @param string $mode "opened", "awaiting" for orders awaiting reception * @return WorkboardResponse|int Return integer <0 if KO, WorkboardResponse if OK */ public function load_board($user, $mode = 'opened') diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 2ac0eb78ccf..900ee4d014a 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -190,13 +190,13 @@ class FactureFournisseurRec extends CommonInvoice // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), 'titre' => array('type' => 'varchar(100)', 'label' => 'Titre', 'enabled' => 1, 'showoncombobox' => 1, 'visible' => -1, 'position' => 15), 'ref_supplier' => array('type' => 'varchar(180)', 'label' => 'RefSupplier', 'enabled' => 1, 'showoncombobox' => 1, 'visible' => -1, 'position' => 20), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 25, 'index' => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 25, 'index' => 1), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 30), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 35), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 40), diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 5130c4ad2bd..c9b37398cae 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1196,9 +1197,9 @@ class FactureFournisseur extends CommonInvoice } if (isset($this->fk_project)) { if (empty($this->fk_project)) { - $this->fk_project = null; + $this->fk_project = 0; } else { - $this->fk_project = intval($this->fk_project); + $this->fk_project = (int) $this->fk_project; } } if (isset($this->cond_reglement_id)) { @@ -2064,7 +2065,7 @@ class FactureFournisseur extends CommonInvoice * @param int $fk_remise_except Id discount used * @return int >0 if OK, <0 if KO */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $fk_code_ventilation = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = 0, $array_options = [], $fk_unit = null, $origin_id = 0, $pu_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0, $fk_remise_except = 0) + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = 0, $date_end = 0, $fk_code_ventilation = 0, $info_bits = 0, $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = 0, $array_options = [], $fk_unit = null, $origin_id = 0, $pu_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0, $fk_remise_except = 0) { global $langs, $mysoc, $conf; @@ -2313,13 +2314,13 @@ class FactureFournisseur extends CommonInvoice * @param double $txlocaltax2 LocalTax2 Rate * @param double $qty Quantity * @param int $idproduct Id produit - * @param double $price_base_type HT or TTC + * @param string $price_base_type HT or TTC * @param int $info_bits Miscellaneous information of line * @param int $type Type of line (0=product, 1=service) * @param double $remise_percent Percentage discount of the line * @param int $notrigger Disable triggers - * @param integer $date_start Date start of service - * @param integer $date_end Date end of service + * @param int|string $date_start Date start of service + * @param int|string $date_end Date end of service * @param array $array_options extrafields array * @param int|null $fk_unit Code of the unit to use. Null to use the default one * @param double $pu_devise Amount in currency diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index d8f899d7bb1..a5dc3d0eba1 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1184,9 +1184,9 @@ if ($action == 'create') { } $morehtmlref .= ''; - $morehtmlright = ''; + $morehtmlstatus = ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'ref', $linkback, 1, 'title', 'none', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 06eb51043b1..7bf46c30b86 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -30,8 +30,7 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluationdet.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + /** * Class for Evaluation @@ -104,24 +103,24 @@ class Evaluation extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 4, 'noteditable' => '1', 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Reference of object"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2',), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3,), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 61, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 62, 'notnull' => 0, 'visible' => 0,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'default' => 0, 'visible' => 5, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '6' => 'Closed'),), - 'date_eval' => array('type' => 'date', 'label' => 'DateEval', 'enabled' => '1', 'position' => 502, 'notnull' => 1, 'visible' => 1,), - 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'Employee', 'enabled' => '1', 'position' => 504, 'notnull' => 1, 'visible' => 1, 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => '1', 'position' => 505, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 4, 'noteditable' => 1, 'default' => '(PROV)', 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Reference of object"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 0, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2',), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 61, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 62, 'notnull' => 0, 'visible' => 0,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'default' => '0', 'visible' => 5, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '6' => 'Closed'),), + 'date_eval' => array('type' => 'date', 'label' => 'DateEval', 'enabled' => 1, 'position' => 502, 'notnull' => 1, 'visible' => 1,), + 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'Employee', 'enabled' => 1, 'position' => 504, 'notnull' => 1, 'visible' => 1, 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => 1, 'position' => 505, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), ); public $rowid; public $ref; @@ -322,8 +321,7 @@ class Evaluation extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -920,8 +918,7 @@ class Evaluation extends CommonObject $result = $objectline->fetchAll('ASC', '', 0, 0, '(fk_evaluation:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -1022,36 +1019,6 @@ class Evaluation extends CommonObject return $result; } - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - /** * Return clicable link of object (with eventually picto) * diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index f0f2612d0c1..ad7c91c86d9 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -28,10 +28,9 @@ */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + /** * Class for EvaluationLine @@ -103,19 +102,19 @@ class EvaluationLine extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'fk_skill' => array('type' => 'integer:Skill:hrm/class/skill.class.php:1', 'label' => 'Skill', 'enabled' => '1', 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), - 'fk_evaluation' => array('type' => 'integer:Evaluation:hrm/class/evaluation.class.php:1', 'label' => 'Evaluation', 'enabled' => '1', 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), - 'rankorder' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => '1', 'position' => 4, 'notnull' => 1, 'visible' => 1,), - 'required_rank' => array('type' => 'integer', 'label' => 'requiredRank', 'enabled' => '1', 'position' => 5, 'notnull' => 1, 'visible' => 1,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'fk_skill' => array('type' => 'integer:Skill:hrm/class/skill.class.php:1', 'label' => 'Skill', 'enabled' => 1, 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), + 'fk_evaluation' => array('type' => 'integer:Evaluation:hrm/class/evaluation.class.php:1', 'label' => 'Evaluation', 'enabled' => 1, 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), + 'rankorder' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'position' => 4, 'notnull' => 1, 'visible' => 1,), + 'required_rank' => array('type' => 'integer', 'label' => 'requiredRank', 'enabled' => 1, 'position' => 5, 'notnull' => 1, 'visible' => 1,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), ); public $rowid; public $date_creation; @@ -288,8 +287,7 @@ class EvaluationLine extends CommonObjectLine $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -890,8 +888,7 @@ class EvaluationLine extends CommonObjectLine $result = $objectline->fetchAll('ASC', 'position', 0, 0, '(fk_evaluationdet:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -992,37 +989,4 @@ class EvaluationLine extends CommonObjectLine return $result; } - - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } } - - -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index c0ec08939d4..e1a355b54cd 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -29,8 +29,7 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + /** * Class for Job @@ -102,19 +101,19 @@ class Job extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => '1', 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => '1', 'comment' => "Label of object"), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 21, 'notnull' => 0, 'visible' => 1,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => 2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => 2,), - 'deplacement' => array('type' => 'select', 'required' => 1,'label' => 'NeedBusinessTravels', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => "No", 1 => "Yes"), 'default' => 0), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 71, 'notnull' => 0, 'visible' => 0,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'label' => array('type' => 'varchar(128)', 'label' => 'Label', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'searchall' => 1, 'showoncombobox' => 1, 'comment' => "Label of object"), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 21, 'notnull' => 0, 'visible' => 1,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => 2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => 2,), + 'deplacement' => array('type' => 'select', 'required' => 1,'label' => 'NeedBusinessTravels', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => 1, 'arrayofkeyval' => array(0 => "No", 1 => "Yes"), 'default' => '0'), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 71, 'notnull' => 0, 'visible' => 0,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), ); public $rowid; public $ref; @@ -148,7 +147,7 @@ class Job extends CommonObject // public $class_element_line = 'Jobline'; // /** - // * @var array List of child tables. To test if we can delete object. + // * @var string[] List of child tables. To test if we can delete object. // */ protected $childtables = array('hrm_evaluation', 'hrm_job_user'); @@ -292,8 +291,7 @@ class Job extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -928,8 +926,7 @@ class Job extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, '(fk_job:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -1031,36 +1028,6 @@ class Job extends CommonObject return $result; } - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - /** * Return clicable link of object (with eventually picto) * @@ -1097,6 +1064,7 @@ class Job extends CommonObject $return .= '
'; return $return; } + /** * function for get required skills associate to job object * @param int $id Id of object diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index f15e98131ca..f96cb1539a2 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -29,8 +29,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for Position @@ -102,24 +100,24 @@ class Position extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'css' => 'left', 'comment' => "Id"), //'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), 'fk_contrat' => array('type' => 'integer:Contrat:contrat/class/contrat.class.php', 'label' => 'fk_contrat', 'enabled' => 'isModEnabled("contract")', 'position' => 50, 'notnull' => 0, 'visible' => 0,), - 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0:(t.statut:=:1)', 'label' => 'Employee', 'enabled' => '1', 'position' => 55, 'notnull' => 1, 'visible' => 1, 'default' => 0, 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => '1', 'position' => 56, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), - 'date_start' => array('type' => 'date', 'label' => 'DateStart', 'enabled' => '1', 'position' => 101, 'notnull' => 1, 'visible' => 1,), - 'date_end' => array('type' => 'date', 'label' => 'DateEnd', 'enabled' => '1', 'position' => 102, 'notnull' => 0, 'visible' => 1,), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 120, 'notnull' => 0, 'visible' => 3,), + 'fk_user' => array('type' => 'integer:User:user/class/user.class.php:0:(t.statut:=:1)', 'label' => 'Employee', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'picto' => 'user', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'fk_job' => array('type' => 'integer:Job:/hrm/class/job.class.php', 'label' => 'JobProfile', 'enabled' => 1, 'position' => 56, 'notnull' => 1, 'visible' => 1, 'picto' => 'jobprofile', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'), + 'date_start' => array('type' => 'date', 'label' => 'DateStart', 'enabled' => 1, 'position' => 101, 'notnull' => 1, 'visible' => 1,), + 'date_end' => array('type' => 'date', 'label' => 'DateEnd', 'enabled' => 1, 'position' => 102, 'notnull' => 0, 'visible' => 1,), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => 3,), 'abort_comment' => array('type' => 'varchar(255)', 'label' => 'AbandonmentComment', 'enabled' => 'getDolGlobalInt("HRM_JOB_POSITON_ENDING_COMMENT")', 'position' => 502, 'notnull' => 0, 'visible' => 1,), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 151, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 152, 'notnull' => 0, 'visible' => 0,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 151, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 152, 'notnull' => 0, 'visible' => 0,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), ); public $rowid; public $ref; @@ -301,8 +299,7 @@ class Position extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -970,8 +967,7 @@ class Position extends CommonObject $result = $objectline->fetchAll('ASC', 'position', 0, 0, '(fk_position:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -1088,36 +1084,6 @@ class Position extends CommonObject return $result; } - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - /** * Return clicable link of object (with eventually picto) * diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index aefd68a0bea..256956d55de 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -29,8 +29,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for Skill @@ -108,22 +106,22 @@ class Skill extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => '2',), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 3,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'required_level' => array('type' => 'integer', 'label' => 'requiredLevel', 'enabled' => '1', 'position' => 50, 'notnull' => 1, 'visible' => 0,), - 'date_validite' => array('type' => 'integer', 'label' => 'date_validite', 'enabled' => '1', 'position' => 52, 'notnull' => 1, 'visible' => 0,), - 'temps_theorique' => array('type' => 'double(24,8)', 'label' => 'temps_theorique', 'enabled' => '1', 'position' => 54, 'notnull' => 1, 'visible' => 0,), - 'skill_type' => array('type' => 'integer', 'label' => 'SkillType', 'enabled' => '1', 'position' => 55, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'css' => 'minwidth200', 'arrayofkeyval' => array('0' => 'TypeKnowHow', '1' => 'TypeHowToBe', '9' => 'TypeKnowledge'), 'default' => 0), - 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => '1', 'position' => 70, 'notnull' => 0, 'visible' => 0,), - 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => '1', 'position' => 71, 'notnull' => 0, 'visible' => 0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'showoncombobox' => 2,), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 3,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php:0', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'required_level' => array('type' => 'integer', 'label' => 'requiredLevel', 'enabled' => 1, 'position' => 50, 'notnull' => 1, 'visible' => 0,), + 'date_validite' => array('type' => 'integer', 'label' => 'date_validite', 'enabled' => 1, 'position' => 52, 'notnull' => 1, 'visible' => 0,), + 'temps_theorique' => array('type' => 'double(24,8)', 'label' => 'temps_theorique', 'enabled' => 1, 'position' => 54, 'notnull' => 1, 'visible' => 0,), + 'skill_type' => array('type' => 'integer', 'label' => 'SkillType', 'enabled' => 1, 'position' => 55, 'notnull' => 1, 'visible' => 1, 'index' => 1, 'css' => 'minwidth200', 'arrayofkeyval' => array('0' => 'TypeKnowHow', '1' => 'TypeHowToBe', '9' => 'TypeKnowledge'), 'default' => '0'), + 'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => 0,), + 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'position' => 71, 'notnull' => 0, 'visible' => 0,), ); public $rowid; public $label; @@ -261,7 +259,7 @@ class Skill extends CommonObject $this->db->begin(); // Create level of skills - for ($i; $i <= $MaxNumberSkill ; $i++) { + while ($i <= $MaxNumberSkill) { $skilldet = new Skilldet($this->db); $skilldet->description = $defaultSkillDesc . " " . $i; $skilldet->rankorder = $i; @@ -271,9 +269,10 @@ class Skill extends CommonObject if ($result <= 0) { $error++; } + $i++; } - if (! $error) { + if (!$error) { $this->db->commit(); setEventMessage($langs->trans('SkillCreated'), $i); @@ -351,8 +350,7 @@ class Skill extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -414,8 +412,7 @@ class Skill extends CommonObject if (is_array($this->lines)) { return (count($this->lines) > 0) ? $this->lines : array(); } elseif ($this->lines < 0) { - $this->errors = array_merge($this->errors, $skilldet->errors); - $this->error = $skilldet->error; + $this->setErrorsFromObject($skilldet); return $this->lines; } return []; @@ -969,8 +966,7 @@ class Skill extends CommonObject $result = $objectline->fetchAll('ASC', 'rankorder', 0, 0, '(fk_skill:=:'.((int) $this->id).')'); if (is_numeric($result)) { - $this->error = $objectline->error; - $this->errors = $objectline->errors; + $this->setErrorsFromObject($objectline); return $result; } else { $this->lines = $result; @@ -1072,36 +1068,6 @@ class Skill extends CommonObject return $result; } - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - /** * @param int $code number of code label * @return int|string diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 83ccae8c5ab..12258e08025 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -29,8 +29,6 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for Skilldet @@ -102,15 +100,15 @@ class Skilldet extends CommonObjectLine // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'fk_skill' => array('type' => 'integer:Skill:/hrm/class/skill.class.php', 'label' => 'fk_skill', 'enabled' => '1', 'position' => 5, 'notnull' => 1, 'visible' => 0,), - 'rankorder' => array('type' => 'integer', 'label' => 'rank', 'enabled' => '1', 'position' => 10, 'notnull' => 0, 'visible' => 2,), - 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => '1', 'position' => 60, 'notnull' => 0, 'visible' => 1,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => 0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'fk_skill' => array('type' => 'integer:Skill:/hrm/class/skill.class.php', 'label' => 'fk_skill', 'enabled' => 1, 'position' => 5, 'notnull' => 1, 'visible' => 0,), + 'rankorder' => array('type' => 'integer', 'label' => 'rank', 'enabled' => 1, 'position' => 10, 'notnull' => 0, 'visible' => 2,), + 'description' => array('type' => 'text', 'label' => 'Description', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 1,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => 0,), ); public $rowid; public $fk_skill; @@ -283,8 +281,7 @@ class Skilldet extends CommonObjectLine $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -959,34 +956,4 @@ class Skilldet extends CommonObjectLine return $result; } - - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } } diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 245a6d8ba6c..4c599235f72 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -104,18 +104,18 @@ class SkillRank extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'fk_skill' => array('type' => 'integer:Skill:hrm/class/skill.class.php:1', 'label' => 'Skill', 'enabled' => '1', 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), - 'rankorder' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => '1', 'position' => 4, 'notnull' => 1, 'visible' => 1, 'default' => 0), - 'fk_object' => array('type' => 'integer', 'label' => 'object', 'enabled' => '1', 'position' => 5, 'notnull' => 1, 'visible' => 0,), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => -2,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'objecttype' => array('type' => 'varchar(128)', 'label' => 'objecttype', 'enabled' => '1', 'position' => 6, 'notnull' => 1, 'visible' => 0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'fk_skill' => array('type' => 'integer:Skill:hrm/class/skill.class.php:1', 'label' => 'Skill', 'enabled' => 1, 'position' => 3, 'notnull' => 1, 'visible' => 1, 'index' => 1,), + 'rankorder' => array('type' => 'integer', 'label' => 'Rank', 'enabled' => 1, 'position' => 4, 'notnull' => 1, 'visible' => 1, 'default' => '0'), + 'fk_object' => array('type' => 'integer', 'label' => 'object', 'enabled' => 1, 'position' => 5, 'notnull' => 1, 'visible' => 0,), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'objecttype' => array('type' => 'varchar(128)', 'label' => 'objecttype', 'enabled' => 1, 'position' => 6, 'notnull' => 1, 'visible' => 0,), ); public $rowid; public $fk_skill; @@ -309,8 +309,7 @@ class SkillRank extends CommonObject $result = $object->createCommon($user); if ($result < 0) { $error++; - $this->error = $object->error; - $this->errors = $object->errors; + $this->setErrorsFromObject($object); } if (!$error) { @@ -1033,51 +1032,4 @@ class SkillRank extends CommonObject return $result; } - - /** - * Action executed by scheduler - * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' - * Use public function doScheduledJob($param1, $param2, ...) to get parameters - * - * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) - */ - public function doScheduledJob() - { - global $conf, $langs; - - //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; - - $error = 0; - $this->output = ''; - $this->error = ''; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $now = dol_now(); - - $this->db->begin(); - - // ... - - $this->db->commit(); - - return $error; - } - - /** - * @param array $val - * @param string $key - * @param string $value - * @param string $moreparam - * @param string $keysuffix - * @param string $keyprefix - * @param string $morecss - * @return string - */ - // public function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '') - // { - // if ($key == "rank") { - // return displayRankInfos($this); - // } else return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); - // } } diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index a75965f797e..8286c7f0cf4 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -4,6 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -278,6 +279,7 @@ $fk_usergroup1 = GETPOST('fk_usergroup1'); print dol_get_fiche_end(); llxFooter(); +$db->close(); @@ -357,10 +359,10 @@ function rate(&$TMergedSkills, $field) } /** - * return a html ul list of skills + * return a html ul list of skills * - * @param array $TMergedSkills skill list for display - * @return string (ul list in html ) + * @param array $TMergedSkills skill list for display + * @return string (ul list in html ) */ function skillList(&$TMergedSkills) { diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index c7a0e1bd988..a1e71528361 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -4,6 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -481,6 +482,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $rslt = $db->query($sqlEval); $numEval = $db->num_rows($sqlEval); + $page = 0; print_barre_liste($langs->trans("Evaluations"), $page, $_SERVER["PHP_SELF"], '', '', '', '', $numEval, $numEval, $evaltmp->picto, 0); print '
'; @@ -547,6 +549,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print dol_get_fiche_end(); - - llxFooter(); } + +llxFooter(); +$db->close(); diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 8abfb691119..871030cb774 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -7,6 +7,7 @@ * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2021 Charlene Benke * Copyright (C) 2023 Alexandre Janniaux + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,24 +141,39 @@ if (php_sapi_name() === "cli" && (float) PHP_VERSION > 7.0) { case 'config': $conffile = $arg; $conffiletoshow = $arg; - break; + break; case 'h': case 'help': usage($argv[0], "Usage:"); - exit(0); + exit(0); } } // Parse the arguments to find the options. - $args_options = array_filter(array_slice($argv, 0, $rest_index), function ($arg) { - return strlen($arg) >= 2 && $arg[0] == '-'; - }); - $parsed_options = array_map(function ($arg) { - if (strlen($arg) > 1) { - return "--" . $arg; + $args_options = array_filter( + array_slice($argv, 0, $rest_index), + /** + * @param string $arg + * @return bool + */ + static function ($arg) { + return strlen($arg) >= 2 && $arg[0] == '-'; } - return "-" . $arg; - }, array_keys($opts)); + ); + $parsed_options = array_map( + /** + * Previx option with '-' for single characters and -- for more than single characters + * @param string $arg + * @return string + */ + static function ($arg) { + if (strlen($arg) > 1) { + return "--" . $arg; + } + return "-" . $arg; + }, + array_keys($opts) + ); // Find options (dash-prefixed) that were not parsed. $unknown_options = array_diff($args_options, $parsed_options); @@ -301,7 +317,7 @@ if (constant('DOL_DATA_ROOT') === null) { $lockfile = '../../documents/install.lock'; $upgradeunlockfile = '../../documents/upgrade.unlock'; } -$islocked=false; +$islocked = false; if (@file_exists($lockfile) || @file_exists($lockfile2)) { if (!defined('ALLOWED_IF_UPGRADE_UNLOCK_FOUND') || (! @file_exists($upgradeunlockfile) && ! @file_exists($upgradeunlockfile2))) { // If this is a dangerous install page (ALLOWED_IF_UPGRADE_UNLOCK_FOUND not defined) or diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 958a0c65797..5ed3730adc1 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -60,7 +60,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_MODIFY','Customer invoice modified','Executed when a customer invoice is modified','facture',7); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is canceled','facture',8); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_DELETE','Customer invoice deleted','Executed when a customer invoice is deleted','facture',9); diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index 4f50ee95936..9c9f6dd01ee 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -232,8 +232,8 @@ ALTER TABLE llx_knowledgemanagement_knowledgerecord MODIFY COLUMN answer longtex -- Rename const to add customer categories on not customer/prospect third-party if enabled UPDATE llx_const SET name = 'THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT' WHERE name = 'THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER'; -ALTER TABLE llx_fichinter ADD COLUMN signed_status integer DEFAULT NULL AFTER duree; -ALTER TABLE llx_contrat ADD COLUMN signed_status integer DEFAULT NULL AFTER date_contrat; +ALTER TABLE llx_fichinter ADD COLUMN signed_status smallint DEFAULT NULL AFTER duree; +ALTER TABLE llx_contrat ADD COLUMN signed_status smallint DEFAULT NULL AFTER date_contrat; ALTER TABLE llx_mailing ADD COLUMN messtype varchar(16) DEFAULT 'email' after rowid; @@ -268,3 +268,11 @@ ALTER TABLE llx_facture_fourn ADD INDEX idx_facture_fourn_tms (tms); ALTER TABLE llx_element_element MODIFY COLUMN sourcetype VARCHAR(64) NOT NULL; ALTER TABLE llx_element_element MODIFY COLUMN targettype VARCHAR(64) NOT NULL; ALTER TABLE llx_c_type_contact MODIFY COLUMN element VARCHAR(64) NOT NULL; + +ALTER TABLE llx_product_association ADD COLUMN import_key varchar(14) DEFAULT NULL; + +ALTER TABLE llx_ticket ADD COLUMN barcode varchar(255) DEFAULT NULL after extraparams; +ALTER TABLE llx_ticket ADD COLUMN fk_barcode_type integer DEFAULT NULL after barcode; + +ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_ticket_barcode_barcode_type (barcode, fk_barcode_type, entity); +ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 54eac887362..eccb6f49fe8 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -17,7 +17,7 @@ -- along with this program. If not, see . -- -- --- Table of events and actions (past and to do). +-- Table of events and actions (past and to do). -- This is also the table to track events on other Dolibarr objects. -- ======================================================================== @@ -31,7 +31,7 @@ create table llx_actioncomm datep2 datetime, -- date end fk_action integer, -- type of action (optional link with id in llx_c_actioncomm or null) - code varchar(50) NULL, -- code of action for automatic action ('AC_OTH_AUTO' for automatic actions, 'AC_EMAILIN_AUTO' for email input, 'AC_xxx' for manual action...) + code varchar(50) NULL, -- code of action for automatic action ('AC_OTH_AUTO' for automatic actions, 'AC_EMAILIN_AUTO' for email input, 'AC_xxx' for manual action...) datec datetime, -- date creation tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date @@ -43,7 +43,6 @@ create table llx_actioncomm fk_contact integer, fk_parent integer NOT NULL default 0, fk_user_action integer, -- user id of owner of action (note that users assigned to event are stored into table 'actioncomm_resources') - fk_user_done integer, -- user id of user that has made action (deprecated) transparency integer, -- transparency (ical standard). used to say if user assigned to event are busy or not by event. This field may be deprecated if we want to store transparency for each assigned user, moved into table llx_actioncomm_resources. @@ -56,9 +55,9 @@ create table llx_actioncomm label varchar(255) NOT NULL, -- label/title of event or topic of email note mediumtext, -- private note of event or content of email - + calling_duration integer, -- when event is a phone call, duration of phone call - + email_subject varchar(255), -- when event was an email, we store here the subject. content is stored into note. email_msgid varchar(255), -- when event was an email, we store here the msgid email_from varchar(255), -- when event was an email, we store here the from @@ -68,7 +67,7 @@ create table llx_actioncomm email_tobcc varchar(255), -- when event was an email, we store here the email_tobcc errors_to varchar(255), -- when event was an email, we store here the erros_to reply_to varchar(255), -- when event was an email, we store here the reply_to - + recurid varchar(128), -- used to store event id to link each other all the repeating event record. It can be the 'iCalUID' as in RFC5545 (an id similar for all the same serie) recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO' recurdateend datetime, -- no more recurring event after this date diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index 2e01e909127..53c97061102 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -29,7 +29,7 @@ create table llx_contrat tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- creation date date_contrat datetime, - signed_status integer DEFAULT NULL, -- signed status + signed_status smallint DEFAULT NULL, -- signed status statut smallint DEFAULT 0, -- not used. deprecated fin_validite datetime, date_cloture datetime, diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 4065f3c64b8..5832ce07e9f 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -39,7 +39,7 @@ create table llx_fichinter datee date, -- date de fin d'intervention datet date, -- date de terminaison de l'intervention duree real, -- duree totale de l'intervention - signed_status integer DEFAULT NULL, -- signed status + signed_status smallint DEFAULT NULL, -- signed status description text, note_private text, note_public text, diff --git a/htdocs/install/mysql/tables/llx_product_association.key.sql b/htdocs/install/mysql/tables/llx_product_association.key.sql index 9eb9fdd457b..c9dca6e611e 100644 --- a/htdocs/install/mysql/tables/llx_product_association.key.sql +++ b/htdocs/install/mysql/tables/llx_product_association.key.sql @@ -20,3 +20,4 @@ ALTER TABLE llx_product_association ADD UNIQUE INDEX uk_product_association (fk_product_pere, fk_product_fils); ALTER TABLE llx_product_association ADD INDEX idx_product_association_fils (fk_product_fils); + diff --git a/htdocs/install/mysql/tables/llx_product_association.sql b/htdocs/install/mysql/tables/llx_product_association.sql index f97e2aa6a0b..55ce8cc9d78 100644 --- a/htdocs/install/mysql/tables/llx_product_association.sql +++ b/htdocs/install/mysql/tables/llx_product_association.sql @@ -24,6 +24,7 @@ create table llx_product_association fk_product_fils integer NOT NULL DEFAULT 0, -- id du sous-produit qty double NULL, incdec integer DEFAULT 1, -- when set to 1 changing stock of product will change stock of linked product too - rang integer DEFAULT 0 + rang integer DEFAULT 0, + import_key varchar(14) DEFAULT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql index 858f7c7eec5..e7bd5174263 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql @@ -22,7 +22,10 @@ ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_user_assign (fk_user_assign); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_project (fk_project); ALTER TABLE llx_ticket ADD INDEX idx_ticket_fk_statut (fk_statut); +ALTER TABLE llx_ticket ADD UNIQUE INDEX uk_ticket_barcode_barcode_type (barcode, fk_barcode_type, entity); +ALTER TABLE llx_ticket ADD CONSTRAINT llx_ticket_fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type (rowid); + -- Idea for better perf to get last num of ticket on large databases ---ALTER TABLE llx_ticket ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TS' THEN CAST(SUBSTRING(ref FROM 8) AS SIGNED) ELSE 0 END) PERSISTENT; ---ALTER TABLE llx_ticket ADD INDEX idx_calculated_numrefonly (calculated_numrefonly); ---Then, the numering module can use the column calculated_numrefonly to get the max with SELECT MAX(calculated_numrefonly) FROM llx_ticket +-- ALTER TABLE llx_ticket ADD COLUMN calculated_numrefonly INTEGER AS (CASE SUBSTRING(ref FROM 1 FOR 2) WHEN 'TS' THEN CAST(SUBSTRING(ref FROM 8) AS SIGNED) ELSE 0 END) PERSISTENT; +-- ALTER TABLE llx_ticket ADD INDEX idx_calculated_numrefonly (calculated_numrefonly); +-- Then, the numering module can use the column calculated_numrefonly to get the max with SELECT MAX(calculated_numrefonly) FROM llx_ticket diff --git a/htdocs/install/mysql/tables/llx_ticket-ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql index 67e7ca419dd..cda890c6f69 100644 --- a/htdocs/install/mysql/tables/llx_ticket-ticket.sql +++ b/htdocs/install/mysql/tables/llx_ticket-ticket.sql @@ -49,5 +49,7 @@ CREATE TABLE llx_ticket model_pdf varchar(255), last_main_doc varchar(255), -- relative filepath+filename of last main generated document extraparams varchar(255), -- to save other parameters with json format + barcode varchar(255) DEFAULT NULL, -- barcode + fk_barcode_type integer DEFAULT NULL, -- barcode type import_key varchar(14) )ENGINE=innodb; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index bd4aeec2174..21168aea09f 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -99,26 +99,26 @@ class KnowledgeRecord extends CommonObject // BEGIN MODULEBUILDER PROPERTIES /** - * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + * @var array|string,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => '1', 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => '1', 'index' => 1, 'css' => 'left', 'comment' => "Id"), - 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => '1', 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'visible' => 5, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", "csslist" => "nowraponall", "showoncombobox" => 1), - 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 20, 'index' => 1), - 'question' => array('type' => 'text', 'label' => 'Question', 'enabled' => '1', 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), - 'lang' => array('type' => 'varchar(6)', 'label' => 'Language', 'enabled' => '1', 'position' => 40, 'notnull' => 0, 'visible' => 1, 'tdcss' => 'titlefieldcreate nowraponall', "csslist" => "tdoverflowmax100"), - 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => '1', 'position' => 500, 'notnull' => 1, 'visible' => -2,), - 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => '1', 'position' => 501, 'notnull' => 0, 'visible' => 2,), - 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 0,), - 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserCreation', 'enabled' => '1', 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), - 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => '1', 'position' => 511, 'notnull' => -1, 'visible' => -2,), - 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => '1', 'position' => 512, 'notnull' => 0, 'visible' => -2,), - 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'position' => 1000, 'notnull' => -1, 'visible' => -2,), - 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => '1', 'position' => 1010, 'notnull' => -1, 'visible' => 0,), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => "Id"), + 'ref' => array('type' => 'varchar(128)', 'label' => 'Ref', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'default' => '(PROV)', 'visible' => 5, 'index' => 1, 'searchall' => 1, 'comment' => "Reference of object", "csslist" => "nowraponall", "showoncombobox" => 1), + 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => 0, 'notnull' => 1, 'position' => 20, 'index' => 1), + 'question' => array('type' => 'text', 'label' => 'Question', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), + 'lang' => array('type' => 'varchar(6)', 'label' => 'Language', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => 1, 'tdcss' => 'titlefieldcreate nowraponall', "csslist" => "tdoverflowmax100"), + 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -2,), + 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => 2,), + 'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 0,), + 'fk_user_creat' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserCreation', 'enabled' => 1, 'position' => 510, 'notnull' => 1, 'visible' => -2, 'foreignkey' => 'user.rowid',), + 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), + 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'position' => 512, 'notnull' => 0, 'visible' => -2,), + 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), + 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), //'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'), 'fk_c_ticket_category' => array('type' => 'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label' => 'SuggestedForTicketsInGroup', 'enabled' => 'isModEnabled("ticket")', 'position' => 520, 'notnull' => 0, 'visible' => -1, 'help' => 'YouCanLinkArticleToATicketCategory', 'csslist' => 'minwidth200 tdoverflowmax250'), - 'answer' => array('type' => 'html', 'label' => 'Solution', 'enabled' => '1', 'position' => 600, 'notnull' => 0, 'visible' => 3, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), - 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => '1', 'position' => 1000, 'notnull' => 1, 'visible' => 5, 'default' => 0, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Obsolete'),), + 'answer' => array('type' => 'html', 'label' => 'Solution', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => 3, 'searchall' => 1, 'csslist' => 'tdoverflowmax300', 'copytoclipboard' => 1, 'tdcss' => 'titlefieldcreate nowraponall'), + 'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 5, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Obsolete'),), ); public $rowid; public $ref; @@ -189,7 +189,7 @@ class KnowledgeRecord extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php index 3d509d7d25c..c4652df83b1 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +155,7 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is } else { - $num = sprintf("%04s", $max + 1); + $num = sprintf("%04d", $max + 1); } dol_syslog("mod_knowledgerecord_standard::getNextValue return ".$this->prefix.$yymm."-".$num); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 576180c6371..f20f46f5c03 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -88,6 +88,8 @@ SearchString=Search string NotAvailableWhenAjaxDisabled=Not available when Ajax disabled AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party TimesheetPreventAfterFollowingMonths=Prevent recording time spent after the following number of months +PROJECT_DISPLAY_LINKED_BY_CONTACT=Display project linked by a common contact +PROJECT_DISPLAY_LINKED_BY_CONTACT_help=That option add a new list on Project tab with all projects linked to that thirdparty via a contact relationship JavascriptDisabled=JavaScript disabled UsePreviewTabs=Use preview tabs ShowPreview=Show preview diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 70ce8809858..8ce39450cd8 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -21,7 +21,6 @@ MenuDoneMyActions=My terminated events ListOfEvents=List of events (default calendar) ActionsAskedBy=Events reported by ActionsToDoBy=Events assigned to -ActionsDoneBy=Events done by ActionAssignedTo=Event assigned to ViewCal=Month view ViewDay=Day view diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 2f6e4da03dc..7b0ab3ed30e 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -47,7 +47,6 @@ LastProspectToContact=To contact LastProspectContactInProcess=Contact in process LastProspectContactDone=Contact done ActionAffectedTo=Event assigned to -ActionDoneBy=Event done by ActionAC_TEL=Phone call ActionAC_FAX=Send fax ActionAC_PROP=Send proposal by mail diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 57b3cf539cf..526483b1339 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -6,7 +6,7 @@ ErrorSetACountryFirst=Set the country first SelectThirdParty=Select a third party ConfirmDeleteCompany=Are you sure you want to delete this company and all related information? DeleteContact=Delete a contact/address -ConfirmDeleteContact=Are you sure you want to delete this contact and all related information? +ConfirmDeleteContact=Are you sure you want to delete this contact? MenuNewThirdParty=New Third Party MenuNewCustomer=New Customer MenuNewProspect=New Prospect @@ -527,4 +527,4 @@ HideSocialNetworks=Hide social networks ExternalSystemID=External system ID IDOfPaymentInAnExternalSystem=ID of the payment mode into an external system (like Stripe, Paypal, ...) AADEWebserviceCredentials=AADE Webservice Credentials -ThirdPartyMustBeACustomerToCreateBANOnStripe=The third-party must be a customer to allow the creation of its bank info on Stripe side +ThirdPartyMustBeACustomerToCreateBANOnStripe=The third-party must be a customer to allow the creation of its bank info on Stripe side diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 3290d9a2251..d8ebfa352e5 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -332,6 +332,8 @@ ErrorDictionaryNotFound=Dictionary %s not found ErrorFailedToCreateSymLinkToMedias=Failed to create the symbolic link %s to point to %s ErrorCheckTheCommandInsideTheAdvancedOptions=Check the command used for the export into the Advanced options of the export +ErrorEndTimeMustBeGreaterThanStartTime=End time must be greater than start time +ErrorIncoherentDates=Date start must be less than date end # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. @@ -374,7 +376,7 @@ WarningModuleNeedRefresh = Module %s has been disabled. Don't forget to e WarningPermissionAlreadyExist=Existing permissions for this object WarningGoOnAccountancySetupToAddAccounts=If this list is empty, go into menu %s - %s - %s to load or create accounts for your chart of account. WarningCorrectedInvoiceNotFound=Corrected invoice not found -WarningCommentNotFound=Please check placement of start and end comments for %s section in file %s before submitting your action +WarningCommentNotFound=Warning: Can't find the start and/or end comments for the section %s into the file %s WarningAlreadyReverse=Stock movement already reversed SwissQrOnlyVIR = SwissQR invoice can only be added on invoices set to be paid with credit transfer payments. @@ -412,3 +414,4 @@ ThisIdNotDefined=Id not defined OperNotDefined=Payment method not defined ErrorThisContactXIsAlreadyDefinedAsThisType=%s is already defined as contact for this type. ErrorThisGroupIsAlreadyDefinedAsThisType=The contacts with this group are already defined as contact for this type. +EmptyMessageNotAllowedError=Empty Message Not Allowed Error diff --git a/htdocs/langs/en_US/help.lang b/htdocs/langs/en_US/help.lang index 17a6104d59a..88a1b006591 100644 --- a/htdocs/langs/en_US/help.lang +++ b/htdocs/langs/en_US/help.lang @@ -21,3 +21,4 @@ LinkToGoldMember=You can call one of the trainers preselected by Dolibarr for yo PossibleLanguages=Supported languages SubscribeToFoundation=Help the Dolibarr project, subscribe to the foundation SeeOfficalSupport=For official Dolibarr support in your language:
%s +AIProcessingPleaseWait=AI interrogation in progress, please wait... \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 95042a5cc24..f519e098d01 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -562,6 +562,7 @@ New=New Discount=Discount Unknown=Unknown General=General +Dimensions=Dimensions Size=Size OriginalSize=Original size RotateImage=Rotate 90° diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index c59c4271710..9ff542d9799 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -165,7 +165,7 @@ BadValueForType=Bad value for type %s DefinePropertiesFromExistingTable=Define the fields/properties from an existing table DefinePropertiesFromExistingTableDesc=If a table in the database (for the object to create) already exists, you can use it to define the properties of the object. DefinePropertiesFromExistingTableDesc2=Keep empty if the table does not exist yet. The code generator will use different kinds of fields to build an example of table that you can edit later. -GeneratePermissions=I want to manage permissions on this object +GeneratePermissions=I want to manage permissions on this object GeneratePermissionsHelp=If you check this, some code will be added to manage permissions to read, write and delete record of the objects PermissionDeletedSuccesfuly=Permission has been successfully removed PermissionUpdatedSuccesfuly=Permission has been successfully updated @@ -173,6 +173,7 @@ PermissionAddedSuccesfuly=Permission has been successfully added MenuDeletedSuccessfuly=Menu has been successfully deleted MenuAddedSuccessfuly=Menu has been successfully added MenuUpdatedSuccessfuly=Menu has been successfully updated +AddAPIsForThisObject=Add APIs for this object ApiObjectDeleted=API for object %s has been successfully deleted CRUDRead=Read CRUDCreateWrite=Create or Update @@ -181,8 +182,8 @@ DictionariesCreated=Dictionary %s created successfully DictionaryDeleted=Dictionary %s removed successfully PropertyModuleUpdated=Property %s has been update successfully InfoForApiFile=* When you generate file for the first time then all methods will be created for each object.
* When you click in remove you just remove all methods for the selected object. -SetupFile=Page for module setup +SetupFile=Page for module setup EmailingSelectors=Emails selectors EmailingSelectorDesc=You can generate and edit here the class files to provide new email target selectors for the mass emailing module EmailingSelectorFile=Emails selector file -NoEmailingSelector=No emails selector file \ No newline at end of file +NoEmailingSelector=No emails selector file diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index a1e25cea1af..12955cc9f0e 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -207,6 +207,7 @@ EMailTextInterventionValidated=The intervention %s has been validated. EMailTextInterventionClosed=The intervention %s has been closed. EMailTextInvoiceValidated=Invoice %s has been validated. EMailTextInvoicePayed=Invoice %s has been paid. +EMailTextInvoiceCanceled=Invoice %s has been canceled. EMailTextProposalValidated=Proposal %s has been validated. EMailTextProposalClosedSigned=Proposal %s has been closed signed. EMailTextProposalClosedSignedWeb=Proposal %s has been closed signed on portal page. @@ -214,6 +215,7 @@ EMailTextProposalClosedRefused=Proposal %s has been closed refused. EMailTextProposalClosedRefusedWeb=Proposal %s has been closed refuse on portal page. EMailTextOrderValidated=Order %s has been validated. EMailTextOrderClose=Order %s has been delivered. +EMailTextOrderCanceled=Order %s has been canceled. EMailTextSupplierOrderApprovedBy=Purchase order %s has been approved by %s. EMailTextSupplierOrderValidatedBy=Purchase order %s has been recorded by %s. EMailTextSupplierOrderSubmittedBy=Purchase order %s has been submitted by %s. @@ -327,6 +329,7 @@ SetupOfFTPClientModuleNotComplete=The setup of the FTP or SFTP client module see FTPFeatureNotSupportedByYourPHP=Your PHP does not support FTP or SFTP functions FailedToConnectToFTPServer=Failed to connect to server (server %s, port %s) FailedToConnectToFTPServerWithCredentials=Failed to login to server with defined login/password +FailedToChdirOnFTPServer=Failed to change directory on the FTP server FTPFailedToRemoveFile=Failed to remove file %s. FTPFailedToRemoveDir=Failed to remove directory %s: check permissions and that the directory is empty. FTPPassiveMode=Passive mode diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 93bf150de17..dbdc58acdcb 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -437,3 +437,4 @@ AllowStockMovementVariantParent=Also records stock movements on parent products AllowStockMovementVariantParentHelp=By default, a parent of a variant is a virtual product, so no stock is managed for it. By enabling this option, a stock will be managed for parent products and each time a stock quantity is modified for a variant product, the same quantity will be modified for the parent product. You should not need this option, except if you are using variant to manage the same product than parent (but with different descriptions, prices...) ConfirmSetToDraftInventory=Are you sure you want to go back to Draft status?
The quantities currently set in the inventory will be reset. WarningLineProductNotToSell=Product or service "%s" is not to sell and was cloned +PriceLabel=Price label diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index f0d303285d4..3b0ec6edb3d 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -142,6 +142,7 @@ DoNotShowMyTasksOnly=See also tasks not assigned to me ShowMyTasksOnly=View only tasks assigned to me TaskRessourceLinks=Contacts of task ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party +ProjectsLinkedToThisThirdParty=Projects having a contact that is a contact of the third party NoTasks=No tasks for this project LinkedToAnotherCompany=Linked to other third party TaskIsNotAssignedToUser=Task not assigned to user. Use button '%s' to assign task now. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 2857c585ba4..3750b9bab8a 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -88,6 +88,8 @@ SearchString=Chaîne de recherche NotAvailableWhenAjaxDisabled=Non disponible quand Ajax est désactivé AllowToSelectProjectFromOtherCompany=Sur les éléments d'un tiers, autorise la sélection d'un projet lié à un autre tiers TimesheetPreventAfterFollowingMonths=Empêcher l'enregistrement du temps consacré après le nombre de mois suivant +PROJECT_DISPLAY_LINKED_BY_CONTACT=Afficher les projets liés par un contact +PROJECT_DISPLAY_LINKED_BY_CONTACT_help=Cette option permet d'ajouter la liste de tous les projets dans lesquels un des contact du tiers est rattaché JavascriptDisabled=Javascript désactivé UsePreviewTabs=Afficher les onglets "Aperçu" ShowPreview=Afficher aperçu diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index b794cbde418..a939cc392ba 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -436,3 +436,4 @@ WarningConvertFromBatchToSerial=Si vous disposez actuellement d'une quantité su AllowStockMovementVariantParent=Enregistre également les mouvements de stock sur les produits parent des produits variants AllowStockMovementVariantParentHelp=Par défaut, un parent d'une variante est un produit virtuel, donc aucun stock n'est géré pour celui-ci. En activant cette option, un stock sera géré pour les produits parents et à chaque fois qu'une quantité de stock est modifiée pour une variante de produit, la même quantité sera modifiée pour le produit parent. Vous ne devriez pas avoir besoin de cette option, sauf si vous utilisez une variante pour gérer le même produit que le parent (mais avec des descriptions, des prix différents...) ConfirmSetToDraftInventory=Êtes-vous sûr de vouloir revenir à l'état de brouillon ?
Les quantités actuellement définies dans l'inventaire seront réinitialisées. +PriceLabel=Libellé du prix diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 962372b874b..d5d1f2ce01c 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -142,6 +142,7 @@ DoNotShowMyTasksOnly=Voir aussi les tâches qui ne me sont pas affectées ShowMyTasksOnly=Ne voir que les tâches qui me sont affectées TaskRessourceLinks=Contacts de la tâche ProjectsDedicatedToThisThirdParty=Projets dédiés à ce tiers +ProjectsLinkedToThisThirdParty=Projets liés à ce tiers par un contact commun NoTasks=Aucune tâche pour ce projet LinkedToAnotherCompany=Liés à autre société TaskIsNotAssignedToUser=Tâche non assignée à l'utilisateur. Utilisez le bouton '%s' pour assigner la tâche maintenant. diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 17fd78aa8c1..803717ae085 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -258,7 +258,7 @@ if (empty($reshook)) { $form = new Form($db); $formproject = new FormProjets($db); -$morehtmlright = ''; +$morehtmlstatus = ''; $outputlangs = $langs; if (isModEnabled('accounting')) { $formaccounting = new FormAccounting($db); @@ -474,7 +474,7 @@ if ($id > 0) { $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index f095f480a04..d1e34bbbdf9 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2014-2018 Alexandre Spangaro * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2020 Maxime DEMAREST + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,14 +63,23 @@ class PaymentLoan extends CommonObject public $datep = ''; /** - * @var array Array of amounts + * @var array Array of amounts */ public $amounts = array(); - public $amount_capital; // Total amount of payment + /** + * @var float|int Total amount of payment + */ + public $amount_capital; + /** + * @var float|int + */ public $amount_insurance; + /** + * @var float|int + */ public $amount_interest; /** @@ -98,11 +108,28 @@ class PaymentLoan extends CommonObject */ public $fk_user_modif; + /** + * @var string + */ public $type_code; + /** + * @var string + */ public $type_label; public $chid; + /** + * @var string + */ public $label; + + /** + * @var int + */ public $paymenttype; + + /** + * @var int + */ public $bank_account; public $bank_line; @@ -521,7 +548,7 @@ class PaymentLoan extends CommonObject // Insert payment into llx_bank $bank_line_id = $acc->addline( $this->datep, - $this->paymenttype, // Payment mode ID or code ("CHQ or VIR for example") + $this->paymenttype, // Payment mode ID or code ("CHQ or VIR for example") it's integer in db $label, $total, $this->num_payment, @@ -666,7 +693,7 @@ class PaymentLoan extends CommonObject global $action; $hookmanager->initHooks(array($this->element . 'dao')); - $parameters = array('id'=>$this->id, 'getnomurl' => &$result); + $parameters = array('id' => $this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { $result = $hookmanager->resPrint; diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 1b6f586bb58..74b96bf0877 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -140,7 +141,8 @@ if ($object->id) { $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + $morehtmlstatus = $morehtmlright; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php index 436caf903d2..b437a73b845 100644 --- a/htdocs/loan/info.php +++ b/htdocs/loan/info.php @@ -1,6 +1,7 @@ * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -102,7 +103,8 @@ $morehtmlref .= '
'; $linkback = ''.$langs->trans("BackToList").''; -dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); +$morehtmlstatus = $morehtmlright; +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/note.php b/htdocs/loan/note.php index 27a9d0bc70b..62d84a1adbc 100644 --- a/htdocs/loan/note.php +++ b/htdocs/loan/note.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Frederic France * Copyright (C) 2016-2023 Alexandre Spangaro * Copyright (C) 2017 Ferran Marcet + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -129,7 +130,8 @@ if ($id > 0) { $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + $morehtmlstatus = $morehtmlright; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 2afeb25b322..31b71d49a3d 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -103,9 +103,9 @@ if ($action == 'delete') { $linkback = ''; $morehtmlref = ''; -$morehtmlright = ''; +$morehtmlstatus = ''; -dol_banner_tab($payment, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); +dol_banner_tab($payment, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); print '
'; print '
'; diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index 1864c309298..ae61486bcfe 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -185,9 +185,9 @@ if (isModEnabled('project')) { } $morehtmlref .= '
'; -$morehtmlright = ''; +$morehtmlstatus = ''; -dol_banner_tab($object, 'loanid', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); +dol_banner_tab($object, 'loanid', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus); ?>
  '; -print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Scheduled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); +print $form->selectarray('search_status', array('0' => $langs->trans("Disabled"), '1' => $langs->trans("Scheduled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage'); print ' '; if (!empty($datelastresult) && ($datelastresult >= $datelastrun)) { $nbseconds = max($datelastresult - $datelastrun, 1); - print $nbseconds.' '.($nbseconds > 1 ? $langs->trans("SecondShort") : $langs->trans("SecondShort")); + print $nbseconds.' '.$langs->trans("SecondShort"); } print '