From 89a4c51153846cc32cad413514595f95b4102e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 10 Mar 2014 21:13:16 +0100 Subject: [PATCH 01/44] Added es_CL language --- ChangeLog | 1 + htdocs/langs/en_US/languages.lang | 1 + htdocs/langs/es_CL/admin.lang | 23 +++++++++++ htdocs/langs/es_CL/agenda.lang | 2 + htdocs/langs/es_CL/bills.lang | 1 + htdocs/langs/es_CL/boxes.lang | 5 +++ htdocs/langs/es_CL/commercial.lang | 4 ++ htdocs/langs/es_CL/companies.lang | 2 + htdocs/langs/es_CL/compta.lang | 1 + htdocs/langs/es_CL/ecm.lang | 2 + htdocs/langs/es_CL/install.lang | 1 + htdocs/langs/es_CL/main.lang | 1 + htdocs/langs/es_CL/members.lang | 1 + htdocs/langs/es_CL/orders.lang | 1 + htdocs/langs/es_CL/other.lang | 9 +++++ htdocs/langs/es_CL/products.lang | 3 ++ htdocs/langs/es_CL/projects.lang | 1 + htdocs/langs/es_CL/propal.lang | 62 ++++++++++++++++++++++++++++++ htdocs/langs/es_CL/workflow.lang | 3 ++ 19 files changed, 124 insertions(+) create mode 100644 htdocs/langs/es_CL/admin.lang create mode 100644 htdocs/langs/es_CL/agenda.lang create mode 100644 htdocs/langs/es_CL/bills.lang create mode 100644 htdocs/langs/es_CL/boxes.lang create mode 100644 htdocs/langs/es_CL/commercial.lang create mode 100644 htdocs/langs/es_CL/companies.lang create mode 100644 htdocs/langs/es_CL/compta.lang create mode 100644 htdocs/langs/es_CL/ecm.lang create mode 100644 htdocs/langs/es_CL/install.lang create mode 100644 htdocs/langs/es_CL/main.lang create mode 100644 htdocs/langs/es_CL/members.lang create mode 100644 htdocs/langs/es_CL/orders.lang create mode 100644 htdocs/langs/es_CL/other.lang create mode 100644 htdocs/langs/es_CL/products.lang create mode 100644 htdocs/langs/es_CL/projects.lang create mode 100644 htdocs/langs/es_CL/propal.lang create mode 100644 htdocs/langs/es_CL/workflow.lang diff --git a/ChangeLog b/ChangeLog index 90b6922d60b..84bf41116f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ Fix: Page load not ending when large number of thirdparies. We combo feature that is root cause of problem. Fix: [ bug #1231 ] PDF always generated in interventions Fix: Be sure there is no duplicate default rib. +New: Added es_CL language ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 5bd2c698dce..741295ed69f 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -19,6 +19,7 @@ Language_en_US=English (United States) Language_en_ZA=English (South Africa) Language_es_ES=Spanish Language_es_AR=Spanish (Argentina) +Language_es_CL=Spanish (Chile) Language_es_HN=Spanish (Honduras) Language_es_MX=Spanish (Mexico) Language_es_PY=Spanish (Paraguay) diff --git a/htdocs/langs/es_CL/admin.lang b/htdocs/langs/es_CL/admin.lang new file mode 100644 index 00000000000..20f6fdfea33 --- /dev/null +++ b/htdocs/langs/es_CL/admin.lang @@ -0,0 +1,23 @@ +Module20Name=Cotizaciones +Module20Desc=Gestión de cotizaciones/propuestas comerciales +Permission21=Consultar cotizaciones +Permission22=Crear/modificar cotizaciones +Permission24=Validar cotizaciones +Permission25=Enviar las cotizaciones +Permission26=Cerrar cotizaciones +Permission27=Eliminar cotizaciones +Permission28=Exportar las cotizaciones +DictionnarySource=Orígenes de cotizaciones/pedidos +VATIsUsedDesc=El tipo de IVA propuesto por defecto en las creaciones de cotizaciones, facturas, pedidos, etc. Responde a la siguiente regla:
Si el vendedor no está sujeto a IVA, IVA por defecto=0. Final de regla.
Si el país del vendedor= país del comprador entonces IVA por defecto=IVA del producto vendido. Final de regla.
Si vendedor y comprador residen en la Comunidad Europea y el bien vendido= nuevo medio de transportes (auto, barco, avión), IVA por defecto=0 (el IVA debe ser pagado por comprador a la hacienda pública de su país y no al vendedor). Final de regla
Si vendedor y comprador residen en la Comunidad Europea y comprador= particular o empresa sin NIF intracomunitario entonces IVA por defecto=IVA del producto vendido. Final de regla.
Si vendedor y comprador residen en la Comunidad Europea y comprador= empresa con NIF intracomunitario entonces IVA por defecto=0. Final de regla.
Si no, IVA propuesto por defecto=0. Final de regla.
+VATIsNotUsedDesc=El tipo de IVA propuesto por defecto es 0. Este es el caso de asociaciones, particulares o algunas pequeñas sociedades. +VATIsUsedExampleFR=En Francia, se trata de las sociedades u organismos que eligen un régimen fiscal general (General simplificado o General normal), régimen en el cual se declara el IVA. +Delays_MAIN_DELAY_PROPALS_TO_CLOSE=Tolerancia de retraso antes de la alerta (en días) sobre cotizaciones a cerrar +Delays_MAIN_DELAY_PROPALS_TO_BILL=Tolerancia de retraso antes de la alerta (en días) sobre cotizaciones no facturadas +WebCalAddEventOnStatusPropal=Añadir evento en el calendario en el cambio de estado de las cotizaciones +PropalSetup=Configuración del módulo Cotizaciones +ProposalsNumberingModules=Módulos de numeración de cotizaciones +ProposalsPDFModules=Modelos de documentos de cotizaciones +HideTreadedPropal=Ocultar las cotizaciones procesados del listado +FreeLegalTextOnProposal=Texto libre en cotizaciones +WatermarkOnDraftProposal=Marca de agua en cotizaciones borrador (en caso de estar vacío) +FCKeditorForProductDetails=Creación/edición WYSIWIG de las líneas de detalle de los productos (en pedidos, cotizaciones, facturas, etc.) \ No newline at end of file diff --git a/htdocs/langs/es_CL/agenda.lang b/htdocs/langs/es_CL/agenda.lang new file mode 100644 index 00000000000..deefdc2275c --- /dev/null +++ b/htdocs/langs/es_CL/agenda.lang @@ -0,0 +1,2 @@ +PropalValidatedInDolibarr=Cotización %s validada +ProposalSentByEMail=Cotización %s enviada por e-mail \ No newline at end of file diff --git a/htdocs/langs/es_CL/bills.lang b/htdocs/langs/es_CL/bills.lang new file mode 100644 index 00000000000..63a78444437 --- /dev/null +++ b/htdocs/langs/es_CL/bills.lang @@ -0,0 +1 @@ +RelatedCommercialProposals=Cotizaciones asociadas \ No newline at end of file diff --git a/htdocs/langs/es_CL/boxes.lang b/htdocs/langs/es_CL/boxes.lang new file mode 100644 index 00000000000..970c91a8fe5 --- /dev/null +++ b/htdocs/langs/es_CL/boxes.lang @@ -0,0 +1,5 @@ +BoxLastProposals=Últimas cotizaciones +BoxTitleLastPropals=Las %s últimas cotizaciones registradas +NoRecordedProposals=Sin cotizaciones registradas +BoxProposalsPerMonth=Cotizaciones por mes +ForProposals=Cotizaciones \ No newline at end of file diff --git a/htdocs/langs/es_CL/commercial.lang b/htdocs/langs/es_CL/commercial.lang new file mode 100644 index 00000000000..d468d7d5f19 --- /dev/null +++ b/htdocs/langs/es_CL/commercial.lang @@ -0,0 +1,4 @@ +SendPropalRef=Envío de la cotización %s +ActionAC_PROP=Envío cotización por correo +DraftPropals=Cotizaciones borrador +SearchPropal=Buscar una cotización \ No newline at end of file diff --git a/htdocs/langs/es_CL/companies.lang b/htdocs/langs/es_CL/companies.lang new file mode 100644 index 00000000000..daef89c75cf --- /dev/null +++ b/htdocs/langs/es_CL/companies.lang @@ -0,0 +1,2 @@ +ContactForProposals=Contacto de cotizaciones +NoContactForAnyProposal=Este contacto no es contacto de ninguna cotización \ No newline at end of file diff --git a/htdocs/langs/es_CL/compta.lang b/htdocs/langs/es_CL/compta.lang new file mode 100644 index 00000000000..bf18ae78c5f --- /dev/null +++ b/htdocs/langs/es_CL/compta.lang @@ -0,0 +1 @@ +ProposalStats=Estadísticas de cotizaciones \ No newline at end of file diff --git a/htdocs/langs/es_CL/ecm.lang b/htdocs/langs/es_CL/ecm.lang new file mode 100644 index 00000000000..3e20b3e6628 --- /dev/null +++ b/htdocs/langs/es_CL/ecm.lang @@ -0,0 +1,2 @@ +DocsProposals=Documentos cotizaciones +ECMDocsByProposals=Documentos asociados a cotizaciones \ No newline at end of file diff --git a/htdocs/langs/es_CL/install.lang b/htdocs/langs/es_CL/install.lang new file mode 100644 index 00000000000..40d447b8653 --- /dev/null +++ b/htdocs/langs/es_CL/install.lang @@ -0,0 +1 @@ +MigrationProposal=Migración de datos de cotizaciones \ No newline at end of file diff --git a/htdocs/langs/es_CL/main.lang b/htdocs/langs/es_CL/main.lang new file mode 100644 index 00000000000..90e98cca31d --- /dev/null +++ b/htdocs/langs/es_CL/main.lang @@ -0,0 +1 @@ +CommercialProposalsShort=Cotizaciones \ No newline at end of file diff --git a/htdocs/langs/es_CL/members.lang b/htdocs/langs/es_CL/members.lang new file mode 100644 index 00000000000..59fd53dd993 --- /dev/null +++ b/htdocs/langs/es_CL/members.lang @@ -0,0 +1 @@ +TurnoverOrBudget=Volumen de ventas (empresa) o Cotización (asociación o colectivo) \ No newline at end of file diff --git a/htdocs/langs/es_CL/orders.lang b/htdocs/langs/es_CL/orders.lang new file mode 100644 index 00000000000..8810a19bcf8 --- /dev/null +++ b/htdocs/langs/es_CL/orders.lang @@ -0,0 +1 @@ +OrderSource0=Cotización \ No newline at end of file diff --git a/htdocs/langs/es_CL/other.lang b/htdocs/langs/es_CL/other.lang new file mode 100644 index 00000000000..f2b10a1a2d2 --- /dev/null +++ b/htdocs/langs/es_CL/other.lang @@ -0,0 +1,9 @@ +Notify_PROPAL_VALIDATE=Validación cotización cliente +Notify_PROPAL_SENTBYMAIL=Envío cotización por e-mail +PredefinedMailContentSendProposal=Buenos días, __CONTACTCIVNAME__ \n\n Nos ponemos en contacto con usted para facilitarle la cotización __PROPREF__\n\n Ante cualquier duda, consúltenos y será atendido a la mayor brevedad posible.\n\n __PERSONALIZED__Cordialmente\n\n__SIGNATURE__ +NumberOfProposals=Número de cotizaciones en los últimos 12 meses +NumberOfUnitsProposals=Número de unidades en las cotizaciones en los últimos 12 meses +EMailTextProposalValidated=La cotización %s que le concierne ha sido validado. +PropalClosedSignedInDolibarr=Cotización %s firmada en Dolibarr +PropalClosedRefusedInDolibarr=Cotización %s rechazada en Dolibarr +PropalValidatedInDolibarr=Cotización %s validada en Dolibarr \ No newline at end of file diff --git a/htdocs/langs/es_CL/products.lang b/htdocs/langs/es_CL/products.lang new file mode 100644 index 00000000000..cf82ea19c2b --- /dev/null +++ b/htdocs/langs/es_CL/products.lang @@ -0,0 +1,3 @@ +AddToMyProposals=Añadir a mis cotizaciones +AddToOtherProposals=Añadir a otras cotizaciones +NoteNotVisibleOnBill=Nota (no visible en las facturas, cotizaciones, etc.) \ No newline at end of file diff --git a/htdocs/langs/es_CL/projects.lang b/htdocs/langs/es_CL/projects.lang new file mode 100644 index 00000000000..a5ee33a39a4 --- /dev/null +++ b/htdocs/langs/es_CL/projects.lang @@ -0,0 +1 @@ +ListProposalsAssociatedProject=Listado de cotizaciones asociadas al proyecto \ No newline at end of file diff --git a/htdocs/langs/es_CL/propal.lang b/htdocs/langs/es_CL/propal.lang new file mode 100644 index 00000000000..8242c7d90a4 --- /dev/null +++ b/htdocs/langs/es_CL/propal.lang @@ -0,0 +1,62 @@ +Proposals=Cotizaciones +Proposal=Cotización +ProposalShort=Cotización +ProposalsDraft=Cotizaciones borrador +ProposalDraft=Cotización borrador +ProposalsOpened=Cotizaciones abiertas +Prop=Cotizaciones +CommercialProposal=Cotización +CommercialProposals=Cotizaciones +ProposalCard=Ficha cotización +NewProp=Nueva cotización +NewProposal=Nueva cotización +NewPropal=Nueva cotización +DeletePop=Eliminar cotización +ValidateProp=Validar cotización +AddProp=Crear cotización +ConfirmDeleteProp=¿Está seguro de querer eliminar esta cotización? +ConfirmValidateProp=¿Está seguro de querer validar esta cotización bajo la referencia %s ? +LastClosedProposals=Las %s últimas cotizaciones cerradas +LastModifiedProposals=Las %s últimas cotizaciones modificadas +AllPropals=Todas las cotizacioness +LastProposals=Últimas cotizaciones +SearchAProposal=Buscar una cotización +ProposalsStatistics=Estadísticas de cotizaciones +NumberOfUnitsProposals=Número de unidades en las cotizaciones en los últimos 12 meses +NbOfProposals=Número cotizaciones +ShowPropal=Ver cotización +PropalStatusValidated=Validado (cotización abierta) +PropalStatusOpened=Validado (cotización abierta) +PropalsToClose=Cotizaciones a cerrar +PropalsToBill=Cotizaciones firmadas a facturar +ListOfProposals=Listado de cotizaciones +ActionsOnPropal=Eventos sobre la cotización +NoOpenedPropals=Sin cotizaciones abiertos +NoOtherOpenedPropals=Ninguna otra cotización abierta +RefProposal=Ref. cotización +SendPropalByMail=Enviar cotización por e-mail +AssociatedDocuments=Documentos asociados a la cotizacion +DatePropal=Fecha cotización +ErrorPropalNotFound=Presupuesto %s inexistente +Estimate=Cotización: +EstimateShort=Cotización +OtherPropals=Otras cotizaciones +AddToDraftProposals=Añadir a cotización borrador +NoDraftProposals=Sin cotizaciones borrador +CopyPropalFrom=Crear cotización por copia de una existente +CreateEmptyPropal=Crear cotización vacía +UseCustomerContactAsPropalRecipientIfExist=Utilizar dirección contacto de seguimiento de cliente definido en vez de la dirección del tercero como destinatario de las cotizaciones +ClonePropal=Clonar cotización +ConfirmClonePropal=¿Está seguro de querer clonar la cotización %s? +ConfirmReOpenProp=¿Está seguro de querer reabrir la cotización %s ? +ProposalsAndProposalsLines=Cotizaciones a clientes y líneas de cotizaciones +ProposalLine=Línea de cotización +##### Types de contacts ##### +TypeContact_propal_internal_SALESREPFOLL=Comercial seguimiento cotización +TypeContact_propal_external_BILLING=Contacto cliente de facturación cotización +TypeContact_propal_external_CUSTOMER=Contacto cliente seguimiento cotización +# Document models +DocModelAzurDescription=Modelo de cotización completa (logo...) +DocModelJauneDescription=Modelo de cotización Jaune +DefaultModelPropalToBill=Modelo por defecto al cerrar una cotización (a facturar) +DefaultModelPropalClosed=Modelo por defecto al cerrar una cotización (no facturado) \ No newline at end of file diff --git a/htdocs/langs/es_CL/workflow.lang b/htdocs/langs/es_CL/workflow.lang new file mode 100644 index 00000000000..17b2915fc39 --- /dev/null +++ b/htdocs/langs/es_CL/workflow.lang @@ -0,0 +1,3 @@ +descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Crear un pedido de cliente automáticamente a la firma de una cotización +descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Crear una factura a cliente automáticamente a la firma de una cotización +descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Clasificar como facturada la cotización cuando el pedido de cliente relacionado se clasifique como pagado \ No newline at end of file From c8f63d6160b0c1b43e24b36616b82ef203b6e9e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Mar 2014 00:17:39 +0100 Subject: [PATCH 02/44] Fix: Prepare for 3.5.2 --- build/debian/changelog | 7 +++++++ build/doxygen/dolibarr-doxygen.doxyfile | 2 +- build/exe/doliwamp/doliwamp.iss | 4 ++-- build/perl/virtualmin/dolibarr.pl | 2 +- build/rpm/dolibarr_fedora.spec | 3 +++ build/rpm/dolibarr_generic.spec | 3 +++ build/rpm/dolibarr_mandriva.spec | 3 +++ build/rpm/dolibarr_opensuse.spec | 3 +++ htdocs/filefunc.inc.php | 2 +- 9 files changed, 24 insertions(+), 5 deletions(-) diff --git a/build/debian/changelog b/build/debian/changelog index d07e7616ca2..a29f1b001f1 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,3 +1,10 @@ +dolibarr (3.5.2-3) unstable; urgency=low + + [ Laurent Destailleur (eldy) ] + * New upstream release. + + -- Laurent Destailleur (eldy) Fri, 14 March 2014 12:00:00 +0100 + dolibarr (3.5.1-3) unstable; urgency=low [ Laurent Destailleur (eldy) ] diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index 9c94d9db2ae..29c36793cfd 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 3.5.1 +PROJECT_NUMBER = 3.5.2 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 0db49fddac7..4ecf52cfb12 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -17,9 +17,9 @@ ; ----- Change this ----- AppName=DoliWamp ; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -AppVerName=DoliWamp-3.5.1 +AppVerName=DoliWamp-3.5.2 ; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x -OutputBaseFilename=DoliWamp-3.5.1 +OutputBaseFilename=DoliWamp-3.5.2 ; ----- End of change ;OutputManifestFile=build\doliwampbuild.log ; Define full path from which all relative path are defined diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index a9ef68da0c5..1cd5d1e3b54 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -30,7 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "3.5.1", "3.5.0", "3.4.1", "3.4.0", "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" ); +return ( "3.5.2", "3.5.1", "3.5.0", "3.4.1", "3.4.0", "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" ); } sub script_dolibarr_category diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 9dfcdb4aa98..20252507a9e 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -330,6 +330,9 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 +- Upstream release + * Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 - Upstream release diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 0b37ce61d88..8a9d4de92fb 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -558,6 +558,9 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 +- Upstream release + * Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 - Upstream release diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 923b5924f2d..74eb9d8c6db 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -335,6 +335,9 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 +- Upstream release + * Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 - Upstream release diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 93525e334f0..ae1f1668bd5 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -345,6 +345,9 @@ fi # version x.y.z-0.1.a for alpha, x.y.z-0.2.b for beta, x.y.z-0.3 for release %changelog +* Fri Feb 14 2014 Laurent Destailleur 3.5.2-0.3 +- Upstream release + * Fri Feb 7 2014 Laurent Destailleur 3.5.1-0.3 - Upstream release diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index daf4ddbdcfd..3a23aa79ad1 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.1'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.2'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants From 561a1a1aacf1541b4245c04c4f8a9a98dd3f2177 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 14 Mar 2014 02:07:54 +0100 Subject: [PATCH 03/44] Fix: Miscellaneous problems on task tabs (withproject parameter lost and download fails). --- htdocs/core/class/html.formfile.class.php | 36 ++++++++++--------- .../tpl/document_actions_post_headers.tpl.php | 13 +++---- .../tpl/document_actions_pre_headers.tpl.php | 2 +- htdocs/projet/document.php | 3 +- htdocs/projet/tasks/document.php | 7 ++-- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 1319ad766d0..5317d49c23c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -764,8 +764,9 @@ class FormFile if (empty($relativepath)) { $relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/'; - if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2).$relativepath; - if ($object->element == 'member') $relativepath=get_exdir($object->id,2).$relativepath; + if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2).$relativepath; // TODO Call using a defined value for $relativepath + if ($object->element == 'member') $relativepath=get_exdir($object->id,2).$relativepath; // TODO Call using a defined value for $relativepath + if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.'; } $var=!$var; @@ -1052,9 +1053,10 @@ class FormFile * @param int $permtodelete Deletion is allowed * @param string $action Action * @param string $selected ??? + * @param string $param More param to add into URL * @return int Number of links */ - public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null) + public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null, $param='') { global $user, $conf, $langs, $user; global $bc; @@ -1071,17 +1073,17 @@ class FormFile $sortfield = null; } $res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder); - $param = (isset($object->id)?'&id=' . $object->id : ''); + $param .= (isset($object->id)?'&id=' . $object->id : ''); // Show list of associated links print_titre($langs->trans("LinkedFiles")); - print '
'; + print ''; print ''; print ''; print_liste_field_titre( - $langs->trans("Documents2"), + $langs->trans("Links"), $_SERVER['PHP_SELF'], "name", "", @@ -1135,34 +1137,34 @@ class FormFile print ''; print $langs->trans('Link') . ': '; print ''; - print ''; print ''; print ''; - print ''; } - else { + else + { print '\n"; + print ''."\n"; print ''; print ''; print ''; print '"; + print ''; } print "\n"; } diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 2ae7b9ad595..a662bd5be3d 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013 Laurent Destailleur +/* Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2013-2014 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,16 +18,17 @@ */ $langs->load("link"); +if (empty($relativepathwithnofile)) $relativepathwithnofile=''; /* - * Confirm suppression + * Confirm form to delete */ if ($action == 'delete') { $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles $ret = $form->form_confirm( - $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'), + $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', @@ -58,11 +59,11 @@ $formfile->list_of_documents( $modulepart, $param, 0, - '', + $relativepathwithnofile, // relative path with no file. For example "moduledir/0/1" $permission ); print "
"; //List of links -$formfile->listOfLinks($object, $permission, $action, GETPOST('linkid', 'int')); +$formfile->listOfLinks($object, $permission, $action, GETPOST('linkid', 'int'), $param); print "
"; diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index 989a3bcaf73..ca6929331ec 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -74,7 +74,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); } } - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.($withproject?'&withproject=1':'')); exit; } } diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 89fc9549156..8d545bf1e6a 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -144,9 +144,8 @@ if ($object->id > 0) print "
'; + print ''; print $langs->trans('Label') . ': '; print '' . dol_print_date(dol_now(), "dayhour", "tzuser") . ''; - print ''; + print ''; + print ''; + print ''; print ''; - print ''; + print ''; print $link->label; print ''; - print "' . dol_print_date($link->datea, "dayhour", "tzuser") . ''; - print '' . img_edit().''; + print '' . img_edit() . ''; // id= is included into $param if ($permtodelete) { - print '   ' . img_delete() . ''; + print '   ' . img_delete() . ''; // id= is included into $param } else { print ' '; } - print "
\n"; print "\n"; - $modulepart = 'projet'; + $modulepart = 'project'; $permission = ($userWrite > 0); - $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 8dd80223e6c..0b876d0490a 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -110,6 +110,7 @@ if ($id > 0 || ! empty($ref)) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; + /* * View */ @@ -229,9 +230,11 @@ if ($object->id > 0) print '
'; - $modulepart = 'projet'; + $param=''; + if ($withproject) $param .= '&withproject=1'; + $modulepart = 'project_task'; $permission = $user->rights->projet->creer; - $param = '&id=' . $object->id; + $relativepathwithnofile=dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/'; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } else From f9c48be2a91e160921ed8a4ac33af727eeb36e9b Mon Sep 17 00:00:00 2001 From: philippe grand Date: Fri, 14 Mar 2014 18:23:37 +0100 Subject: [PATCH 04/44] fix : display specimen --- .../modules/contract/doc/pdf_strato.modules.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 6976754285a..353b77ffaf7 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -116,15 +116,24 @@ class pdf_strato extends ModelePDFContract $outputlangs->load("dict"); $outputlangs->load("companies"); $outputlangs->load("contracts"); + $outputlangs->load("interventions"); if ($conf->contrat->dir_output) { $object->fetch_thirdparty(); - $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->contrat->dir_output; - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; - $file = $dir . "/" . $objectref . ".pdf"; + // Definition of $dir and $file + if ($object->specimen) + { + $dir = $conf->contrat->dir_output; + $file = $dir . "/SPECIMEN.pdf"; + } + else + { + $objectref = dol_sanitizeFileName($object->ref); + $dir = $conf->contrat->dir_output . "/" . $objectref; + $file = $dir . "/" . $objectref . ".pdf"; + } if (! file_exists($dir)) { From e7791a3ade56b8a642d298070537765e66640c61 Mon Sep 17 00:00:00 2001 From: bouna Date: Fri, 14 Mar 2014 19:46:36 +0100 Subject: [PATCH 05/44] Update list.php to save the town filtre on prospect list, just i replace: $param='&stcomm='.$stcomm.'&search_nom='.urlencode($search_nom).'&search_zipcode='.urlencode($search_zipcode).'&search_ville ='.urlencode($search_ville ); search_ville by search_town --- htdocs/comm/prospect/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php index 43a800dec76..f0f58df9a08 100644 --- a/htdocs/comm/prospect/list.php +++ b/htdocs/comm/prospect/list.php @@ -241,7 +241,7 @@ if ($resql) llxHeader('',$langs->trans("ThirdParty"),$help_url); } - $param='&stcomm='.$stcomm.'&search_nom='.urlencode($search_nom).'&search_zipcode='.urlencode($search_zipcode).'&search_ville='.urlencode($search_ville); + $param='&stcomm='.$stcomm.'&search_nom='.urlencode($search_nom).'&search_zipcode='.urlencode($search_zipcode).'&search_town='.urlencode($search_town); // Store the status filter in the URL if (isSet($search_cstc)) { From 3f6b319d4107168b239d0c8d0dcf58eaaddc547f Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 14 Mar 2014 23:42:45 +0100 Subject: [PATCH 06/44] Fix deposit invoice --- htdocs/compta/facture.php | 16 ++++++++-------- htdocs/compta/facture/class/facture.class.php | 4 ++-- htdocs/core/class/discount.class.php | 2 +- htdocs/core/modules/modSociete.class.php | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 059d8dffd4a..f8655c7c850 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -584,7 +584,7 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ $object->fetch_thirdparty(); $object->fetch_lines(); - if (! $object->paye) // protection against multiple submit + if (!empty($object->paye)) // protection against multiple submit { // Boucle sur chaque taux de tva $i=0; @@ -601,8 +601,7 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ if ($object->type == 2) $discount->description='(CREDIT_NOTE)'; elseif ($object->type == 3) $discount->description='(DEPOSIT)'; else { - $this->error="CantConvertToReducAnInvoiceOfThisType"; - return -1; + setEventMessage($langs->trans('CantConvertToReducAnInvoiceOfThisType'),'errors'); } $discount->tva_tx=abs($object->total_ttc); $discount->fk_soc=$object->socid; @@ -617,6 +616,7 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ $discount->tva_tx=abs($tva_tx); $result=$discount->create($user); + if ($result < 0) { $error++; @@ -624,24 +624,24 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ } } - if (! $error) + if (empty($error)) { // Classe facture $result=$object->set_paid($user); - if ($result > 0) + if ($result >= 0) { //$mesgs[]='OK'.$discount->id; $db->commit(); } else { - $mesgs[]='
'.$object->error.'
'; + setEventMessage($object->error,'errors'); $db->rollback(); } } else { - $mesgs[]='
'.$discount->error.'
'; + setEventMessage($discount->error,'errors'); $db->rollback(); } } @@ -3687,7 +3687,7 @@ else if ($id > 0 || ! empty($ref)) print ''; } // For deposit invoice - if ($object->type == 3 && $object->statut == 1 && $resteapayer == 0 && $user->rights->facture->creer) + if ($object->type == 3 && $object->statut == 2 && $resteapayer == 0 && $user->rights->facture->creer && empty($discount->id)) { print ''; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 53adade47ab..76b54bbe613 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1471,6 +1471,7 @@ class Facture extends CommonInvoice if ($close_note) $sql.= ", close_note='".$this->db->escape($close_note)."'"; $sql.= ' WHERE rowid = '.$this->id; + dol_syslog(get_class($this)."::set_paid sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1486,8 +1487,7 @@ class Facture extends CommonInvoice else { $error++; - $this->error=$this->db->error(); - dol_print_error($this->db); + $this->error=$this->db->lasterror(); } if (! $error) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 468530303b8..ede7615a65a 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -154,7 +154,7 @@ class DiscountAbsolute $sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,"; $sql.= " fk_facture_source"; $sql.= ")"; - $sql.= " VALUES (".$this->db->idate($this->datec!=''?$this->datec:dol_now()).", ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',"; + $sql.= " VALUES ('".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".$user->id.", '".$this->db->escape($this->description)."',"; $sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.","; $sql.= " ".($this->fk_facture_source?"'".$this->fk_facture_source."'":"null"); $sql.= ")"; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 28d83897b37..ea3be87aaee 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -270,7 +270,7 @@ class modSociete extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.nom'=>"Text",'s.status'=>"Number",'s.client'=>"Boolean",'s.fournisseur'=>"Boolean",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",'s.code_compta'=>"Text",'s.code_compta_fournisseur'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'p.libelle'=>"List:c_pays:libelle:libelle",'p.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.default_lang'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.idprof5'=>"Text",'s.idprof6'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Number",'s.note_private'=>"Text",'s.note_public'=>"Text",'t.libelle'=>"Text",'ce.code'=>"List:c_effectif:libelle:code","cfj.libelle"=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','st.code'=>'List:c_stcomm:libelle:code','d.nom'=>'Text'); $this->export_entities_array[$r]=array(); // We define here only fields that use another picto // Add extra fields - $sql="SELECT name, label, type FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'"; + $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'"; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { From 1cb71674d70d58da1515e67c17e82126fd69679e Mon Sep 17 00:00:00 2001 From: kaos Date: Sat, 15 Mar 2014 11:06:50 +0100 Subject: [PATCH 07/44] fixes #1300 --- htdocs/holiday/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 01c2e1fb5a1..959811aa5a2 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -1039,7 +1039,7 @@ else $idGroupValid = $cp->getConfCP('userGroup'); $validator = new UserGroup($db,$idGroupValid); - $valideur = $validator->listUsersForGroup(); + $valideur = $validator->listUsersForGroup(,'',1); print ''; $form->select_users($cp->fk_validator,"valideur",1,"",0,$valideur,''); From f55bdc64bd03d708f2d5731bad721de587baa979 Mon Sep 17 00:00:00 2001 From: kaos Date: Sat, 15 Mar 2014 11:10:20 +0100 Subject: [PATCH 08/44] fixes #1300 --- htdocs/holiday/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 959811aa5a2..0ff0194d5cf 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -1039,7 +1039,7 @@ else $idGroupValid = $cp->getConfCP('userGroup'); $validator = new UserGroup($db,$idGroupValid); - $valideur = $validator->listUsersForGroup(,'',1); + $valideur = $validator->listUsersForGroup('',1); print ''; $form->select_users($cp->fk_validator,"valideur",1,"",0,$valideur,''); From 4db8af8a53ef0cf093e18d884727c189fc243038 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 15 Mar 2014 15:10:03 +0100 Subject: [PATCH 09/44] Fix: sql syntax error with pgsql --- scripts/contracts/email_expire_services_to_representatives.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index 76489bebcf2..da16a328bcf 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -75,7 +75,7 @@ print $script_file." launched with mode ".$mode." default lang=".$langs->default if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1; -$sql = "SELECT DISTINCT c.ref, c.fk_soc, cd.date_fin_validite, cd.total_ttc, cd.description as description, p.label as plabel, s.nom as name, s.email, s.default_lang,"; +$sql = "SELECT DISTINCT c.ref, c.fk_soc, cd.date_fin_validite, cd.total_ttc, cd.description as description, p.label as plabel, s.rowid, s.nom as name, s.email, s.default_lang,"; $sql.= " u.rowid as uid, u.lastname, u.firstname, u.email, u.lang"; $sql.= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."contrat AS c, ".MAIN_DB_PREFIX."contratdet AS cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product AS p ON p.rowid = cd.fk_product, ".MAIN_DB_PREFIX."societe_commerciaux AS sc, ".MAIN_DB_PREFIX."user AS u"; From 18c4d890ddc468681f6cbffe4baad3f9d22c7bb3 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 15 Mar 2014 16:32:46 +0100 Subject: [PATCH 10/44] Fix [ bug #1283 ] ROUGET Shipment PDF --- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 4394c3200f5..66f36e1b84f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -240,7 +240,7 @@ class pdf_rouget extends ModelePdfExpedition $pageposbefore=$pdf->getPage(); // Description de la ligne produit - pdf_writelinedesc($pdf,$object,$i,$outputlangs,150,3,$this->posxdesc,$curY,0,1); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxqtyordered-10,3,$this->posxdesc,$curY,0,1); $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); From 76256294913cd6e515d66f1bef48cdb37cf2f1ad Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 15 Mar 2014 16:40:29 +0100 Subject: [PATCH 11/44] Fix [ bug #1294 ] Expedition model Merou having problems with long names --- htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index c5662089e9e..fc3bd6281eb 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -474,7 +474,7 @@ class pdf_merou extends ModelePdfExpedition else { $text=$this->emetteur->name; - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($text), 0, 'L'); + $pdf->MultiCell(70, 3, $outputlangs->convToOutputCharset($text), 0, 'L'); } //*********************Entete**************************** From 997e16fec7e171299dec07bd75dde66b8371cc57 Mon Sep 17 00:00:00 2001 From: Drosis Nikos Date: Sat, 15 Mar 2014 15:23:41 +0200 Subject: [PATCH 12/44] Update user.class.php String translated twice --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 25fc77311ac..62e7f792d66 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1496,7 +1496,7 @@ class User extends CommonObject $outputlangs->load("users"); $outputlangs->load("other"); - $subject = $outputlangs->trans("SubjectNewPassword"); + $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword"); // Define $urlwithroot //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); From ed4f7fd0837cbf4ac749dc874f593dd4488addf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Mar 2014 20:05:07 +0100 Subject: [PATCH 13/44] Fix: error --- htdocs/core/modules/DolibarrModules.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 62a54437cd6..be498b04413 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -114,7 +114,7 @@ abstract class DolibarrModules $sql=str_replace('__ENTITY__', $conf->entity, $sql); dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror." sql=".$sql, LOG_DEBUG); - $result=$this->db->query($sql); + $result=$this->db->query($sql, $ignoreerror); if (! $result) { if (! $ignoreerror) From eb43bc4982ef3cb131ad948649028d686c4f9b1a Mon Sep 17 00:00:00 2001 From: Gauthier Date: Mon, 17 Mar 2014 15:38:12 +0100 Subject: [PATCH 14/44] Correction when adding line with price as '0' --- htdocs/fourn/commande/fiche.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index add5090e081..73a62207af1 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -219,8 +219,9 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); $error++; } - if (! GETPOST('addline_predefined') && (! GETPOST('pu') || GETPOST('pu')=='')) // Unit price can be 0 but not '' + if (! GETPOST('addline_predefined') && ( GETPOST('pu')==='')) // Unit price can be 0 but not '' { + setEventMessage($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), 'errors'); $error++; } @@ -239,7 +240,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit - if (GETPOST('addline_predefined') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' + if ((GETPOST('addline_predefined') || GETPOST('idprodfournprice')) && ( GETPOST('pu')!=='')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' { $idprod=0; $productsupplier = new ProductFournisseur($db); @@ -299,7 +300,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) setEventMessage($langs->trans("ErrorQtyTooLowForThisSupplier"), 'errors'); } } - else + else if( GETPOST('pu')!=='' || GETPOST('amountttc')!=='' ) { $type=$_POST["type"]; $desc=$_POST['dp_desc']; @@ -326,7 +327,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) $ttc = price2num($_POST['amountttc']); $ht = $ttc / (1 + ($tauxtva / 100)); $price_base_type = 'HT'; - $result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type); + $result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type); } } } From ada22837a5188c2f1ec3fa79e0256d33a943e7ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Mar 2014 22:24:57 +0100 Subject: [PATCH 15/44] Fix: form to add images should not show link form --- htdocs/product/photos.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index 864b36c3149..34a2e836599 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * @@ -162,7 +162,7 @@ if ($object->id) { // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("AddPhoto"), 1, 0, 1, 50, $object, '', false); // ajax=false for the moment. true may not work. + $formfile->form_attach_new_file($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("AddPhoto"), 1, 0, ($user->rights->produit->creer || $user->rights->service->creer), 50, $object, '', false, '', 0); // ajax=false for the moment. true may not work. } // Affiche photos From a05ea581813f7e3abd59c516f7152e992cd47e99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 18 Mar 2014 00:41:56 +0100 Subject: [PATCH 16/44] Fix: form to add images should not show link form --- htdocs/categories/photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index bbffe5865d3..1a71005ab8e 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -209,7 +209,7 @@ if ($object->id) { // Affiche formulaire upload $formfile=new FormFile($db); - $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type,$langs->trans("AddPhoto"),1); + $formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type, $langs->trans("AddPhoto"), 1, '', $user->rights->categorie->creer, 50, $object, '', false, '', 0); } // Affiche photos From dbaea6fa423c3f72c2d554c885379662b1819ae2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 11:40:23 +0100 Subject: [PATCH 17/44] Add clean sql requests into repair.sql --- htdocs/install/mysql/migration/repair.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index e656799eb1f..0495171a9d0 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -6,6 +6,11 @@ -- Requests to clean corrupted database +-- delete foreign key that should never exists +ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency; +ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_currency; +ALTER TABLE llx_facture DROP FOREIGN KEY fk_facture_fk_currency; + delete from llx_facturedet where fk_facture in (select rowid from llx_facture where facnumber in ('(PROV)','ErrorBadMask')); delete from llx_facture where facnumber in ('(PROV)','ErrorBadMask'); delete from llx_commandedet where fk_commande in (select rowid from llx_commande where ref in ('(PROV)','ErrorBadMask')); From 44952e353d496477d4c45405e8db8bb1f80ec9f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 11:46:06 +0100 Subject: [PATCH 18/44] Fix: Bad format for fk_currency fields (even if they are not used, i fix them). --- ChangeLog | 11 ++++++----- htdocs/install/mysql/migration/3.1.0-3.2.0.sql | 4 ---- htdocs/install/mysql/migration/3.5.0-3.6.0.sql | 12 ++++++++++++ htdocs/install/mysql/migration/repair.sql | 5 +++++ htdocs/install/mysql/tables/llx_commande.sql | 2 +- htdocs/install/mysql/tables/llx_facture.sql | 2 +- htdocs/install/mysql/tables/llx_propal.sql | 2 +- htdocs/install/mysql/tables/llx_societe.sql | 2 +- 8 files changed, 27 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d94a664ce6..40ef96fb5c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,17 +6,18 @@ English Dolibarr ChangeLog For users: - New: Update ckeditor to version 4. - New: Add form "search customer order" on commercial main page. -- New: Can input barcode during product creation step. -- New: Add autonumbering of barcode value for products. - New: Can create contract from an order. - New: Add list of orders products in tab "consumption" on thirdparties. - New: Add graph stats for suppliers orders in tab "stats" on products. - New: Add option MAIN_HIDE_INACTIVETAB_ON_PRINT to hide inactive tabs when you use the "print" view on screen. -- New: Add a page/tool for mass barcode generation. - New: Add option MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES and MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES to automatically add timestamp and user line into edition field when editing a note. - New: Add button cancel into edition of notes. +- New: Improved Barcode module: + Can input barcode during product creation step. + Add autonumbering of barcode value for products. + Add a page/tool for mass barcode generation. - New: Improved Opensurvey module: Added options to disable comments and disable public votes. Limit dates use calendar popup. @@ -39,9 +40,9 @@ For users: - New: Add manager name (ceo, director, president...) into main company information page. - New: Add field url as product properties. - New: More options to create a credit note (can be filled autatically according to remain to pay). -- New: Can define custom fields for catagories. +- New: Can define custom fields for categories. - Fix: Project Task numbering customs rule works. -- Fix: Add actions events not implemented +- Fix: Add actions events not implemented. TODO - New: Predefined product and free product use same form. diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index a4048115593..044b1652029 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -428,10 +428,6 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU' INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARP', NULL, 0, 'Pesos argentins'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXP', NULL, 0, 'Pesos Mexicans'); -ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso); -ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso); -ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso); - ALTER TABLE llx_expedition DROP COLUMN billed; ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur_price_fk_product_fournisseur; diff --git a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql index e8c9d18f3ba..0c2038fe7eb 100644 --- a/htdocs/install/mysql/migration/3.5.0-3.6.0.sql +++ b/htdocs/install/mysql/migration/3.5.0-3.6.0.sql @@ -17,6 +17,18 @@ -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); + +-- delete foreign key that should never exists +ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency; +ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_currency; +ALTER TABLE llx_facture DROP FOREIGN KEY fk_facture_fk_currency; +ALTER TABLE llx_facture DROP FOREIGN KEY fk_societe_fk_currency; + +ALTER TABLE llx_propal MODIFY COLUMN fk_currency varchar(3) NULL; +ALTER TABLE llx_commande MODIFY COLUMN fk_currency varchar(3) NULL; +ALTER TABLE llx_facture MODIFY COLUMN fk_currency varchar(3) NULL; +ALTER TABLE llx_societe MODIFY COLUMN fk_currency varchar(3) NULL; + ALTER TABLE llx_bookmark ADD COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_bookmark MODIFY COLUMN url varchar(255) NOT NULL; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 3cd1f430f9b..87166ba37f3 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -6,6 +6,11 @@ -- Requests to clean corrupted database +-- delete foreign key that should never exists +ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency; +ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_currency; +ALTER TABLE llx_facture DROP FOREIGN KEY fk_facture_fk_currency; + delete from llx_facturedet where fk_facture in (select rowid from llx_facture where facnumber in ('(PROV)','ErrorBadMask')); delete from llx_facture where facnumber in ('(PROV)','ErrorBadMask'); delete from llx_commandedet where fk_commande in (select rowid from llx_commande where ref in ('(PROV)','ErrorBadMask')); diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 325b1f3fe13..beda59e79b3 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -56,7 +56,7 @@ create table llx_commande facture tinyint default 0, fk_account integer, -- bank account - fk_currency varchar(2), -- currency code + fk_currency varchar(3), -- currency code fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 62ea8936e90..9f55527ff8e 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -63,7 +63,7 @@ create table llx_facture fk_projet integer DEFAULT NULL, -- projet auquel est associee la facture fk_account integer, -- bank account - fk_currency varchar(2), -- currency code + fk_currency varchar(3), -- currency code fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement) date_lim_reglement date, -- date limite de reglement diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 3155eed6370..2a97c6c77a3 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -53,7 +53,7 @@ create table llx_propal total double(24,8) DEFAULT 0, -- montant total ttc apres remise globale fk_account integer, -- bank account - fk_currency varchar(2), -- currency code + fk_currency varchar(3), -- currency code fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...) fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement) diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index f4e1614cd7d..57e2f6eb26d 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -53,7 +53,7 @@ create table llx_societe fk_effectif integer DEFAULT 0, -- fk_typent integer DEFAULT 0, -- fk_forme_juridique integer DEFAULT 0, -- juridical status - fk_currency integer DEFAULT 0, -- currency + fk_currency varchar(3), -- default currency siren varchar(128), -- IDProf1: siren or RCS for france siret varchar(128), -- IDProf2: siret for france ape varchar(128), -- IDProf3: code ape for france From bf735cacbe031c8a0a7d2095fb8ec8fafe93720a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 13:32:54 +0100 Subject: [PATCH 19/44] Fix PDF: Page break was ko when breaking 2 pages or more. Fix PDF: pdf_canelle was missing code to manage pagebreak. Fix PDF: The width of picture was hardcoded into some templates. Fix PDF: The atleastonediscount was not used into some templates. --- .../commande/doc/pdf_einstein.modules.php | 19 ++++-- .../commande/doc/pdf_proforma.modules.php | 15 ++++- .../modules/facture/doc/pdf_crabe.modules.php | 17 ++++-- .../livraison/pdf/pdf_typhon.modules.php | 31 ++++++---- .../modules/propale/doc/pdf_azur.modules.php | 22 +++++-- .../pdf/pdf_canelle.modules.php | 59 ++++++++++++++++--- .../pdf/pdf_muscadet.modules.php | 15 ++++- 7 files changed, 138 insertions(+), 40 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 0126edd78d4..835a9ffa43b 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent @@ -109,7 +109,7 @@ class pdf_einstein extends ModelePDFCommandes $this->posxdiscount=162; $this->postotalht=174; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; - $this->posxpicture=$this->posxtva - 16; // width of images + $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { $this->posxpicture-=20; @@ -153,7 +153,7 @@ class pdf_einstein extends ModelePDFCommandes $outputlangs->load("products"); $outputlangs->load("orders"); $outputlangs->load("deliveries"); - + if ($conf->commande->dir_output) { $object->fetch_thirdparty(); @@ -228,6 +228,15 @@ class pdf_einstein extends ModelePDFCommandes $this->atleastonediscount++; } } + if (empty($this->atleastonediscount)) + { + $this->posxpicture+=($this->postotalht - $this->posxdiscount); + $this->posxtva+=($this->postotalht - $this->posxdiscount); + $this->posxup+=($this->postotalht - $this->posxdiscount); + $this->posxqty+=($this->postotalht - $this->posxdiscount); + $this->posxdiscount+=($this->postotalht - $this->posxdiscount); + //$this->postotalht; + } // New page $pdf->AddPage(); @@ -304,7 +313,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->AddPage('','',true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pagenb+1); + $pdf->setPage($pageposafter+1); } } else @@ -589,7 +598,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('','B', $default_font_size - 2); $text=$outputlangs->transnoentities("DeliveryDate").':'; $pdf->MultiCell(80, 3, $text, 0, 'L', 0); - + $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posxval, $posy); $text=dol_print_date($object->date_livraison,'day','',$outputlangs); diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 35d7dd3f9fc..848bbb92c64 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent @@ -109,7 +109,7 @@ class pdf_proforma extends ModelePDFCommandes $this->posxdiscount=162; $this->postotalht=174; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; - $this->posxpicture=$this->posxtva - 16; // width of images + $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { $this->posxpicture-=20; @@ -227,6 +227,15 @@ class pdf_proforma extends ModelePDFCommandes $this->atleastonediscount++; } } + if (empty($this->atleastonediscount)) + { + $this->posxpicture+=($this->postotalht - $this->posxdiscount); + $this->posxtva+=($this->postotalht - $this->posxdiscount); + $this->posxup+=($this->postotalht - $this->posxdiscount); + $this->posxqty+=($this->postotalht - $this->posxdiscount); + $this->posxdiscount+=($this->postotalht - $this->posxdiscount); + //$this->postotalht; + } // New page $pdf->AddPage(); @@ -303,7 +312,7 @@ class pdf_proforma extends ModelePDFCommandes $pdf->AddPage('','',true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pagenb+1); + $pdf->setPage($pageposafter+1); } } else diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0f2ac346e69..955f07a5b00 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent @@ -109,7 +109,7 @@ class pdf_crabe extends ModelePDFFactures $this->posxdiscount=162; $this->postotalht=174; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; - $this->posxpicture=$this->posxtva - 16; // width of images + $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { $this->posxpicture-=20; @@ -228,6 +228,15 @@ class pdf_crabe extends ModelePDFFactures $this->atleastonediscount++; } } + if (empty($this->atleastonediscount)) + { + $this->posxpicture+=($this->postotalht - $this->posxdiscount); + $this->posxtva+=($this->postotalht - $this->posxdiscount); + $this->posxup+=($this->postotalht - $this->posxdiscount); + $this->posxqty+=($this->postotalht - $this->posxdiscount); + $this->posxdiscount+=($this->postotalht - $this->posxdiscount); + //$this->postotalht; + } // New page $pdf->AddPage(); @@ -306,7 +315,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->AddPage('','',true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pagenb+1); + $pdf->setPage($pageposafter+1); } } else @@ -378,7 +387,7 @@ class pdf_crabe extends ModelePDFFactures if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; $vatrate=(string) $object->lines[$i]->tva_tx; - + // Retrieve type from database for backward compatibility with old records if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index bdb35d67fbe..febf66b5170 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2008 Chiptronik @@ -223,15 +223,24 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right /* - // Positionne $this->atleastonediscount si on a au moins une remise - for ($i = 0 ; $i < $nblines ; $i++) - { - if ($object->lines[$i]->remise_percent) - { - $this->atleastonediscount++; - } - } - */ + // Positionne $this->atleastonediscount si on a au moins une remise + for ($i = 0 ; $i < $nblines ; $i++) + { + if ($object->lines[$i]->remise_percent) + { + $this->atleastonediscount++; + } + } + if (empty($this->atleastonediscount)) + { + $this->posxpicture+=($this->postotalht - $this->posxdiscount); + $this->posxtva+=($this->postotalht - $this->posxdiscount); + $this->posxup+=($this->postotalht - $this->posxdiscount); + $this->posxqty+=($this->postotalht - $this->posxdiscount); + $this->posxdiscount+=($this->postotalht - $this->posxdiscount); + //$this->postotalht; + } + */ // New page $pdf->AddPage(); @@ -307,7 +316,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->AddPage('','',true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pagenb+1); + $pdf->setPage($pageposafter+1); } } else diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index fbe3fb98bbf..60de9eca768 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent @@ -153,7 +153,7 @@ class pdf_azur extends ModelePDFPropales $outputlangs->load("products"); $nblignes = count($object->lines); - + // Loop on each lines to detect if there is at least one image to show $realpatharray=array(); if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) @@ -161,7 +161,7 @@ class pdf_azur extends ModelePDFPropales for ($i = 0 ; $i < $nblignes ; $i++) { if (empty($object->lines[$i]->fk_product)) continue; - + $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); @@ -185,7 +185,7 @@ class pdf_azur extends ModelePDFPropales if ($conf->propal->dir_output) { $object->fetch_thirdparty(); - + // $deja_regle = 0; // Definition of $dir and $file @@ -254,6 +254,15 @@ class pdf_azur extends ModelePDFPropales $this->atleastonediscount++; } } + if (empty($this->atleastonediscount)) + { + $this->posxpicture+=($this->postotalht - $this->posxdiscount); + $this->posxtva+=($this->postotalht - $this->posxdiscount); + $this->posxup+=($this->postotalht - $this->posxdiscount); + $this->posxqty+=($this->postotalht - $this->posxdiscount); + $this->posxdiscount+=($this->postotalht - $this->posxdiscount); + //$this->postotalht; + } // New page $pdf->AddPage(); @@ -320,7 +329,7 @@ class pdf_azur extends ModelePDFPropales $pdf->AddPage('','',true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pagenb+1); + $pdf->setPage($pageposbefore+1); $curY = $tab_top_newpage; $showpricebeforepagebreak=0; @@ -358,7 +367,7 @@ class pdf_azur extends ModelePDFPropales $pdf->AddPage('','',true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pagenb+1); + $pdf->setPage($pageposafter+1); } } else @@ -375,6 +384,7 @@ class pdf_azur extends ModelePDFPropales $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); + $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index ccc3ed8c17b..fa1ef339185 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2010-2014 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,7 +58,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * Constructor * * @param DoliDB $db Database handler - * @param Societe $object Supplier invoice + * @param Object $object Supplier invoice */ function __construct($db,$object) { @@ -105,7 +105,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->posxdiscount=162; $this->postotalht=174; //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; - $this->posxpicture=$this->posxtva - 16; // width of images + $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { $this->posxpicture-=20; @@ -225,7 +225,16 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->atleastonediscount++; } } - + if (empty($this->atleastonediscount)) + { + $this->posxpicture+=($this->postotalht - $this->posxdiscount); + $this->posxtva+=($this->postotalht - $this->posxdiscount); + $this->posxup+=($this->postotalht - $this->posxdiscount); + $this->posxqty+=($this->postotalht - $this->posxdiscount); + $this->posxdiscount+=($this->postotalht - $this->posxdiscount); + //$this->postotalht; + } + // New page $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); @@ -279,8 +288,40 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Description of product line $curX = $this->posxdesc-1; - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1); + $showpricebeforepagebreak=1; + $pdf->startTransaction(); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc,1); + $pageposafter=$pdf->getPage(); + if ($pageposafter > $pageposbefore) // There is a pagebreak + { + $pdf->rollbackTransaction(true); + $pageposafter=$pageposbefore; + //print $pageposafter.'-'.$pageposbefore;exit; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); + $posyafter=$pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page + { + $pdf->AddPage('','',true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pageposafter+1); + } + } + else + { + // We found a page break + $showpricebeforepagebreak=0; + } + } + else // No pagebreak + { + $pdf->commitTransaction(); + } + $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); @@ -288,7 +329,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page - if ($pageposafter > $pageposbefore) { + if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } @@ -299,7 +340,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxtva, $curY); - $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R'); + $pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R'); } // Unit price before discount @@ -320,7 +361,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Total HT line $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); $pdf->SetXY($this->postotalht, $curY); - $pdf->MultiCell(26, 3, $total_excl_tax, 0, 'R', 0); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $tvaligne=$object->lines[$i]->total_tva; @@ -366,6 +407,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { @@ -382,6 +424,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index efa93e17aec..ad380f7df50 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2013 Juanjo Menent @@ -110,7 +110,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->posxdiscount=162; $this->postotalht=174; //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; - $this->posxpicture=$this->posxtva - 16; // width of images + $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?16:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { $this->posxpicture-=20; @@ -233,6 +233,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->atleastonediscount++; } } + if (empty($this->atleastonediscount)) + { + $this->posxpicture+=($this->postotalht - $this->posxdiscount); + $this->posxtva+=($this->postotalht - $this->posxdiscount); + $this->posxup+=($this->postotalht - $this->posxdiscount); + $this->posxqty+=($this->postotalht - $this->posxdiscount); + $this->posxdiscount+=($this->postotalht - $this->posxdiscount); + //$this->postotalht; + } // New page $pdf->AddPage(); @@ -307,7 +316,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->AddPage('','',true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); - $pdf->setPage($pagenb+1); + $pdf->setPage($pageposafter+1); } } else From 2f101980649c85618cd10971892c9ee272377746 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 16:36:12 +0100 Subject: [PATCH 20/44] Fix: Option MAIN_PDF_DASH_BETWEEN_LINES was not working when tcpdf was making a pagebreak higher than 2 pages. --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 1 + htdocs/core/modules/commande/doc/pdf_proforma.modules.php | 1 + htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 1 + htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 1 + htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 1 + htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php | 1 + htdocs/core/modules/project/pdf/pdf_baleine.modules.php | 3 +++ htdocs/core/modules/propale/doc/pdf_azur.modules.php | 1 + .../modules/supplier_invoice/pdf/pdf_canelle.modules.php | 5 +++-- .../core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 1 + 10 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 835a9ffa43b..11a5e271dde 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -409,6 +409,7 @@ class pdf_einstein extends ModelePDFCommandes // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 848bbb92c64..b6021d17c0d 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -408,6 +408,7 @@ class pdf_proforma extends ModelePDFCommandes // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index fc3bd6281eb..dafff8b81ea 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -267,6 +267,7 @@ class pdf_merou extends ModelePdfExpedition // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 66f36e1b84f..d924da16785 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -264,6 +264,7 @@ class pdf_rouget extends ModelePdfExpedition // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 955f07a5b00..7d3c1f35154 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -410,6 +410,7 @@ class pdf_crabe extends ModelePDFFactures // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index febf66b5170..b9d61ec1049 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -379,6 +379,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index cca049cba92..881b112688e 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -222,12 +222,15 @@ class pdf_baleine extends ModelePDFProjects $pdf->MultiCell(20, 3, $dateend, 0, 'L'); + $pageposafter=$pdf->getPage(); + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut $nexY = $pdf->GetY(); // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 60de9eca768..4aea9af7085 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -466,6 +466,7 @@ class pdf_azur extends ModelePDFPropales // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index fa1ef339185..4ecaa978123 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -234,7 +234,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->posxdiscount+=($this->postotalht - $this->posxdiscount); //$this->postotalht; } - + // New page $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); @@ -321,7 +321,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $pdf->commitTransaction(); } - + $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); @@ -383,6 +383,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index ad380f7df50..cf8af3e6e7c 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -410,6 +410,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { + $pdf->setPage($pageposafter); $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); //$pdf->SetDrawColor(190,190,200); $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); From 212deb9e1c05d091b04477cf1bfbfc05b1f51abb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 17:15:18 +0100 Subject: [PATCH 21/44] Fix: fails to import when value is 'AUTO' because compare was case sensitive. --- htdocs/core/modules/import/import_csv.modules.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index f0766e271e5..dcac5cf6a91 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -443,7 +443,7 @@ class ImportCsv extends ModeleImports } elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifnull') { - if (empty($newval) || $newval=='auto') + if (empty($newval) || strtolower($newval) == 'auto') { $this->thirpartyobject->get_codeclient(0,0); $newval=$this->thirpartyobject->code_client; @@ -452,7 +452,7 @@ class ImportCsv extends ModeleImports } elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsuppliercodeifnull') { - if (empty($newval) || $newval=='auto') + if (empty($newval) || strtolower($newval) == 'auto') { $newval=$this->thirpartyobject->get_codefournisseur(0,1); $newval=$this->thirpartyobject->code_fournisseur; @@ -461,7 +461,7 @@ class ImportCsv extends ModeleImports } elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifnull') { - if (empty($newval) || $newval=='auto') + if (empty($newval) || strtolower($newval) == 'auto') { $this->thirpartyobject->get_codecompta('customer'); $newval=$this->thirpartyobject->code_compta; @@ -470,7 +470,7 @@ class ImportCsv extends ModeleImports } elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifnull') { - if (empty($newval) || $newval=='auto') + if (empty($newval) || strtolower($newval) == 'auto') { $this->thirpartyobject->get_codecompta('supplier'); $newval=$this->thirpartyobject->code_compta_fournisseur; @@ -653,7 +653,7 @@ function cleansep($value) function tablewithentity($table) { global $db; - + $resql=$db->DDLDescTable($table,'entity'); if ($resql) { @@ -662,7 +662,7 @@ function tablewithentity($table) if ($obj) return 1; else return 0; } - else return -1; + else return -1; } ?> From 2bc63a86a93ccdd5cda67b55c97d552d6d8dc5ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 18:05:52 +0100 Subject: [PATCH 22/44] Alignement of debian packaging files --- build/debian/README.Debian | 13 +++++++++++++ build/debian/README.source | 12 ------------ build/debian/dolibarr.doc-base | 10 ---------- build/debian/dolibarr.docs | 2 ++ build/debian/dolibarr.install | 2 -- build/debian/rules | 6 ++++++ build/launchpad/README | 2 +- build/makepack-dolibarr.pl | 7 +++---- 8 files changed, 25 insertions(+), 29 deletions(-) create mode 100644 build/debian/README.Debian delete mode 100644 build/debian/README.source delete mode 100644 build/debian/dolibarr.doc-base create mode 100644 build/debian/dolibarr.docs diff --git a/build/debian/README.Debian b/build/debian/README.Debian new file mode 100644 index 00000000000..e5262b8c61a --- /dev/null +++ b/build/debian/README.Debian @@ -0,0 +1,13 @@ +Information about Dolibarr in Debian +------------------------------------ + +The Debian package provides integration with apache2 and lighttpd. +If you have one of those servers installed, then Dolibarr is immediately +accessible at http://localhost/dolibarr/ + +But it won't be usable until you configure it via +http://localhost/dolibarr/install/ + +To complete the setup process you will need the MySQL root credentials +because the Dolibarr installer will create the database and the dedicated user +for you. diff --git a/build/debian/README.source b/build/debian/README.source deleted file mode 100644 index 298db1e8595..00000000000 --- a/build/debian/README.source +++ /dev/null @@ -1,12 +0,0 @@ -================================================================== -Dolibarr - Web based software to manage a small company or foundation -================================================================== - - -Note for package maintainers ----------------------------- -This file explains how to modify official sources (from http://www.dolibarr.org) -to have ready to use source files to build a debian package. - -All changes are included into patch file -build/debian/patches diff --git a/build/debian/dolibarr.doc-base b/build/debian/dolibarr.doc-base deleted file mode 100644 index d7d5666d883..00000000000 --- a/build/debian/dolibarr.doc-base +++ /dev/null @@ -1,10 +0,0 @@ -Document: dolibarr -Title: Dolibarr ERP & CRM documentation -Author: Dolibarr team -Abstract: This documentation covers the install, use and administration of - Dolibarr ERP & CRM software. -Section: Office - -Format: HTML -Index: /usr/share/doc/dolibarr/index.html -Files: /usr/share/doc/dolibarr/*.html \ No newline at end of file diff --git a/build/debian/dolibarr.docs b/build/debian/dolibarr.docs new file mode 100644 index 00000000000..5d4b554ef74 --- /dev/null +++ b/build/debian/dolibarr.docs @@ -0,0 +1,2 @@ +README.md +README-FR.md diff --git a/build/debian/dolibarr.install b/build/debian/dolibarr.install index 72dff46ed15..a49ad442eb5 100755 --- a/build/debian/dolibarr.install +++ b/build/debian/dolibarr.install @@ -6,8 +6,6 @@ debian/lighttpd/50-dolibarr.conf etc/lighttpd/conf-available/ debian/install.forced.php.install etc/dolibarr/ htdocs usr/share/dolibarr/ scripts usr/share/dolibarr/ -changelog usr/share/doc/dolibarr/ -README usr/share/doc/dolibarr/ doc/install usr/share/doc/dolibarr/ doc/user usr/share/doc/dolibarr/ doc/index.html usr/share/doc/dolibarr/ \ No newline at end of file diff --git a/build/debian/rules b/build/debian/rules index 776dd540eb7..bd3a9badb09 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -9,6 +9,12 @@ export DH_OPTIONS=-v %: dh $@ + +override_dh_auto_clean: +# Do nothing. Added to disable launchpad to use bugged dh_auto_clean search for ant + +override_dh_auto_build: +# Do nothing. Added to disable launchpad to use bugged dh_auto_build search for ant override_dh_install: dh_install diff --git a/build/launchpad/README b/build/launchpad/README index 0107c7d9537..973509aa6d1 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -81,7 +81,7 @@ If you want to build/test package locally: bzr init bzr add bzr commit -m "Init control files" - bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable] (put here any branch name) + bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable] (put here any branch name or just bzr push if into a known branch) - or download it from launchpad bazaar: cd bzr bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable] diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index b82fdcb05a0..b7c43443ed8 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -365,7 +365,6 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/build.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/quickbuild.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`; - $ret=`mv $BUILDROOT/$PROJECT/README.md $BUILDROOT/$PROJECT/README`; $ret=`rm -fr $BUILDROOT/$PROJECT/build/html`; $ret=`rm -f $BUILDROOT/$PROJECT/build/Doli*-*`; @@ -708,7 +707,7 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/copyright`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.config`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.desktop`; - $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.doc-base`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.docs`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.install`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.lintian-overrides`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.postrm`; @@ -716,6 +715,7 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/dolibarr.templates.futur`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/rules`; + $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.Debian`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/README.howto`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/debian/watch`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/doap`; @@ -744,11 +744,10 @@ if ($nboftargetok) { $ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/dolibarr.desktop" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/dolibarr.doc-base" "$BUILDROOT/$PROJECT.tmp/debian"`; + $ret=`cp -f "$SOURCE/build/debian/dolibarr.docs" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/dolibarr.install" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/dolibarr.lintian-overrides" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/dolibarr.xpm" "$BUILDROOT/$PROJECT.tmp/debian"`; - $ret=`cp -f "$SOURCE/build/debian/README.source" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/rules" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/watch" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -fr "$SOURCE/build/debian/patches" "$BUILDROOT/$PROJECT.tmp/debian"`; From 062c150bc1662c92099cb8ab780db0e59cc7244d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 19:33:43 +0100 Subject: [PATCH 23/44] Fix: import of fields with value "auto" --- htdocs/core/modules/import/import_csv.modules.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e0741c26cef..439fac7aaaa 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -250,7 +250,7 @@ class ImportCsv extends ModeleImports /** * Return array of next record in input file. * - * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string) + * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ function import_read_record() { @@ -383,7 +383,7 @@ class ImportCsv extends ModeleImports { // Set $newval with value to insert and set $listvalues with sql request part for insert $newval=''; - if ($arrayrecord[($key-1)]['type'] > 0) $newval=$arrayrecord[($key-1)]['val']; // If type of field is not null or '' but string + if ($arrayrecord[($key-1)]['type'] > 0) $newval=$arrayrecord[($key-1)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value // Make some tests on $newval @@ -447,6 +447,7 @@ class ImportCsv extends ModeleImports { $this->thirpartyobject->get_codeclient(0,0); $newval=$this->thirpartyobject->code_client; + if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" //print 'code_client='.$newval; } } @@ -456,6 +457,7 @@ class ImportCsv extends ModeleImports { $newval=$this->thirpartyobject->get_codefournisseur(0,1); $newval=$this->thirpartyobject->code_fournisseur; + if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" //print 'code_fournisseur='.$newval; } } @@ -465,6 +467,7 @@ class ImportCsv extends ModeleImports { $this->thirpartyobject->get_codecompta('customer'); $newval=$this->thirpartyobject->code_compta; + if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" //print 'code_compta='.$newval; } } @@ -474,6 +477,7 @@ class ImportCsv extends ModeleImports { $this->thirpartyobject->get_codecompta('supplier'); $newval=$this->thirpartyobject->code_compta_fournisseur; + if (empty($newval)) $arrayrecord[($key-1)]['type']=-1; // If we get empty value, we will use "null" //print 'code_compta_fournisseur='.$newval; } } @@ -540,6 +544,7 @@ class ImportCsv extends ModeleImports if ($listfields) { $listfields.=', '; $listvalues.=', '; } $listfields.=$fieldname; + // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert if (empty($newval) && $arrayrecord[($key-1)]['type'] < 0) $listvalues.=($newval=='0'?$newval:"null"); elseif (empty($newval) && $arrayrecord[($key-1)]['type'] == 0) $listvalues.="''"; else $listvalues.="'".$this->db->escape($newval)."'"; @@ -653,7 +658,7 @@ function cleansep($value) function tablewithentity($table) { global $db; - + $resql=$db->DDLDescTable($table,'entity'); if ($resql) { @@ -662,7 +667,7 @@ function tablewithentity($table) if ($obj) return 1; else return 0; } - else return -1; + else return -1; } ?> From 2cced0bf437dc8176bd39259cd4ca5da87e9882f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 20:02:39 +0100 Subject: [PATCH 24/44] Perf: Avoid makign a "desc table" for each row we import (for this we are using a global cache array). --- .../modules/import/import_csv.modules.php | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index f0766e271e5..0162792974c 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -335,7 +335,8 @@ class ImportCsv extends ModeleImports function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid) { global $langs,$conf,$user; - global $thirdparty_static; // Specifi to thirdparty import + global $thirdparty_static; // Specific to thirdparty import + global $tablewithentity_cache; // Cache to avoid to call desc at each rows on tables $error=0; $warning=0; @@ -371,6 +372,25 @@ class ImportCsv extends ModeleImports $i=0; $errorforthistable=0; + // Define $tablewithentity_cache[$tablename] if not already defined + if (! isset($tablewithentity_cache[$tablename])) // keep this test with "isset" + { + dol_syslog("Check if table ".$tablename." has an entity field"); + $resql=$this->db->DDLDescTable($tablename,'entity'); + if ($resql) + { + $obj=$this->db->fetch_object($resql); + if ($obj) $tablewithentity_cache[$tablename]=1; // table contains entity field + else $tablewithentity_cache[$tablename]=0; // table does not contains entity field + } + else dol_print_error($this->db);; + } + else + { + //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); + } + + // Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom) foreach($sort_array_match_file_to_database as $key => $val) { @@ -581,7 +601,7 @@ class ImportCsv extends ModeleImports //var_dump($objimport->array_import_convertvalue); exit; // Build SQL request - if (! tablewithentity($tablename)) + if (empty($tablewithentity[$tablename])) { $sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key'; if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias]; @@ -644,25 +664,4 @@ function cleansep($value) return str_replace(array(',',';'),'/',$value); }; -/** - * Returns if a table contains entity column - * - * @param string $table Table name - * @return int 1 if table contains entity, 0 if not and -1 if error - */ -function tablewithentity($table) -{ - global $db; - - $resql=$db->DDLDescTable($table,'entity'); - if ($resql) - { - $i=0; - $obj=$db->fetch_object($resql); - if ($obj) return 1; - else return 0; - } - else return -1; -} - ?> From dc7db87ee53571eba11283044dee2efe5c1abc8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 20:23:29 +0100 Subject: [PATCH 25/44] Perf: Avoid makign a "desc table" for each row we import (for this we are using a global cache array). --- htdocs/imports/import.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 6bb65e258c9..e824c964cb0 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -482,7 +482,7 @@ if ($step == 3 && $datatoimport) if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"].'?urlfile='.urlencode(GETPOST('urlfile')).'&step=3'.$param, $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - + } print ''; @@ -1307,7 +1307,10 @@ if ($step == 5 && $datatoimport) $result=$obj->import_open_file($pathfile,$langs); if ($result > 0) { - $sourcelinenb=0; $endoffile=0; + global $tablewithentity_cache; + $tablewithentity_cache=array(); + $sourcelinenb=0; $endoffile=0; + // Loop on each input file record while ($sourcelinenb < $nboflines && ! $endoffile) { @@ -1621,7 +1624,10 @@ if ($step == 6 && $datatoimport) $result=$obj->import_open_file($pathfile,$langs); if ($result > 0) { + global $tablewithentity_cache; + $tablewithentity_cache=array(); $sourcelinenb=0; $endoffile=0; + while ($sourcelinenb < $nboflines && ! $endoffile) { $sourcelinenb++; From 4afb85bd1d36ccdd4e4cd5ad7e0db956d9441038 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 22:30:25 +0100 Subject: [PATCH 26/44] Fix: Several fix into workflow/condition for invoice payments or convert into discount. --- htdocs/compta/facture.php | 41 +++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f8655c7c850..46d868085c3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -578,14 +578,21 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes') // Convertir en reduc else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->rights->facture->creer) { - $db->begin(); - $object->fetch($id); $object->fetch_thirdparty(); $object->fetch_lines(); - if (!empty($object->paye)) // protection against multiple submit + // Check if there is already a discount (protection to avoid duplicate creation when resubmit post) + $discountcheck=new DiscountAbsolute($db); + $result=$discountcheck->fetch(0,$object->id); + + $canconvert=0; + if ($object->type == 3 && $object->paye == 1 && empty($discountcheck->id)) $canconvert=1; // we can convert deposit into discount if deposit is payed completely and not already converted (see real condition into condition used to show button converttoreduc) + if ($object->type == 2 && $object->paye == 0 && empty($discountcheck->id)) $canconvert=1; // we can convert credit note into discount if credit note is not payed back and amount of payment is 0 (see real condition into condition used to show button converttoreduc) + if ($canconvert) { + $db->begin(); + // Boucle sur chaque taux de tva $i=0; foreach($object->lines as $line) @@ -1980,9 +1987,10 @@ if ($action == 'update_extras') } + /* * View -*/ + */ $form = new Form($db); $formother=new FormOther($db); @@ -2185,6 +2193,7 @@ if ($action == 'create') $options.=''; } + // Show link for credit note $facids=$facturestatic->list_qualified_avoir_invoices($soc->id); if ($facids < 0) { @@ -3592,7 +3601,10 @@ else if ($id > 0 || ! empty($ref)) } // Reopen a standard paid invoice - if (($object->type == 0 || $object->type == 1) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) + if ((($object->type == 0 || $object->type == 1) + || ($object->type == 2 && empty($discount->id)) + || ($object->type == 3 && empty($discount->id))) + && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) { if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice { @@ -3679,23 +3691,32 @@ else if ($id > 0 || ! empty($ref)) // For credit note only if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) { - print ''; + if ($resteapayer == 0) + { + print '
'.$langs->trans('DoPaymentBack').'
'; + } + else + { + print ''; + } } + // For credit note if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->creer && $object->getSommePaiement() == 0) { print ''; } // For deposit invoice - if ($object->type == 3 && $object->statut == 2 && $resteapayer == 0 && $user->rights->facture->creer && empty($discount->id)) + if ($object->type == 3 && $object->paye == 1 && $resteapayer == 0 && $user->rights->facture->creer && empty($discount->id)) { print ''; } } - // Classify paid (if not deposit and not credit note. Such invoice are "converted") - if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement && - (($object->type != 2 && $object->type != 3 && $resteapayer <= 0) || ($object->type == 2 && $resteapayer >= 0)) ) + // Classify paid + if ($object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement && (($object->type != 2 && $object->type != 3 && $resteapayer <= 0) || ($object->type == 2 && $resteapayer >= 0)) + || ($object->type == 3 && $object->paye == 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id)) + ) { print ''; } From 68396e023c879d354ce50f4cfb759b6753697da0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 23:49:07 +0100 Subject: [PATCH 27/44] New: When creating an invoice all types are visible (even if for the moment we just show an help text to explain how to use type credit note and deposit). --- htdocs/compta/facture.php | 132 +++++++++++++++++++--------------- htdocs/langs/en_US/bills.lang | 15 ++-- 2 files changed, 81 insertions(+), 66 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b3d365650b5..e31683f841d 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani @@ -26,10 +26,11 @@ */ /** - * \file htdocs/compta/facture.php + * \file htdocs/compta/facture.php * \ingroup facture - * \brief Page to create/see an invoice + * \brief Page to create/see an invoice */ + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; @@ -81,8 +82,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co // Security check $fieldid = (! empty($ref) ? 'facnumber' : 'rowid'); -if ($user->societe_id) - $socid = $user->societe_id; +if ($user->societe_id) $socid = $user->societe_id; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); // Nombre de ligne pour choix de produit/service predefinis @@ -1753,6 +1753,7 @@ if ($action == 'update_extras') { } + /* * View */ @@ -1782,6 +1783,7 @@ jQuery(document).ready(function() { * * ******************************************************************** */ + if ($action == 'create') { $facturestatic = new Facture($db); @@ -1860,8 +1862,7 @@ if ($action == 'create') print ''; print ''; print ''; - if ($soc->id > 0) - print '' . "\n"; + if ($soc->id > 0) print '' . "\n"; print ''; print ''; print ''; @@ -1875,7 +1876,8 @@ if ($action == 'create') // Thirdparty print '
'; - if ($soc->id > 0) { + if ($soc->id > 0) + { print ''; - } else { + } + else + { print ''; @@ -1986,17 +1990,6 @@ if ($action == 'create') print $desc; print '' . "\n"; - // Proforma - if (! empty($conf->global->FACTURE_USE_PROFORMAT)) - { - print '' . "\n"; - } - if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { // Deposit @@ -2055,45 +2048,70 @@ if ($action == 'create') print $desc; print '' . "\n"; } - - if (empty($origin) && $socid > 0) + else { - // Credit note - print '' . "\n"; } + if (empty($origin)) + { + if ($socid > 0) + { + // Credit note + print '' . "\n"; + } + else + { + print '' . "\n"; + } + } + print '
' . $langs->trans('Customer') . ''; print $soc->getNomUrl(1); print ''; @@ -1883,14 +1885,16 @@ if ($action == 'create') $outstandigBills = $soc->get_OutstandingBill(); print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency); - if ($soc->outstanding_limit != '') { - if ($outstandigBills > $soc->outstanding_limit) - print img_warning($langs->trans("OutstandingBillReached")); + if ($soc->outstanding_limit != '') + { + if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); print ' / ' . price($soc->outstanding_limit); } print ')'; print ''; print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 1); print '
'; - print ''; - print ''; - $desc = $form->textwithpicto($langs->trans("InvoiceProForma"), $langs->transnoentities("InvoiceProFormaDesc"), 1); - print $desc; - print '
'; - print ''; - print ''; - print ''; - $text = $langs->transnoentities("InvoiceAvoirAsk") . ' '; - // $text.=''; - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + print '
'; + print ''; + print ''; + $text = $langs->trans("InvoiceReplacement") . ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1); print $desc; - - print '    0 ? 'checked="checked"':'').' /> "; - print '
    0 ? 'checked="checked"':'').' /> "; - print '
'; + print ''; + print ''; + print ''; + $text = $langs->transnoentities("InvoiceAvoirAsk") . ' '; + // $text.=''; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + print $desc; + + print '    0 ? 'checked="checked"':'').' /> "; + print '
    0 ? 'checked="checked"':'').' /> "; + + print '
'; + print ''; + print ''; + $text = $langs->trans("InvoiceAvoir") . ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1); + print $desc; + print '
'; print ''; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index b182952940e..1c83efae5cc 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -24,7 +24,7 @@ InvoiceProFormaAsk=Proforma invoice InvoiceProFormaDesc=Proforma invoice is an image of a true invoice but has no accountancy value. InvoiceReplacement=Replacement invoice InvoiceReplacementAsk=Replacement invoice for invoice -InvoiceReplacementDesc=Replacement invoice is used to cancel and replace completely an invoice with no payment already received.

Note: Only invoice with no payment on it can be replaced. If not closed, it will be automatically closed to 'abandoned'. +InvoiceReplacementDesc=Replacement invoice is used to cancel and replace completely an invoice with no payment already received.

Note: Only invoices with no payment on it can be replaced. If the invoice you replace is not yet closed, it will be automatically closed to 'abandoned'. InvoiceAvoir=Credit note InvoiceAvoirAsk=Credit note to correct invoice InvoiceAvoirDesc=The credit note is a negative invoice used to solve fact that an invoice has an amount that differs than amount really paid (because customer paid too much by error, or will not paid completely since he returned some products for example). @@ -399,6 +399,11 @@ ToMakePaymentBack=Pay back ListOfYourUnpaidInvoices=List of unpaid invoices NoteListOfYourUnpaidInvoices=Note: This list contains only invoices for third parties you are linked to as a sale representative. RevenueStamp=Revenue stamp +YouMustCreateInvoiceFromThird=This option is only available when creating invoice from tab "customer" of thirdparty +PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template) +TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for credit notes and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 +TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. ##### Types de contacts ##### TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice TypeContact_facture_external_BILLING=Customer invoice contact @@ -408,11 +413,3 @@ TypeContact_invoice_supplier_internal_SALESREPFOLL=Representative following-up s TypeContact_invoice_supplier_external_BILLING=Supplier invoice contact TypeContact_invoice_supplier_external_SHIPPING=Supplier shipping contact TypeContact_invoice_supplier_external_SERVICE=Supplier service contact -# crabe PDF Model -PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template) -# oursin PDF Model -PDFOursinDescription=Invoice PDF template Oursin. A complete invoice template (alternative Template) -# NumRef Modules -TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 -MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for credit notes and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 -TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module. From 4bf822225e795e23e3e6cf4d8c2b1a4e686798c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 23:50:10 +0100 Subject: [PATCH 28/44] Look: info admin picto now use the info picto (the star were confused with the mandatory "star"). --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index efcbff69a13..db204b53ebd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2223,10 +2223,10 @@ function info_admin($text, $infoonimgalt = 0, $nodiv=0) if ($infoonimgalt) { - return img_picto($text, 'star', 'class="hideonsmartphone"'); + return img_picto($text, 'info', 'class="hideonsmartphone"'); } - return ($nodiv?'':'
').img_picto($langs->trans('InfoAdmin'), 'star', 'class="hideonsmartphone"').' '.$text.($nodiv?'':'
'); + return ($nodiv?'':'
').img_picto($langs->trans('InfoAdmin'), 'info', 'class="hideonsmartphone"').' '.$text.($nodiv?'':'
'); } From 69bc69604e49841b997f0a7498cd199dc0f0cf8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Mar 2014 23:58:48 +0100 Subject: [PATCH 29/44] Fix: Bad test --- htdocs/compta/facture.php | 359 ++++++++++++++++++++------------------ 1 file changed, 191 insertions(+), 168 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e31683f841d..60ae203cc6f 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -236,7 +236,7 @@ else if ($action == 'set_thirdparty' && $user->rights->facture->creer) { else if ($action == 'classin' && $user->rights->facture->creer) { $object->fetch($id); - $object->setProject($_POST ['projectid']); + $object->setProject($_POST['projectid']); } else if ($action == 'setmode' && $user->rights->facture->creer) { @@ -244,10 +244,12 @@ else if ($action == 'setmode' && $user->rights->facture->creer) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) dol_print_error($db, $object->error); -} else if ($action == 'setinvoicedate' && $user->rights->facture->creer) { +} + +else if ($action == 'setinvoicedate' && $user->rights->facture->creer) { $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; - $object->date = dol_mktime(12, 0, 0, $_POST ['invoicedatemonth'], $_POST ['invoicedateday'], $_POST ['invoicedateyear']); + $object->date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']); $new_date_lim_reglement = $object->calculate_date_lim_reglement(); if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement = $new_date_lim_reglement; @@ -256,7 +258,9 @@ else if ($action == 'setmode' && $user->rights->facture->creer) { $result = $object->update($user); if ($result < 0) dol_print_error($db, $object->error); -} else if ($action == 'setconditions' && $user->rights->facture->creer) { +} + +else if ($action == 'setconditions' && $user->rights->facture->creer) { $object->fetch($id); $object->cond_reglement_code = 0; // To clean property $object->cond_reglement_id = 0; // To clean property @@ -273,9 +277,11 @@ else if ($action == 'setmode' && $user->rights->facture->creer) { $result = $object->update($user); if ($result < 0) dol_print_error($db, $object->error); -} else if ($action == 'setpaymentterm' && $user->rights->facture->creer) { +} + +else if ($action == 'setpaymentterm' && $user->rights->facture->creer) { $object->fetch($id); - $object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST ['paymenttermmonth'], $_POST ['paymenttermday'], $_POST ['paymenttermyear']); + $object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']); if ($object->date_lim_reglement < $object->date) { $object->date_lim_reglement = $object->calculate_date_lim_reglement(); setEventMessage($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), 'warnings'); @@ -283,22 +289,28 @@ else if ($action == 'setmode' && $user->rights->facture->creer) { $result = $object->update($user); if ($result < 0) dol_print_error($db, $object->error); -} else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) { +} + +else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) { $object->fetch($id); $object->revenuestamp = GETPOST('revenuestamp'); $result = $object->update($user); $object->update_price(1); if ($result < 0) dol_print_error($db, $object->error); -} else if ($action == 'setremisepercent' && $user->rights->facture->creer) { +} + +else if ($action == 'setremisepercent' && $user->rights->facture->creer) { $object->fetch($id); - $result = $object->set_remise($user, $_POST ['remise_percent']); -} else if ($action == "setabsolutediscount" && $user->rights->facture->creer) { + $result = $object->set_remise($user, $_POST['remise_percent']); +} + +else if ($action == "setabsolutediscount" && $user->rights->facture->creer) { // POST[remise_id] ou POST[remise_id_for_payment] - if (! empty($_POST ["remise_id"])) { + if (! empty($_POST["remise_id"])) { $ret = $object->fetch($id); if ($ret > 0) { - $result = $object->insert_discount($_POST ["remise_id"]); + $result = $object->insert_discount($_POST["remise_id"]); if ($result < 0) { $mesgs [] = '
' . $object->error . '
'; } @@ -306,10 +318,10 @@ else if ($action == 'setmode' && $user->rights->facture->creer) { dol_print_error($db, $object->error); } } - if (! empty($_POST ["remise_id_for_payment"])) { + if (! empty($_POST["remise_id_for_payment"])) { require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; $discount = new DiscountAbsolute($db); - $discount->fetch($_POST ["remise_id_for_payment"]); + $discount->fetch($_POST["remise_id_for_payment"]); $result = $discount->link_to_invoice(0, $id); if ($result < 0) { @@ -320,7 +332,7 @@ else if ($action == 'setmode' && $user->rights->facture->creer) { else if ($action == 'set_ref_client' && $user->rights->facture->creer) { $object->fetch($id); - $object->set_ref_client($_POST ['ref_client']); + $object->set_ref_client($_POST['ref_client']); } // Classify to validated @@ -464,8 +476,8 @@ else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->factur } // Classif "paid partialy" else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) { $object->fetch($id); - $close_code = $_POST ["close_code"]; - $close_note = $_POST ["close_note"]; + $close_code = $_POST["close_code"]; + $close_note = $_POST["close_note"]; if ($close_code) { $result = $object->set_paid($user, $close_code, $close_note); } else { @@ -474,8 +486,8 @@ else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->righ } // Classify "abandoned" else if ($action == 'confirm_canceled' && $confirm == 'yes') { $object->fetch($id); - $close_code = $_POST ["close_code"]; - $close_note = $_POST ["close_note"]; + $close_code = $_POST["close_code"]; + $close_note = $_POST["close_note"]; if ($close_code) { $result = $object->set_canceled($user, $close_code, $close_note); } else { @@ -564,9 +576,9 @@ else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $user->righ /* * Insert new invoice in database */ -else if ($action == 'add' && $user->rights->facture->creer) { - if ($socid > 0) - $object->socid = GETPOST('socid', 'int'); +else if ($action == 'add' && $user->rights->facture->creer) +{ + if ($socid > 0) $object->socid = GETPOST('socid', 'int'); $db->begin(); @@ -575,41 +587,41 @@ else if ($action == 'add' && $user->rights->facture->creer) { // Fill array 'array_options' with data from add form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - if ($ret < 0) - $error ++; + if ($ret < 0) $error ++; // Replacement invoice - if ($_POST ['type'] == 1) { - $datefacture = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']); + if ($_POST['type'] == Facture::TYPE_REPLACEMENT) + { + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); } - if (! ($_POST ['fac_replacement'] > 0)) { + if (! ($_POST['fac_replacement'] > 0)) { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), 'errors'); } if (! $error) { // This is a replacement invoice - $result = $object->fetch($_POST ['fac_replacement']); + $result = $object->fetch($_POST['fac_replacement']); $object->fetch_thirdparty(); $object->date = $datefacture; - $object->note_public = trim($_POST ['note_public']); - $object->note = trim($_POST ['note']); - $object->ref_client = $_POST ['ref_client']; - $object->ref_int = $_POST ['ref_int']; - $object->modelpdf = $_POST ['model']; - $object->fk_project = $_POST ['projectid']; - $object->cond_reglement_id = $_POST ['cond_reglement_id']; - $object->mode_reglement_id = $_POST ['mode_reglement_id']; - $object->remise_absolue = $_POST ['remise_absolue']; - $object->remise_percent = $_POST ['remise_percent']; + $object->note_public = trim($_POST['note_public']); + $object->note = trim($_POST['note']); + $object->ref_client = $_POST['ref_client']; + $object->ref_int = $_POST['ref_int']; + $object->modelpdf = $_POST['model']; + $object->fk_project = $_POST['projectid']; + $object->cond_reglement_id = $_POST['cond_reglement_id']; + $object->mode_reglement_id = $_POST['mode_reglement_id']; + $object->remise_absolue = $_POST['remise_absolue']; + $object->remise_percent = $_POST['remise_percent']; // Proprietes particulieres a facture de remplacement - $object->fk_facture_source = $_POST ['fac_replacement']; + $object->fk_facture_source = $_POST['fac_replacement']; $object->type = Facture::TYPE_REPLACEMENT; $id = $object->createFromCurrent($user); @@ -619,40 +631,44 @@ else if ($action == 'add' && $user->rights->facture->creer) { } // Credit note invoice - if ($_POST ['type'] == 2) { - if (! $_POST ['fac_avoir'] > 0) { + if ($_POST['type'] == Facture::TYPE_CREDIT_NOTE) + { + if (! ($_POST['fac_avoir'] > 0)) + { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), 'errors'); } - $datefacture = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']); - if (empty($datefacture)) { + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($datefacture)) + { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->trans("Date")), 'errors'); } - if (! $error) { + if (! $error) + { // Si facture avoir - $datefacture = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']); + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); // $result=$object->fetch($_POST['fac_avoir']); $object->socid = GETPOST('socid', 'int'); - $object->number = $_POST ['facnumber']; + $object->number = $_POST['facnumber']; $object->date = $datefacture; - $object->note_public = trim($_POST ['note_public']); - $object->note = trim($_POST ['note']); - $object->ref_client = $_POST ['ref_client']; - $object->ref_int = $_POST ['ref_int']; - $object->modelpdf = $_POST ['model']; - $object->fk_project = $_POST ['projectid']; + $object->note_public = trim($_POST['note_public']); + $object->note = trim($_POST['note']); + $object->ref_client = $_POST['ref_client']; + $object->ref_int = $_POST['ref_int']; + $object->modelpdf = $_POST['model']; + $object->fk_project = $_POST['projectid']; $object->cond_reglement_id = 0; - $object->mode_reglement_id = $_POST ['mode_reglement_id']; - $object->remise_absolue = $_POST ['remise_absolue']; - $object->remise_percent = $_POST ['remise_percent']; + $object->mode_reglement_id = $_POST['mode_reglement_id']; + $object->remise_absolue = $_POST['remise_absolue']; + $object->remise_percent = $_POST['remise_percent']; // Proprietes particulieres a facture avoir - $object->fk_facture_source = $_POST ['fac_avoir']; + $object->fk_facture_source = $_POST['fac_avoir']; $object->type = Facture::TYPE_CREDIT_NOTE; $id = $object->create($user); @@ -701,20 +717,20 @@ else if ($action == 'add' && $user->rights->facture->creer) { /* TODO delete for($i = 1; $i <= $NBLINES; $i ++) { - if ($_POST ['idprod' . $i]) { + if ($_POST['idprod' . $i]) { $product = new Product($db); - $product->fetch($_POST ['idprod' . $i]); - $startday = dol_mktime(12, 0, 0, $_POST ['date_start' . $i . 'month'], $_POST ['date_start' . $i . 'day'], $_POST ['date_start' . $i . 'year']); - $endday = dol_mktime(12, 0, 0, $_POST ['date_end' . $i . 'month'], $_POST ['date_end' . $i . 'day'], $_POST ['date_end' . $i . 'year']); - $result = $object->addline($product->description, $product->price, $_POST ['qty' . $i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST ['idprod' . $i], $_POST ['remise_percent' . $i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); + $product->fetch($_POST['idprod' . $i]); + $startday = dol_mktime(12, 0, 0, $_POST['date_start' . $i . 'month'], $_POST['date_start' . $i . 'day'], $_POST['date_start' . $i . 'year']); + $endday = dol_mktime(12, 0, 0, $_POST['date_end' . $i . 'month'], $_POST['date_end' . $i . 'day'], $_POST['date_end' . $i . 'year']); + $result = $object->addline($product->description, $product->price, $_POST['qty' . $i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod' . $i], $_POST['remise_percent' . $i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); } }*/ } } // Standard invoice or Deposit invoice created from a Predefined invoice - if (($_POST ['type'] == 0 || $_POST ['type'] == 3) && $_POST ['fac_rec'] > 0) { - $datefacture = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']); + if (($_POST['type'] == 0 || $_POST['type'] == 3) && $_POST['fac_rec'] > 0) { + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); @@ -722,30 +738,30 @@ else if ($action == 'add' && $user->rights->facture->creer) { if (! $error) { $object->socid = GETPOST('socid', 'int'); - $object->type = $_POST ['type']; - $object->number = $_POST ['facnumber']; + $object->type = $_POST['type']; + $object->number = $_POST['facnumber']; $object->date = $datefacture; - $object->note_public = trim($_POST ['note_public']); - $object->note_private = trim($_POST ['note_private']); - $object->ref_client = $_POST ['ref_client']; - $object->ref_int = $_POST ['ref_int']; - $object->modelpdf = $_POST ['model']; + $object->note_public = trim($_POST['note_public']); + $object->note_private = trim($_POST['note_private']); + $object->ref_client = $_POST['ref_client']; + $object->ref_int = $_POST['ref_int']; + $object->modelpdf = $_POST['model']; // Source facture - $object->fac_rec = $_POST ['fac_rec']; + $object->fac_rec = $_POST['fac_rec']; $id = $object->create($user); } } // Standard or deposit or proforma invoice - if (($_POST ['type'] == 0 || $_POST ['type'] == 3 || $_POST ['type'] == 4) && $_POST ['fac_rec'] <= 0) { + if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0) { if (GETPOST('socid', 'int') < 1) { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors'); } - $datefacture = dol_mktime(12, 0, 0, $_POST ['remonth'], $_POST ['reday'], $_POST ['reyear']); + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); if (empty($datefacture)) { $error ++; setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); @@ -755,26 +771,26 @@ else if ($action == 'add' && $user->rights->facture->creer) { // Si facture standard $object->socid = GETPOST('socid', 'int'); $object->type = GETPOST('type'); - $object->number = $_POST ['facnumber']; + $object->number = $_POST['facnumber']; $object->date = $datefacture; - $object->note_public = trim($_POST ['note_public']); - $object->note_private = trim($_POST ['note_private']); - $object->ref_client = $_POST ['ref_client']; - $object->ref_int = $_POST ['ref_int']; - $object->modelpdf = $_POST ['model']; - $object->fk_project = $_POST ['projectid']; - $object->cond_reglement_id = ($_POST ['type'] == 3 ? 1 : $_POST ['cond_reglement_id']); - $object->mode_reglement_id = $_POST ['mode_reglement_id']; - $object->amount = $_POST ['amount']; - $object->remise_absolue = $_POST ['remise_absolue']; - $object->remise_percent = $_POST ['remise_percent']; + $object->note_public = trim($_POST['note_public']); + $object->note_private = trim($_POST['note_private']); + $object->ref_client = $_POST['ref_client']; + $object->ref_int = $_POST['ref_int']; + $object->modelpdf = $_POST['model']; + $object->fk_project = $_POST['projectid']; + $object->cond_reglement_id = ($_POST['type'] == 3 ? 1 : $_POST['cond_reglement_id']); + $object->mode_reglement_id = $_POST['mode_reglement_id']; + $object->amount = $_POST['amount']; + $object->remise_absolue = $_POST['remise_absolue']; + $object->remise_percent = $_POST['remise_percent']; $object->fetch_thirdparty(); // If creation from another object of another module (Example: origin=propal, originid=1) - if ($_POST ['origin'] && $_POST ['originid']) { + if ($_POST['origin'] && $_POST['originid']) { // Parse element/subelement (ex: project_task) - $element = $subelement = $_POST ['origin']; - if (preg_match('/^([^_]+)_([^_]+)/i', $_POST ['origin'], $regs)) { + $element = $subelement = $_POST['origin']; + if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) { $element = $regs [1]; $subelement = $regs [2]; } @@ -797,20 +813,20 @@ else if ($action == 'add' && $user->rights->facture->creer) { $element = $subelement = 'expedition'; } - $object->origin = $_POST ['origin']; - $object->origin_id = $_POST ['originid']; + $object->origin = $_POST['origin']; + $object->origin_id = $_POST['originid']; // Possibility to add external linked objects with hooks $object->linked_objects [$object->origin] = $object->origin_id; - if (is_array($_POST ['other_linked_objects']) && ! empty($_POST ['other_linked_objects'])) { - $object->linked_objects = array_merge($object->linked_objects, $_POST ['other_linked_objects']); + if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) { + $object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']); } $id = $object->create($user); if ($id > 0) { // If deposit invoice - if ($_POST ['type'] == 3) { + if ($_POST['type'] == 3) { $typeamount = GETPOST('typedeposit', 'alpha'); $valuedeposit = GETPOST('valuedeposit', 'int'); @@ -980,12 +996,12 @@ else if ($action == 'add' && $user->rights->facture->creer) { $id = $object->create($user); for($i = 1; $i <= $NBLINES; $i ++) { - if ($_POST ['idprod' . $i]) { + if ($_POST['idprod' . $i]) { $product = new Product($db); - $product->fetch($_POST ['idprod' . $i]); - $startday = dol_mktime(12, 0, 0, $_POST ['date_start' . $i . 'month'], $_POST ['date_start' . $i . 'day'], $_POST ['date_start' . $i . 'year']); - $endday = dol_mktime(12, 0, 0, $_POST ['date_end' . $i . 'month'], $_POST ['date_end' . $i . 'day'], $_POST ['date_end' . $i . 'year']); - $result = $object->addline($product->description, $product->price, $_POST ['qty' . $i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST ['idprod' . $i], $_POST ['remise_percent' . $i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); + $product->fetch($_POST['idprod' . $i]); + $startday = dol_mktime(12, 0, 0, $_POST['date_start' . $i . 'month'], $_POST['date_start' . $i . 'day'], $_POST['date_start' . $i . 'year']); + $endday = dol_mktime(12, 0, 0, $_POST['date_end' . $i . 'month'], $_POST['date_end' . $i . 'day'], $_POST['date_end' . $i . 'year']); + $result = $object->addline($product->description, $product->price, $_POST['qty' . $i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod' . $i], $_POST['remise_percent' . $i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); } } } @@ -993,40 +1009,47 @@ else if ($action == 'add' && $user->rights->facture->creer) { } // End of object creation, we show it - if ($id > 0 && ! $error) { + if ($id > 0 && ! $error) + { $db->commit(); header('Location: ' . $_SERVER ["PHP_SELF"] . '?facid=' . $id); exit(); - } else { + } + else + { $db->rollback(); $action = 'create'; - $_GET ["origin"] = $_POST ["origin"]; - $_GET ["originid"] = $_POST ["originid"]; + $_GET ["origin"] = $_POST["origin"]; + $_GET ["originid"] = $_POST["originid"]; $mesgs [] = '
' . $object->error . '
'; } } // Add a new line -else if (($action == 'addline' || $action == 'addline_predef') && $user->rights->facture->creer) { +else if (($action == 'addline' || $action == 'addline_predef') && $user->rights->facture->creer) +{ $langs->load('errors'); $error = 0; // Set if we used free entry or predefined product - if (GETPOST('addline_libre')) { + if (GETPOST('addline_libre')) + { $predef = ''; $idprod = 0; $product_desc = (GETPOST('dp_desc') ? GETPOST('dp_desc') : ''); $price_ht = GETPOST('price_ht'); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } - if (GETPOST('addline_predefined')) { + if (GETPOST('addline_predefined')) + { $predef = (($conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : ''); $idprod = GETPOST('idprod', 'int'); $product_desc = (GETPOST('product_desc') ? GETPOST('product_desc') : (GETPOST('np_desc') ? GETPOST('np_desc') : '')); $price_ht = ''; $tva_tx = ''; } - if (GETPOST('usenewaddlineform')) { // TODO Remove this + if (GETPOST('usenewaddlineform')) // TODO Remove this + { $idprod = GETPOST('idprod', 'int'); $product_desc = (GETPOST('product_desc') ? GETPOST('product_desc') : (GETPOST('np_desc') ? GETPOST('np_desc') : (GETPOST('dp_desc') ? GETPOST('dp_desc') : ''))); $price_ht = GETPOST('price_ht'); @@ -1043,7 +1066,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- if (is_array($extralabelsline)) { // Get extra fields foreach ($extralabelsline as $key => $value) { - unset($_POST ["options_" . $key . $predef]); + unset($_POST["options_" . $key . $predef]); } } @@ -1235,29 +1258,29 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - unset($_POST ['qty']); - unset($_POST ['type']); - unset($_POST ['remise_percent']); - unset($_POST ['price_ht']); - unset($_POST ['price_ttc']); - unset($_POST ['tva_tx']); - unset($_POST ['product_ref']); - unset($_POST ['product_label']); - unset($_POST ['product_desc']); - unset($_POST ['fournprice']); - unset($_POST ['buying_price']); - unset($_POST ['np_marginRate']); - unset($_POST ['np_markRate']); - unset($_POST ['dp_desc']); + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); + unset($_POST['dp_desc']); - unset($_POST ['idprod']); - unset($_POST ['qty_predef']); - unset($_POST ['remise_percent_predef']); - unset($_POST ['fournprice_predef']); - unset($_POST ['buying_price_predef']); - unset($_POST ['np_marginRate_predef']); - unset($_POST ['np_markRate_predef']); - unset($_POST ['np_desc']); + unset($_POST['idprod']); + unset($_POST['qty_predef']); + unset($_POST['remise_percent_predef']); + unset($_POST['fournprice_predef']); + unset($_POST['buying_price_predef']); + unset($_POST['np_marginRate_predef']); + unset($_POST['np_markRate_predef']); + unset($_POST['np_desc']); } else { setEventMessage($object->error, 'errors'); } @@ -1303,7 +1326,7 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST(' if (is_array($extralabelsline)) { // Get extra fields foreach ($extralabelsline as $key => $value) { - unset($_POST ["options_" . $key]); + unset($_POST["options_" . $key]); } } @@ -1359,25 +1382,25 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST(' facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - unset($_POST ['qty']); - unset($_POST ['type']); - unset($_POST ['productid']); - unset($_POST ['remise_percent']); - unset($_POST ['price_ht']); - unset($_POST ['price_ttc']); - unset($_POST ['tva_tx']); - unset($_POST ['product_ref']); - unset($_POST ['product_label']); - unset($_POST ['product_desc']); - unset($_POST ['fournprice']); - unset($_POST ['buying_price']); + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['productid']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); } else { setEventMessage($object->error, 'errors'); } } } -else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST ['cancel'] == $langs->trans('Cancel')) { +else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) { header('Location: ' . $_SERVER ["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition exit(); } @@ -1452,7 +1475,7 @@ if (GETPOST('addfile')) { /* * Remove file in email form */ -if (! empty($_POST ['removedfile'])) { +if (! empty($_POST['removedfile'])) { require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; // Set tmp user directory @@ -1460,14 +1483,14 @@ if (! empty($_POST ['removedfile'])) { $upload_dir_tmp = $vardir . '/temp'; // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST ['removedfile'], 0); + dol_remove_file_process($_POST['removedfile'], 0); $action = 'presend'; } /* * Send mail */ -if (($action == 'send' || $action == 'relance') && ! $_POST ['addfile'] && ! $_POST ['removedfile'] && ! $_POST ['cancel']) { +if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) { $langs->load('mails'); $actiontypecode = ''; @@ -1484,35 +1507,35 @@ if (($action == 'send' || $action == 'relance') && ! $_POST ['addfile'] && ! $_P // if (is_readable($file)) // { - if ($_POST ['sendto']) { + if ($_POST['sendto']) { // Le destinataire a ete fourni via le champ libre - $sendto = $_POST ['sendto']; + $sendto = $_POST['sendto']; $sendtoid = 0; - } elseif ($_POST ['receiver'] != '-1') { + } elseif ($_POST['receiver'] != '-1') { // Recipient was provided from combo list - if ($_POST ['receiver'] == 'thirdparty') // Id of third party + if ($_POST['receiver'] == 'thirdparty') // Id of third party { $sendto = $object->client->email; $sendtoid = 0; } else // Id du contact { - $sendto = $object->client->contact_get_property($_POST ['receiver'], 'email'); - $sendtoid = $_POST ['receiver']; + $sendto = $object->client->contact_get_property($_POST['receiver'], 'email'); + $sendtoid = $_POST['receiver']; } } if (dol_strlen($sendto)) { $langs->load("commercial"); - $from = $_POST ['fromname'] . ' <' . $_POST ['frommail'] . '>'; - $replyto = $_POST ['replytoname'] . ' <' . $_POST ['replytomail'] . '>'; - $message = $_POST ['message']; - $sendtocc = $_POST ['sendtocc']; - $deliveryreceipt = $_POST ['deliveryreceipt']; + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] . '>'; + $replyto = $_POST['replytoname'] . ' <' . $_POST['replytomail'] . '>'; + $message = $_POST['message']; + $sendtocc = $_POST['sendtocc']; + $deliveryreceipt = $_POST['deliveryreceipt']; if ($action == 'send') { - if (dol_strlen($_POST ['subject'])) - $subject = $_POST ['subject']; + if (dol_strlen($_POST['subject'])) + $subject = $_POST['subject']; else $subject = $langs->transnoentities('Bill') . ' ' . $object->ref; $actiontypecode = 'AC_FAC'; @@ -1525,8 +1548,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST ['addfile'] && ! $_P // $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } if ($action == 'relance') { - if (dol_strlen($_POST ['subject'])) - $subject = $_POST ['subject']; + if (dol_strlen($_POST['subject'])) + $subject = $_POST['subject']; else $subject = $langs->transnoentities('Relance facture ' . $object->ref); $actiontypecode = 'AC_FAC'; @@ -1686,7 +1709,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture- if ($result > 0 && $id > 0) { $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $object->add_contact($contactid, $_POST ["type"], $_POST ["source"]); + $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); } if ($result >= 0) { @@ -1946,7 +1969,7 @@ if ($action == 'create') foreach ($facids as $facparam) { $options .= '