From 399093f501f3c1226c66f2b7817b9c032554903a Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 1 Nov 2013 13:48:22 +0100 Subject: [PATCH 01/45] USe good status icon for thirdparty ActivityCeased --- htdocs/societe/class/societe.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 495f6ec6a5a..79a7e3d47b2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1513,22 +1513,22 @@ class Societe extends CommonObject } if ($mode == 2) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut6').' '.$langs->trans("ActivityCeased"); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut1').' '.$langs->trans("ActivityCeased"); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity"); } if ($mode == 3) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut6'); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut1'); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4'); } if ($mode == 4) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut6').' '.$langs->trans("ActivityCeased"); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut1').' '.$langs->trans("ActivityCeased"); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity"); } if ($mode == 5) { - if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut6'); + if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut1'); if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4'); } } From e8a80e236504d134249d6e691570d25f3561ed0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Nov 2013 17:46:57 +0100 Subject: [PATCH 02/45] Now comments in changelog are concatenated --- build/debian/changelog | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build/debian/changelog b/build/debian/changelog index f8cca0e8e41..cc9bd706d86 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,5 +1,19 @@ dolibarr (3.4.2) unstable; urgency=low + [ Laurent Destailleur (eldy) ] + * Maintenance release. + + -- Laurent Destailleur (eldy) Mon, 22 Apr 2013 12:00:00 +0100 + +dolibarr (3.4.1) unstable; urgency=low + + [ Laurent Destailleur (eldy) ] + * Maintenance release. + + -- Laurent Destailleur (eldy) Mon, 22 Apr 2013 12:00:00 +0100 + +dolibarr (3.4.0) unstable; urgency=low + [ Laurent Destailleur (eldy) ] * New upstream release. From 662f48ddc200b829369c521c0a1e376b86c54f6f Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 2 Nov 2013 02:21:45 +0100 Subject: [PATCH 03/45] Use good icons --- htdocs/societe/class/societe.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 79a7e3d47b2..80b65229f68 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1513,22 +1513,22 @@ class Societe extends CommonObject } if ($mode == 2) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut1').' '.$langs->trans("ActivityCeased"); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8').' '.$langs->trans("ActivityCeased"); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity"); } if ($mode == 3) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut1'); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8'); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4'); } if ($mode == 4) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut1').' '.$langs->trans("ActivityCeased"); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8').' '.$langs->trans("ActivityCeased"); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity"); } if ($mode == 5) { - if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut1'); + if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut8'); if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4'); } } From 6aea0bf7a1e4f686feca224a43bf7e1ffe5161b5 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 2 Nov 2013 12:49:37 +0100 Subject: [PATCH 04/45] Fix [ bug #1105 ] Searching Boxes other search option --- ChangeLog | 2 ++ htdocs/compta/facture/list.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 763e3369203..41982d6ecf5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.4.2 compared to 3.4.1 ***** Fix: Bad rounding on margin calculations and display. Fix: Option drpo table into backup was broken. +Fix: [ bug #1105 ] Searching Boxes other search option + ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index aa685e11ab3..998d4fab931 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -216,7 +216,7 @@ if (! $sall) } else { - $sql.= ' AND (s.nom LIKE \'%'.$db->escape($sall).'%\' OR f.facnumber LIKE \'%'.$db->escape($sall).'%\' OR f.note LIKE \'%'.$db->escape($sall).'%\' OR fd.description LIKE \'%'.$db->escape($sall).'%\')'; + $sql.= ' AND (s.nom LIKE \'%'.$db->escape($sall).'%\' OR f.facnumber LIKE \'%'.$db->escape($sall).'%\' OR f.note_private LIKE \'%'.$db->escape($sall).'%\' OR f.note_public LIKE \'%'.$db->escape($sall).'%\' OR fd.description LIKE \'%'.$db->escape($sall).'%\')'; } $sql.= ' ORDER BY '; $listfield=explode(',',$sortfield); From c5f29e14a452ac39aa30ca6135d94f149ad39bee Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Sat, 2 Nov 2013 17:50:24 +0100 Subject: [PATCH 05/45] missing trad and fix language --- htdocs/adherents/admin/adherent.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/cron/card.php | 8 ++++---- htdocs/cron/list.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/langs/fr_FR/admin.lang | 12 ++++++------ htdocs/langs/fr_FR/cron.lang | 10 +++++----- htdocs/langs/fr_FR/projects.lang | 8 ++++---- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index cfb7372308a..71f6cbb52ad 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -265,7 +265,7 @@ print '
'; /* - * Edition des variables globales non rattache a un theme specifique + * Editing global variables not related to a specific theme */ $constantes=array( 'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT', diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 87db0d27f25..dd80dbe9bb4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1664,7 +1664,7 @@ class Propal extends CommonObject { if ($statut == 2) { - // Classe la societe rattachee comme client + // The connected company is classified as a client $soc=new Societe($this->db); $soc->id = $this->socid; $result=$soc->set_as_client(); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index b0eca76345b..b5a9028e286 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -21,7 +21,7 @@ /** * \file htdocs/comm/propal/document.php * \ingroup propale - * \brief Page de gestion des documents attaches a une proposition commerciale + * \brief Management page of documents attached to a business proposal */ require '../../main.inc.php'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4e00900d995..2f2e3c98a16 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -266,7 +266,7 @@ class Commande extends CommonOrder if (preg_match('/^[\(]?PROV/i', $this->ref)) { // On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref) - // afin de ne pas perdre les fichiers attaches + // in order not to lose the attachments $comref = dol_sanitizeFileName($this->ref); $snum = dol_sanitizeFileName($num); $dirsource = $conf->commande->dir_output.'/'.$comref; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 1d599ee549d..c81c799ab1b 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -21,7 +21,7 @@ /** * \file htdocs/commande/document.php * \ingroup order - * \brief Page de gestion des documents attachees a une commande + * \brief Management page of documents attached to an order */ require '../main.inc.php'; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d7b17f3ac20..35b23dbc2a7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1793,7 +1793,7 @@ class Facture extends CommonInvoice if (preg_match('/^[\(]?PROV/i', $this->ref)) { // On renomme repertoire facture ($this->ref = ancienne ref, $num = nouvelle ref) - // afin de ne pas perdre les fichiers attaches + // in order not to lose the attachments $facref = dol_sanitizeFileName($this->ref); $snumfa = dol_sanitizeFileName($num); $dirsource = $conf->facture->dir_output.'/'.$facref; diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 7b7dc26767a..626b90047d8 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -108,7 +108,7 @@ if ($action=='add') { $object->unitfrequency=GETPOST('unitfrequency','int'); $object->frequency=$object->unitfrequency * GETPOST('nbfrequency','int'); - //Ajout de la tache cron + //Adding cron task $result = $object->create($user); // test du Resultat de la requete @@ -141,7 +141,7 @@ if ($action=='update') { $object->unitfrequency=GETPOST('unitfrequency','int'); $object->frequency=$object->unitfrequency * GETPOST('nbfrequency','int'); - //Ajout de la tache cron + //Adding cron task $result = $object->update($user); // test du Resultat de la requete @@ -158,7 +158,7 @@ if ($action=='update') { if ($action=='activate') { $object->status=1; - //Ajout de la tache cron + //Adding cron task $result = $object->update($user); // test du Resultat de la requete @@ -174,7 +174,7 @@ if ($action=='activate') { if ($action=='inactive') { $object->status=0; - //Ajout de la tache cron + //Adding cron task $result = $object->update($user); // test du Resultat de la requete diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index f75fcb5754b..6d8f20e1aeb 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -77,7 +77,7 @@ if (!empty($search_label)) { // Delete jobs if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->delete){ - //Delete de la tache cron + //Delete cron task $object = new Cronjob($db); $object->id=$id; $result = $object->delete($user); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 90b1b89d1a5..70a789d1f6a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -569,7 +569,7 @@ class Expedition extends CommonObject if (preg_match('/^[\(]?PROV/i', $this->ref)) { // On renomme repertoire ($this->ref = ancienne ref, $numfa = nouvelle ref) - // afin de ne pas perdre les fichiers attaches + // In order not to loose attached files $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($numref); $dirsource = $conf->expedition->dir_output.'/sending/'.$oldref; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 633115fa373..013ab28c78b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -354,7 +354,7 @@ class CommandeFournisseur extends CommonOrder if (preg_match('/^[\(]?PROV/i', $this->ref)) { // On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref) - // afin de ne pas perdre les fichiers attaches + // In order not to loose attached files $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($num); $dirsource = $conf->fournisseur->dir_output.'/commande/'.$oldref; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index dbaf9ac2cea..c5767bd90ef 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -870,7 +870,7 @@ class FactureFournisseur extends CommonInvoice if (preg_match('/^[\(]?PROV/i', $this->ref)) { // On renomme repertoire facture ($this->ref = ancienne ref, $num = nouvelle ref) - // afin de ne pas perdre les fichiers attaches + // In order not to loose attached files $facref = dol_sanitizeFileName($this->ref); $snumfa = dol_sanitizeFileName($num); diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index d1fdaeb113e..315c6151b4a 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -22,7 +22,7 @@ /** * \file htdocs/fourn/commande/document.php * \ingroup supplier - * \brief Page de gestion des documents attachees a une commande fournisseur + * \brief Management page of attached documents to a supplier order */ require '../../main.inc.php'; diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index dacaf21cdf2..cfc86c45660 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -470,7 +470,7 @@ Module1780Desc= Gestion des catégories (produits, fournisseurs, clients et adh Module2000Name= Editeur WYSIWYG Module2000Desc= Permet la saisie de certaines zones de textes grace à un éditeur avancé Module2300Name= Cron -Module2300Desc= Gestionnaire de taches programmées +Module2300Desc= Gestionnaire de tâches programmées Module2400Name= Agenda Module2400Desc= Gestion des actions (événements et tâches) et de l'agenda Module2500Name= Gestion Electronique de Documents @@ -695,10 +695,10 @@ Permission1411= Lire les mouvements comptables Permission1412= Créer/modifier/annuler les mouvements comptables Permission1415= Lire CA, bilans, résultats, journaux, grands livres Permission1421= Exporter les commandes clients et attributs -Permission23001 = Voir les taches planifiée -Permission23002 = Créer/Modifier les taches planifiée -Permission23003 = Supprimer les taches planifiée -Permission23004 = Executer les taches planifiée +Permission23001 = Voir les tâches planifiée +Permission23002 = Créer/Modifier les tâches planifiée +Permission23003 = Supprimer les tâches planifiée +Permission23004 = Exécuter les tâches planifiée Permission2401= Lire les actions (événements ou tâches) liées à son compte Permission2402= Créer/modifier les actions (événements ou tâches) liées à son compte Permission2403= Supprimer les actions (événements ou tâches) liées à son compte @@ -964,7 +964,7 @@ ExtraFieldsCustomerInvoices=Attributs supplémentaires (factures clients) ExtraFieldsSupplierOrders=Attributs supplémentaires (commandes) ExtraFieldsSupplierInvoices=Attributs supplémentaires (factures) ExtraFieldsProject=Attributs supplémentaires (projets) -ExtraFieldsProjectTask=Attributs supplémentaires (taches) +ExtraFieldsProjectTask=Attributs supplémentaires (tâches) ExtraFieldHasWrongValue=L'attribut %s a une valeur incorrecte. AlphaNumOnlyCharsAndNoSpace=uniquement caractères alphanumériques sans espace SendingMailSetup=Configuration de l'envoi par mail diff --git a/htdocs/langs/fr_FR/cron.lang b/htdocs/langs/fr_FR/cron.lang index b5fa47b336a..9fe99f43ccc 100644 --- a/htdocs/langs/fr_FR/cron.lang +++ b/htdocs/langs/fr_FR/cron.lang @@ -5,12 +5,12 @@ CHARSET=UTF-8 # Admin # CronSetup = Page de configuration du module - Gestion de tâches planifiées -URLToLaunchCronJobs=URL pour lancer les taches automatiques -OrToLaunchASpecificJob=Ou pour lancer une tache spécifique -KeyForCronAccess=Clé de sécurité pour l'URL de lancement des taches automatiques -FileToLaunchCronJobs=Commande pour lancer les taches automatiques +URLToLaunchCronJobs=URL pour lancer les tâches automatiques +OrToLaunchASpecificJob=Ou pour lancer une tâche spécifique +KeyForCronAccess=Clé de sécurité pour l'URL de lancement des tâches automatiques +FileToLaunchCronJobs=Commande pour lancer les tâches automatiques CronExplainHowToRunUnix=Sur un environement Unix vous pouvez paramétrer CronTab pour executer cette commande toute les minutes. -CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez utiliser le planificateur de tache pour lancer cette commande toute les minutes. +CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez utiliser le planificateur de tâches pour lancer cette commande toute les minutes. # # Menu diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index e26e92322e5..03751234361 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -86,14 +86,14 @@ ErrorTimeSpentIsEmpty=Le temps consommé n'est pas renseigné ThisWillAlsoRemoveTasks=Cette opération détruira également les tâches du projet (%s tâches actuellement) et le suivi des consommés. IfNeedToUseOhterObjectKeepEmpty=Si des objets (facture, commande, ...), appartenant à un autre tiers que celui choisi, doivent être liés au projet à créer, laisser vide afin de laisser le projet multi-tiers. CloneProject=Cloner le projet -CloneTasks=Cloner les taches +CloneTasks=Cloner les tâches CloneContacts=Cloner les contacts CloneNotes=Cloner les notes CloneFiles=Cloner les pièces jointes ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ? -ProjectReportDate=Reporter les dates des taches en fonction de la date de départ. -ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des taches. -ProjectsAndTasksLines=Projets et taches +ProjectReportDate=Reporter les dates des tâches en fonction de la date de départ. +ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des tâches. +ProjectsAndTasksLines=Projets et tâches ##### Types de contacts ##### TypeContact_project_internal_PROJECTLEADER=Chef de projet TypeContact_project_external_PROJECTLEADER=Chef de projet From aaf1dd1b27a6e2f2cb25a6c80bf80e33bd3b1a92 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Mon, 4 Nov 2013 10:41:02 +0100 Subject: [PATCH 06/45] fix some language error --- htdocs/langs/fr_FR/projects.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 03751234361..712ea544e8d 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -55,7 +55,7 @@ ListSupplierOrdersAssociatedProject=Liste des commandes fournisseurs associées ListSupplierInvoicesAssociatedProject=Liste des factures fournisseurs associées au projet ListContractAssociatedProject=Liste des contrats associés au projet ListFichinterAssociatedProject=Liste des interventions associées au projet -ListTripAssociatedProject=Liste des notes de frais associés au projet +ListTripAssociatedProject=Liste des notes de frais associées au projet ListActionsAssociatedProject=Liste des événements associés au projet ActivityOnProjectThisWeek=Activité sur les projets cette semaine ActivityOnProjectThisMonth=Activité sur les projets ce mois @@ -92,7 +92,7 @@ CloneNotes=Cloner les notes CloneFiles=Cloner les pièces jointes ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ? ProjectReportDate=Reporter les dates des tâches en fonction de la date de départ. -ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des tâches. +ErrorShiftTaskDate=Une erreur s'est produite dans le report des dates des tâches. ProjectsAndTasksLines=Projets et tâches ##### Types de contacts ##### TypeContact_project_internal_PROJECTLEADER=Chef de projet @@ -105,6 +105,6 @@ TypeContact_project_task_internal_CONTRIBUTOR=Intervenant TypeContact_project_task_external_CONTRIBUTOR=Intervenant # Documents models DocumentModelBaleine=Modèle de rapport de projet complet (logo...) -SelectElement=Eléments associable au projet : +SelectElement=Eléments associables au projet : AddElement=Associer ProjectReferers=Objets associés \ No newline at end of file From 8653f3f0263e82f9940a1c52366b99f8c83dc676 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Nov 2013 12:38:21 +0100 Subject: [PATCH 07/45] Add missing Country UK. --- htdocs/langs/en_US/dict.lang | 1 + htdocs/langs/fr_FR/dict.lang | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index d5b302ca9c7..f06c6c5e337 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -7,6 +7,7 @@ CountryES=Spain CountryDE=Germany CountryCH=Switzerland CountryGB=Great Britain +CountryUK=United Kingdom CountryIE=Ireland CountryCN=China CountryTN=Tunisia diff --git a/htdocs/langs/fr_FR/dict.lang b/htdocs/langs/fr_FR/dict.lang index e0a8fd6f2ef..bace202e0de 100644 --- a/htdocs/langs/fr_FR/dict.lang +++ b/htdocs/langs/fr_FR/dict.lang @@ -6,7 +6,8 @@ CountryIT=Italie CountryES=Espagne CountryDE=Allemagne CountryCH=Suisse -CountryGB=Royaume-Uni +CountryGB=Grande-Bretagne +CountryUK=Royaume-Uni CountryIE=Irlande CountryCN=Chine CountryTN=Tunisie From b82cbf1385c424cee705fd08f1a97e5b0fd73b7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Nov 2013 15:35:10 +0100 Subject: [PATCH 08/45] Fix: current balance was visible when it should not Conflicts: htdocs/compta/bank/account.php --- htdocs/compta/bank/account.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 372ec9b6f8b..86e26612e2e 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -486,7 +486,7 @@ if ($id > 0 || ! empty($ref)) $var=true; $num = $db->num_rows($result); - $i = 0; $total = 0; $sep = 0; + $i = 0; $total = 0; $sep = -1; while ($i < $num) { @@ -499,13 +499,14 @@ if ($id > 0 || ! empty($ref)) // Is it a transaction in future ? $dos=dol_print_date($db->jdate($objp->do),'%Y%m%d'); //print "dos=".$dos." nows=".$nows; - if ($dos > $nows && !$sep) // Yes, we show a subtotal + if ($dos < $nows) $sep=0; // 0 means there was at least one line before current date + if ($dos > $nows && ! $sep) // We have found a line in future and we already found on line before current date { $sep = 1 ; print ''; print $langs->trans("CurrentBalance"); print ''; - print ''.price($total - $objp->amount).''; + print ''.price($total - $objp->amount).''; print " "; print ''; } @@ -747,10 +748,10 @@ if ($id > 0 || ! empty($ref)) if ($page == 0 && ! $mode_search) { print ''; - if ($sep) print ' '; + if ($sep > 0) print ' '; // If we had at least one line in future else print $langs->trans("CurrentBalance"); print ''; - print ''.price($total).''; + print ''.price($total).''; print ' '; print ''; } From 91702593513f12814cc84ea2d7b771e13c8255ac Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 9 Nov 2013 06:51:10 +0100 Subject: [PATCH 09/45] fix for language --- htdocs/compta/bank/account.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 372ec9b6f8b..591a3dc22e3 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -581,7 +581,7 @@ if ($id > 0 || ! empty($ref)) $banklinestatic->fetch($links[$key]['url_id']); $bankstatic->id=$banklinestatic->fk_account; $bankstatic->label=$banklinestatic->bank_account_label; - print ' ('.$langs->trans("From "); + print ' ('.$langs->trans("TransferFrom").' '; print $bankstatic->getNomUrl(1,'transactions'); print ' '.$langs->trans("toward").' '; $bankstatic->id=$objp->bankid; @@ -593,7 +593,7 @@ if ($id > 0 || ! empty($ref)) { $bankstatic->id=$objp->bankid; $bankstatic->label=$objp->bankref; - print ' ('.$langs->trans("From "); + print ' ('.$langs->trans("TransferFrom").' '; print $bankstatic->getNomUrl(1,''); print ' '.$langs->trans("toward").' '; $banklinestatic->fetch($links[$key]['url_id']); From 4b26d8441b66b251d2aba0c8a959566d07102206 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Nov 2013 12:52:06 +0100 Subject: [PATCH 10/45] Fix: Entry lost --- htdocs/product/fiche.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index c58c15bed5e..f3817028e15 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -684,7 +684,7 @@ else $tmpcode=''; if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type); - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; if ($_error) { print $langs->trans("RefAlreadyExists"); @@ -692,7 +692,7 @@ else print ''; // Label - print ''.$langs->trans("Label").''; + print ''.$langs->trans("Label").''; // On sell print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'; From 6b6855dff502b76bb23f1d0a956eb244e239afff Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 10 Nov 2013 06:37:08 +0100 Subject: [PATCH 11/45] Fix for document cerfa into module Don --- htdocs/core/modules/dons/html_cerfafr.html | 2 +- htdocs/core/modules/dons/html_cerfafr.modules.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.html b/htdocs/core/modules/dons/html_cerfafr.html index 2f21e1c0afe..9310ac46cb6 100644 --- a/htdocs/core/modules/dons/html_cerfafr.html +++ b/htdocs/core/modules/dons/html_cerfafr.html @@ -98,7 +98,7 @@ __Name__ :
- __DONATOR_NAME__
+ __DONATOR_FIRSTNAME__ __DONATOR_LASTNAME__
__Address__ :
__DONATOR_ADDRESS__
__Zip__ : __DONATOR_ZIP__
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 05c3dd96f24..a3811f51d6d 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -143,7 +143,8 @@ class html_cerfafr extends ModeleDon $form = str_replace('__MAIN_INFO_SOCIETE_ADDRESS__',$mysoc->address,$form); $form = str_replace('__MAIN_INFO_SOCIETE_ZIP__',$mysoc->zip,$form); $form = str_replace('__MAIN_INFO_SOCIETE_TOWN__',$mysoc->town,$form); - $form = str_replace('__DONATOR_NAME__',$don->nom,$form); + $form = str_replace('__DONATOR_FIRSTNAME__',$don->firstname,$form); + $form = str_replace('__DONATOR_LASTNAME__',$don->lastname,$form); $form = str_replace('__DONATOR_ADDRESS__',$don->address,$form); $form = str_replace('__DONATOR_ZIP__',$don->zip,$form); $form = str_replace('__DONATOR_TOWN__',$don->town,$form); From 5b7f2e0c53acf9d0bf89d0b6150490ef139a5095 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 11 Nov 2013 17:35:36 +0100 Subject: [PATCH 12/45] Better nl_NL translation --- htdocs/langs/nl_NL/admin.lang | 4 +-- htdocs/langs/nl_NL/categories.lang | 2 +- htdocs/langs/nl_NL/commercial.lang | 4 +-- htdocs/langs/nl_NL/companies.lang | 8 +++--- htdocs/langs/nl_NL/dict.lang | 10 ++++---- htdocs/langs/nl_NL/main.lang | 2 +- htdocs/langs/nl_NL/margins.lang | 40 +++++++++++++++--------------- htdocs/langs/nl_NL/products.lang | 2 +- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/htdocs/langs/nl_NL/admin.lang b/htdocs/langs/nl_NL/admin.lang index f24eac0b403..67a826f0d82 100644 --- a/htdocs/langs/nl_NL/admin.lang +++ b/htdocs/langs/nl_NL/admin.lang @@ -341,7 +341,7 @@ Module70Name = Interventies Module70Desc = Interventiesbeheer Module75Name = Reisnotities en -kosten Module75Desc = Beheer van reisnotities en -kosten -Module80Name = Verzendingen +Module80Name = Verzend Adviezen Module80Desc = Beheer afnemersverzending en -ontvangst Module85Name = Bank en Contant Module85Desc = Beheer van bank- en / of kasrekeningen @@ -1251,7 +1251,7 @@ ContractsNumberingModules=Contracten nummering modules AdherentLoginRequired=Beheren van een login voor elk lid ListOfAvailableNotifications=Lijst van beschikbare meldingen (Deze lijst is afhankelijk van geactiveerde modules) SendingsNumberingModules=Verzendingen nummering modules -FreeLegalTextOnShippings=Vrije tekst op verzendingen +FreeLegalTextOnShippings=Vrije tekst op verzend advies AdvancedEditor=Geavanceerde editor AccountancyCode=Accountancy Code // STOP - Lines generated via autotranslator.php tool (2011-10-10 01:54:18). diff --git a/htdocs/langs/nl_NL/categories.lang b/htdocs/langs/nl_NL/categories.lang index e1d2b67b6ac..67607bb1f85 100644 --- a/htdocs/langs/nl_NL/categories.lang +++ b/htdocs/langs/nl_NL/categories.lang @@ -75,7 +75,7 @@ ProductsCategoryShort = Productencategorie MembersCategoryShort = Ledencategorie SuppliersCategoriesShort = Leverancierscategorie CustomersCategoriesShort = Afnemerscategorie -CustomersProspectsCategoriesShort = Afnemers- / Prospectencategorie +CustomersProspectsCategoriesShort = Afnemers-/Prosp.categorie ProductsCategoriesShort = Productencategorie MembersCategoriesShort = Ledencategorie ThisCategoryHasNoProduct = Deze categorie bevat geen producten. diff --git a/htdocs/langs/nl_NL/commercial.lang b/htdocs/langs/nl_NL/commercial.lang index 85935408c81..c8cdd786de9 100644 --- a/htdocs/langs/nl_NL/commercial.lang +++ b/htdocs/langs/nl_NL/commercial.lang @@ -24,8 +24,8 @@ TaskRDVWith = Vergadering met %s ShowTask = Toon taak ShowAction = Toon actie ActionsReport = Actiesverslag -SalesRepresentative = Vertegenwoordiger -SalesRepresentatives = Vertegenwoordigers +SalesRepresentative = Account Manager +SalesRepresentatives = Accountmanagers SalesRepresentativeFollowUp = Vertegenwoordiger (opvolging) SalesRepresentativeSignature = Vertegenwoordiger (handtekening) CommercialInterlocutor = Zakelijke gesprekspartner diff --git a/htdocs/langs/nl_NL/companies.lang b/htdocs/langs/nl_NL/companies.lang index 3b2ad012bae..3a0f5ce1e51 100644 --- a/htdocs/langs/nl_NL/companies.lang +++ b/htdocs/langs/nl_NL/companies.lang @@ -34,8 +34,8 @@ CompanyName = Bedrijfsnaam Companies = Bedrijven CountryIsInEEC = Lidstaat van de Europese Unie ThirdPartyName = Naam van Klant -ThirdParty = Klant -ThirdParties = Klant +ThirdParty = Klant / Leverancier +ThirdParties = Klanten / Leveranciers ThirdPartyAll = Klanten (alle) ThirdPartyProspects = Prospecten ThirdPartyCustomers = Afnemers @@ -290,7 +290,7 @@ CardSupplier = Leverancierskaart CardCompany = Bedrijfskaart DeleteFile = Bestand verwijderen ConfirmDeleteFile = Weet u zeker dat u dit bestand wilt verwijderen? -AllocateCommercial = Toewijzing +AllocateCommercial = Account Manager SelectCountry = Selecteer een land SelectCompany = Selecteer een Klant Organization = Organisatie @@ -303,7 +303,7 @@ ListProspectsShort = Prospectenoverzicht ListCustomersShort = Afnemersoverzicht ThirdPartiesArea = Overzicht van derde partijen LastModifiedThirdParties = Laatste %s bewerkte derde partijen -UniqueThirdParties = Totaal aantal unieke derde partijen +UniqueThirdParties = Totaal aantal unieke klanten/leveranciers # Monkey = MonkeyNumRefModelDesc = Geeft een nummer als %syymm-nnnn voor afnemerscodes en %sjjmm-nnnn voor leverancierscodes waar jj het jaar is, mm de maand en nnnn een opeenvolgend nummer vanaf 0. # Leopard = diff --git a/htdocs/langs/nl_NL/dict.lang b/htdocs/langs/nl_NL/dict.lang index 37aa3207418..5132baf0151 100644 --- a/htdocs/langs/nl_NL/dict.lang +++ b/htdocs/langs/nl_NL/dict.lang @@ -247,11 +247,11 @@ CountryME = Montenegro CountryBL = Saint Barthelemy CountryMF = Saint Martin ##### Civilities ##### = -CivilityMME = Mevrouw -CivilityMR = Meneer -CivilityMLE = Mejuffrouw -CivilityMTRE = Meester -CivilityDR = Dokter +CivilityMME =Mw. +CivilityMR = Dhr. +CivilityMLE = Mw. +CivilityMTRE = Dhr. +CivilityDR = Dhr. ##### Currencies ##### = Currencyeuros = Euro CurrencyAUD = Australische Dollars diff --git a/htdocs/langs/nl_NL/main.lang b/htdocs/langs/nl_NL/main.lang index 7e57bc38417..0c9d189b04f 100644 --- a/htdocs/langs/nl_NL/main.lang +++ b/htdocs/langs/nl_NL/main.lang @@ -522,7 +522,7 @@ NeverReceived = Nooit ontvangen Canceled = Geannuleerd YouCanChangeValuesForThisListFromDictionnarySetup = U kunt deze waarden veranderen via het menu Home->Instellingen->Constanten Color = Kleur -Documents = Gekoppelde bestanden +Documents = Gekoppelde Bestanden DocumentsNb = Bijlagen (%s) Documents2 = Documenten BuildDocuments = Gegenereerde documenten diff --git a/htdocs/langs/nl_NL/margins.lang b/htdocs/langs/nl_NL/margins.lang index 3494ca6d643..21bda68dc86 100644 --- a/htdocs/langs/nl_NL/margins.lang +++ b/htdocs/langs/nl_NL/margins.lang @@ -4,49 +4,49 @@ CHARSET=UTF-8 Margin=Marge Margins=Marges TotalMargin=Marge Totaal -MarginOnProducts=Marge / Training -MarginOnServices=Marge / Dienst -MarginRate=Marge verhouding -MarkRate=Markerings verhouding +MarginOnProducts=Marge Training/Boeken +MarginOnServices=Marge Dienst +MarginRate=Marge Verhouding +MarkRate=Markerings Verhouding DisplayMarginRates=Toon Marge Verhouding DisplayMarkRates=Toon Markeringsverhouding InputPrice=Voer Prijs in -margin=Winst marge management -margesSetup=Winst marge management setup +margin=Winst Marge Management +margesSetup=Winst Marge Management setup -MarginDetails=Marge details +MarginDetails=Marge Details -ProductMargins=Product marge -CustomerMargins=Klant marges +ProductMargins=Product Marge +CustomerMargins=Klant Marges AgentMargins=Acc. Manager marges -ProductService=Trainning of Dienst +ProductService=Training/Product of Dienst AllProducts=Alle Trainingen en Diensten -ChooseProduct/Service=Kies Training of Dienst -CommercialAgent=Commerciel Agent +ChooseProduct/Service=Kies Training/Product of Dienst +CommercialAgent=Commercieël Agent StartDate=Start datum EndDate=Eind datum Launch=Start ForceBuyingPriceIfNull=Forceer een inkoopprijs indien null -ForceBuyingPriceIfNullDetails=indien "ON", marge wodt nul (inkoopprijs = verkoopprijs), anders("OFF"), marge is gelijk verkoopprijs (inkoopprijs = 0) +ForceBuyingPriceIfNullDetails=indien "ON", marge wordt null (inkoopprijs = verkoopprijs), anders("OFF"), marge is gelijk verkoopprijs (inkoopprijs = 0) MARGIN_METHODE_FOR_DISCOUNT=Marge methode voor globale discounts -UseDiscountAsProduct=Als een training +UseDiscountAsProduct=Als een training/dienst UseDiscountAsService=Als een dienst UseDiscountOnTotal=Op subtotaal -MARGIN_METHODE_FOR_DISCOUNT_DETAILS=Definieert als een globale discount wordt behandelt als een training, een dienst, of alleen een subtotaal voor marge berekening. +MARGIN_METHODE_FOR_DISCOUNT_DETAILS=Definieer als een globale discount, wordt behandelt als een training/product, een dienst, alleen een subtotaal voor marge berekening. MARGIN_TYPE=Marge type -MargeBrute=Groffe marge -MargeNette=Netto marge -MARGIN_TYPE_DETAILS=Groffe marge : Verkoopprijs - Inkoopprijs
Netto marge : Verkoopprijs - Kostprijs +MargeBrute=Groffe Marge +MargeNette=Netto Marge +MARGIN_TYPE_DETAILS=Groffe marge : Verkoopprijs - Inkoopprijs
Netto Marge : Verkoopprijs - Kostprijs CostPrice=Kostprijs BuyingCost=Kostprijs -UnitCharges=Unit toeslag +UnitCharges=Unit Toeslag Charges=Toeslag AgentContactType=Contact type used voor commissie -AgentContactTypeDetails=Definieer het contact type (gelinked op facturen) wordt geassocieerd met commercieel agent \ No newline at end of file +AgentContactTypeDetails=Definieër het contact type (gelinked op facturen) wordt geassocieerd met een commercieël agent \ No newline at end of file diff --git a/htdocs/langs/nl_NL/products.lang b/htdocs/langs/nl_NL/products.lang index 731630aa79b..f5649c1e9bb 100644 --- a/htdocs/langs/nl_NL/products.lang +++ b/htdocs/langs/nl_NL/products.lang @@ -161,7 +161,7 @@ CloneContentProduct = Kloon alle hoofdinformatie van het product / de dienst ClonePricesProduct = Kloon hoofdinformatie en prijzen ProductIsUsed = Dit product wordt gebruikt NewRefForClone = Referentie naar nieuw produkt / dienst -CustomerPrices = Consumentenprijs +CustomerPrices = Verkoopprijs SuppliersPrices = Leveranciersprijs CustomCode = Code op maat CountryOrigin = Land van herkomst From 4ad541316398353d86a67c018c701569e051e050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 12 Nov 2013 15:34:12 +0100 Subject: [PATCH 13/45] Sync db upgrade with db install to avoid silly upgrade errors --- .../install/mysql/migration/3.3.0-3.4.0.sql | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql index 6bae41c0799..3af6c53cd79 100755 --- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql +++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql @@ -58,7 +58,7 @@ ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn; ALTER TABLE llx_facture_fourn DROP INDEX uk_facture_fourn_ref; UPDATE llx_facture_fourn set ref = NULL where ref = ''; ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref (ref, entity); -ALTER TABLE llx_facture_fourn CHANGE COLUMN facnumber ref_supplier varchar(30); +ALTER TABLE llx_facture_fourn CHANGE COLUMN facnumber ref_supplier varchar(50); ALTER TABLE llx_facture_fourn ADD UNIQUE INDEX uk_facture_fourn_ref_supplier (ref_supplier, fk_soc, entity); @@ -161,22 +161,22 @@ CREATE TABLE llx_c_revenuestamp insert into llx_c_revenuestamp(rowid,fk_pays,taux,note,active) values (101, 10, '0.4', 'Timbre fiscal', 1); -ALTER TABLE llx_c_tva MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_c_tva MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_commandedet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_commandedet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_contratdet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_contratdet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_facture_fourn_det MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_facture_fourn_det MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_facturedet_rec MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_facturedet_rec MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_facturedet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_facturedet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_propaldet MODIFY COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; -ALTER TABLE llx_propaldet MODIFY COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; +ALTER TABLE llx_c_tva MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_c_tva MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_commandedet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_commandedet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_contratdet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_contratdet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_facture_fourn_det MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_facture_fourn_det MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_facturedet_rec MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_facturedet_rec MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_facturedet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_facturedet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_propaldet MODIFY COLUMN localtax1_type varchar(10) DEFAULT NULL; +ALTER TABLE llx_propaldet MODIFY COLUMN localtax2_type varchar(10) DEFAULT NULL; -- No more use type 7, use revenuse stamp instead UPDATE llx_c_tva set localtax1=0, localtax1_type='0' where localtax1_type = '7'; UPDATE llx_c_tva set localtax2=0, localtax2_type='0' where localtax2_type = '7'; From 7dbe2bcf2c23b8c54588b912de5e52f5728dd598 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 13 Nov 2013 18:41:31 +0100 Subject: [PATCH 14/45] fix wrong buy price update --- htdocs/fourn/class/fournisseur.product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 884fcd8d4ad..80cd40942a0 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -222,7 +222,7 @@ class ProductFournisseur extends Product { // Add price for this quantity to supplier $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; - $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, entity, info_bits)"; + $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity)"; $sql.= " values('".$this->db->idate($now)."',"; $sql.= " ".$this->id.","; $sql.= " ".$fourn->id.","; From d23130739b4714b49738b03b31adb09c024d01d3 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 13 Nov 2013 18:43:31 +0100 Subject: [PATCH 15/45] update ChangeLog --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 41982d6ecf5..ab573ef4b12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,7 @@ English Dolibarr ChangeLog Fix: Bad rounding on margin calculations and display. Fix: Option drpo table into backup was broken. Fix: [ bug #1105 ] Searching Boxes other search option - +Fix: wrong buy price update ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined From e8c7bb9c6202abaec0c1d9e4b62550c705f48d5a Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 14 Nov 2013 21:02:33 +0100 Subject: [PATCH 16/45] Fix for language --- htdocs/compta/prelevement/bons.php | 2 +- htdocs/compta/prelevement/factures.php | 4 ++-- htdocs/compta/prelevement/fiche-rejet.php | 4 ++-- htdocs/compta/prelevement/fiche-stat.php | 4 ++-- htdocs/compta/prelevement/fiche.php | 4 ++-- htdocs/compta/prelevement/ligne.php | 2 +- htdocs/compta/prelevement/lignes.php | 4 ++-- htdocs/compta/prelevement/liste.php | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 8f2d336defe..eecc14711ea 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -79,7 +79,7 @@ if ($result) print ''; print ''; - print_liste_field_titre($langs->trans("WithdrawalReceipt"),"bons.php","p.ref",'','','class="liste_titre"'); + print_liste_field_titre($langs->trans("WithdrawalReceipts"),"bons.php","p.ref",'','','class="liste_titre"'); print_liste_field_titre($langs->trans("Date"),"bons.php","p.datec","","",'class="liste_titre" align="center"'); print ''; print ''; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 115a7829374..92a4464a635 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -47,7 +47,7 @@ $page = GETPOST('page','int'); $sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha'); $sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.ref" : GETPOST('sortfield','alpha'); -llxHeader('',$langs->trans("WithdrawalReceipt")); +llxHeader('',$langs->trans("WithdrawalReceipts")); if ($prev_id) { @@ -56,7 +56,7 @@ if ($prev_id) if ($bon->fetch($prev_id) == 0) { $head = prelevement_prepare_head($bon); - dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalReceipt"), '', 'payment'); + dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalReceipts"), '', 'payment'); print '
'.$langs->trans("Amount").'
'; diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 87516c3ad65..10d69c3434d 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -46,7 +46,7 @@ $page = GETPOST('page','int'); /* * View */ -llxHeader('',$langs->trans("WithdrawalReceipt")); +llxHeader('',$langs->trans("WithdrawalReceipts")); if ($prev_id) { @@ -55,7 +55,7 @@ if ($prev_id) if ($bon->fetch($prev_id) == 0) { $head = prelevement_prepare_head($bon); - dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalReceipt"), '', 'payment'); + dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalReceipts"), '', 'payment'); print '
'; diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 5fcd70b1a9b..f349fe23230 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -44,7 +44,7 @@ $page = GETPOST('page','int'); * View */ -llxHeader('',$langs->trans("WithdrawalReceipt")); +llxHeader('',$langs->trans("WithdrawalReceipts")); if ($prev_id) { @@ -53,7 +53,7 @@ if ($prev_id) if ($bon->fetch($prev_id) == 0) { $head = prelevement_prepare_head($bon); - dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalReceipt"), '', 'payment'); + dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalReceipts"), '', 'payment'); print '
'; diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php index 22af3b3548d..43e2e042456 100644 --- a/htdocs/compta/prelevement/fiche.php +++ b/htdocs/compta/prelevement/fiche.php @@ -133,7 +133,7 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) $bon = new BonPrelevement($db,""); $form = new Form($db); -llxHeader('',$langs->trans("WithdrawalReceipt")); +llxHeader('',$langs->trans("WithdrawalReceipts")); if ($id > 0) @@ -141,7 +141,7 @@ if ($id > 0) $bon->fetch($id); $head = prelevement_prepare_head($bon); - dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipt"), '', 'payment'); + dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalReceipts"), '', 'payment'); if (GETPOST('error','alpha')!='') { diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php index 4ba08c10445..9d0d0fc3718 100644 --- a/htdocs/compta/prelevement/ligne.php +++ b/htdocs/compta/prelevement/ligne.php @@ -130,7 +130,7 @@ if ($id) print '
'; - print ''; print ''; print ''; diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php index c322142b6a9..32f83b93906 100644 --- a/htdocs/compta/prelevement/lignes.php +++ b/htdocs/compta/prelevement/lignes.php @@ -54,7 +54,7 @@ $sortfield = ((GETPOST('sortfield','alpha')=="")) ? "pl.fk_soc" : GETPOST('sortf * View */ -llxHeader('',$langs->trans("WithdrawalReceipt")); +llxHeader('',$langs->trans("WithdrawalReceipts")); if ($prev_id) { @@ -63,7 +63,7 @@ if ($prev_id) if ($bon->fetch($prev_id) == 0) { $head = prelevement_prepare_head($bon); - dol_fiche_head($head, 'lines', $langs->trans("WithdrawalReceipt"), '', 'payment'); + dol_fiche_head($head, 'lines', $langs->trans("WithdrawalReceipts"), '', 'payment'); print '
'.$langs->trans("WithdrawalReceipt").''; + print '
'.$langs->trans("WithdrawalReceipts").''; print ''.$lipre->bon_ref.'
'.$langs->trans("Date").''.dol_print_date($bon->datec,'day').'
'.$langs->trans("Amount").''.price($lipre->amount).'
'; diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php index cd09dc6cf25..33e2bfb71e1 100644 --- a/htdocs/compta/prelevement/liste.php +++ b/htdocs/compta/prelevement/liste.php @@ -111,7 +111,7 @@ if ($result) print ''; print ''; - print_liste_field_titre($langs->trans("WithdrawalReceipt"),$_SERVER["PHP_SELF"],"p.ref"); + print_liste_field_titre($langs->trans("WithdrawalReceipts"),$_SERVER["PHP_SELF"],"p.ref"); print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom"); print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"'); From 8050f8e9fe3619430511a65c07400260aaa04bd0 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 14 Nov 2013 21:40:30 +0100 Subject: [PATCH 17/45] Fix problem field --- htdocs/societe/rib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 451209913aa..ab2b8f6dadd 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -66,7 +66,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $account->iban_prefix = $_POST["iban_prefix"]; $account->domiciliation = $_POST["domiciliation"]; $account->proprio = $_POST["proprio"]; - $account->adresse_proprio = $_POST["adresse_proprio"]; + $account->owner_address = $_POST["owner_address"]; $result = $account->update($user); if (! $result) @@ -154,7 +154,7 @@ if ($_GET["socid"] && $_GET["action"] != 'edit') print "\n"; print '\n"; print '
'.$langs->trans("Line").'
'.$langs->trans("BankAccountOwnerAddress").''; - print $account->adresse_proprio; + print $account->owner_address; print "
'; @@ -236,8 +236,8 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer print "\n"; print ''.$langs->trans("BankAccountOwnerAddress").''; - print ""; print '
'; From 200553c001264dc51e9fc214c7ce4f65ca65fa06 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 15 Nov 2013 04:58:59 +0100 Subject: [PATCH 18/45] Update ChangeLog --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 41982d6ecf5..41a34943ffc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,8 +2,10 @@ English Dolibarr ChangeLog -------------------------------------------------------------- ***** ChangeLog for 3.4.2 compared to 3.4.1 ***** +Fix: field's problem into company's page (RIB) +Fix: Document cerfa doesn't contained firstname & lastname from donator Fix: Bad rounding on margin calculations and display. -Fix: Option drpo table into backup was broken. +Fix: Option drop table into backup was broken. Fix: [ bug #1105 ] Searching Boxes other search option From 45aac81b71a521c26fc1fb6e97334a49ed6badca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2013 18:12:13 +0100 Subject: [PATCH 19/45] Doc: More comments --- htdocs/core/js/lib_head.js | 29 +++++++++++++++++++---------- htdocs/core/tpl/ajaxrow.tpl.php | 6 +++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index ae6182177d7..cfb2977c370 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -1,4 +1,4 @@ -// Copyright (C) 2005-2010 Laurent Destailleur +// Copyright (C) 2005-2013 Laurent Destailleur // Copyright (C) 2005-2012 Regis Houssin // // This program is free software; you can redistribute it and/or modify @@ -290,8 +290,10 @@ function loadXMLDoc(url,readyStateFunction,async) return req; } -// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and -// not put popup completely on the front) +/* To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and + * not put popup completely on the front) + * Used only bu popup calendar + */ function hideSelectBoxes() { var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) @@ -304,6 +306,10 @@ function hideSelectBoxes() { } } } +/* To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and + * not put popup completely on the front) + * Used only bu popup calendar + */ function displaySelectBoxes() { var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) @@ -354,9 +360,7 @@ function formatDate(date,format) c=format.charAt(i); // Recupere char du format substr=""; j=i; - while ((format.charAt(j)==c) && (j < format.length)) // Recupere char - // successif - // identiques + while ((format.charAt(j)==c) && (j < format.length)) // Recupere char successif identiques { substr += format.charAt(j++); } @@ -623,8 +627,9 @@ function hideMessage(fieldId,message) { if (textbox.value == message) textbox.value = ''; } + /* - * + * TODO Used by admin page only ? */ function setConstant(url, code, input, entity) { $.get( url, { @@ -679,7 +684,7 @@ function setConstant(url, code, input, entity) { } /* - * + * TODO Used by admin page only ? */ function delConstant(url, code, input, entity) { $.get( url, { @@ -733,7 +738,7 @@ function delConstant(url, code, input, entity) { } /* - * + * TODO Used by admin page only ? */ function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) { var boxConfirm = box; @@ -784,7 +789,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, /* * ================================================================= * This is to allow to transform all select box into ajax autocomplete box - * with just one line: $(function() { $( "#idofmylist" ).combobox(); }); + * with just one line: + * $(function() { $( "#idofmylist" ).combobox(); }); + * Do not use it on large combo boxes * ================================================================= */ (function( $ ) { @@ -894,6 +901,8 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, /* * Timer for delayed keyup function + * + * TODO Who use this ? */ (function($){ $.widget("ui.onDelayedKeyup", { diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index aa96b46a859..27b14d859f3 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -17,11 +17,11 @@ * * Javascript code to activate drag and drop on lines * You can use this if you want to be abale to drag and drop rows of a table. - * You must add id="tablelines" ont table level tag and have count($object->lines) or count($taskarray) > 0 + * You must add id="tablelines" ont table level tag and have count($object->lines) or count($taskarray) > 0 */ ?> - + id; $fk_element=$object->fk_element; @@ -84,4 +84,4 @@ $(document).ready(function(){ }); - \ No newline at end of file + \ No newline at end of file From 89a56389086e599f976ae81670d1040f45f84597 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sun, 17 Nov 2013 12:59:33 +0100 Subject: [PATCH 20/45] Fix bad translation on margin config --- htdocs/langs/en_US/margins.lang | 4 ++-- htdocs/langs/fr_FR/margins.lang | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index e8c5ab38b6b..bf65bf5d270 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -48,5 +48,5 @@ BuyingCost=Cost price UnitCharges=Unit charges Charges=Charges -AgentContactType=Contact type used for commissioning -AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents \ No newline at end of file +AgentContactType=Commercial agent contact type +AgentContactTypeDetails=Défine what contact type (linked on invoices) will be used for margin report by commercial agents \ No newline at end of file diff --git a/htdocs/langs/fr_FR/margins.lang b/htdocs/langs/fr_FR/margins.lang index dcfe51d6786..78e5e1c380e 100644 --- a/htdocs/langs/fr_FR/margins.lang +++ b/htdocs/langs/fr_FR/margins.lang @@ -48,5 +48,5 @@ CostPrice=Prix de revient UnitCharges=Charge unitaire Charges=Charges -AgentContactType=Type de contact commissionné -AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux +AgentContactType=Type de contact agent commercial +AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera utilisé pour le rapport de marges par agent commercial From 48570f599a977de94980d031ac9f4687de89f9ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2013 23:25:25 +0100 Subject: [PATCH 21/45] Fix: form is not allowed into a table. This break some javascript and make some browsers crazy. --- htdocs/comm/propal.php | 82 +- htdocs/commande/fiche.php | 95 +- htdocs/compta/facture.php | 2756 +++++++++-------- htdocs/contrat/class/contrat.class.php | 3 + htdocs/contrat/fiche.php | 131 +- htdocs/core/lib/ajax.lib.php | 2 +- .../core/tpl/freeproductline_create.tpl.php | 68 +- htdocs/core/tpl/objectline_edit.tpl.php | 219 +- .../tpl/predefinedproductline_create.tpl.php | 104 +- htdocs/fourn/commande/fiche.php | 371 ++- htdocs/fourn/facture/fiche.php | 174 +- 11 files changed, 2086 insertions(+), 1919 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 8c2871426a4..685841560bd 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -634,13 +634,27 @@ else if ($action == "setabsolutediscount" && $user->rights->propal->creer) } // Add line -else if ($action == "addline" && $user->rights->propal->creer) +else if (($action == 'addline' || $action == 'addline_predef') && $user->rights->propal->creer) { - $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'); - $tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); - $predef=((! empty($idprod) && $conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : ''); + // Set if we used free entry or predefined product + 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')) + { + $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 = ''; + } + $qty = GETPOST('qty'.$predef); + $remise_percent=GETPOST('remise_percent'.$predef); //Extrafields $extrafieldsline = new ExtraFields($db); @@ -673,7 +687,7 @@ else if ($action == "addline" && $user->rights->propal->creer) $error++; } - if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) + if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { $pu_ht=0; $pu_ttc=0; @@ -791,8 +805,8 @@ else if ($action == "addline" && $user->rights->propal->creer) } // Margin - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + $fournprice=(GETPOST('fournprice'.$predef)?GETPOST('fournprice'.$predef):''); + $buyingprice=(GETPOST('buying_price'.$predef)?GETPOST('buying_price'.$predef):''); $date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); @@ -804,7 +818,7 @@ else if ($action == "addline" && $user->rights->propal->creer) $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + if (! empty($price_min) && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); setEventMessage($mesg, 'errors'); @@ -815,12 +829,12 @@ else if ($action == "addline" && $user->rights->propal->creer) $result=$object->addline( $desc, $pu_ht, - GETPOST('qty'), + $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, - GETPOST('remise_percent'), + $remise_percent, $price_base_type, $pu_ttc, $info_bits, @@ -854,7 +868,6 @@ else if ($action == "addline" && $user->rights->propal->creer) unset($_POST['qty']); unset($_POST['type']); - unset($_POST['idprod']); unset($_POST['remise_percent']); unset($_POST['price_ht']); unset($_POST['price_ttc']); @@ -866,10 +879,16 @@ else if ($action == "addline" && $user->rights->propal->creer) unset($_POST['buying_price']); unset($_POST['np_marginRate']); unset($_POST['np_markRate']); - - // old method - unset($_POST['np_desc']); 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']); } else { @@ -1162,7 +1181,7 @@ else if ($action == 'update_extras') $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute')); if($ret < 0) $error++; - if (! $error) + if (! $error) { // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! @@ -1179,7 +1198,7 @@ else if ($action == 'update_extras') } else if ($reshook < 0) $error++; } - + if ($error) $action = 'edit_extras'; } @@ -1924,11 +1943,11 @@ else print ''; print ''; print ''; - + print $extrafields->showInputField($key,$value); - + print ''; - + print ''; } else @@ -2003,15 +2022,25 @@ else * Lines */ + // Show object lines + $result = $object->getLinesArray(); + + + print '
+ + + + + '; + + if (! empty($conf->use_javascript_ajax) && $object->statut == 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } - print ''; + print '
'; - // Show object lines - $result = $object->getLinesArray(); if (! empty($object->lines)) $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1); @@ -2047,8 +2076,9 @@ else print '
'; - print ''; - print "\n"; + print "
\n"; + + dol_fiche_end(); if ($action == 'statut') { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 697d47c78bf..ccc2f13cbea 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -323,7 +323,7 @@ else if ($action == 'add' && $user->rights->commande->creer) $lines[$i]->fetch_optionals($lines[$i]->rowid); $array_option=$lines[$i]->array_options; } - + $result = $object->addline( $desc, $lines[$i]->subprice, @@ -564,18 +564,31 @@ else if ($action == 'setnote_private' && $user->rights->commande->creer) if ($result < 0) dol_print_error($db,$object->error); } -/* - * Ajout d'une ligne produit dans la commande -*/ +// Add a new line else if ($action == 'addline' && $user->rights->commande->creer) { $langs->load('errors'); $error = false; - $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'); - $tva_tx = (GETPOST('tva_tx')?GETPOST('tva_tx'):0); + // Set if we used free entry or predefined product + 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')) + { + $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 = ''; + } + $qty = GETPOST('qty'.$predef); + $remise_percent=GETPOST('remise_percent'.$predef); //Extrafields $extrafieldsline = new ExtraFields($db); @@ -591,7 +604,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) } } - if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && (GETPOST('qty') < 0)) + if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0)) { setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); $error = true; @@ -606,7 +619,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); $error++; } - if (! GETPOST('qty') && GETPOST('qty') == '') + if ($qty == '') { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); $error = true; @@ -617,10 +630,9 @@ else if ($action == 'addline' && $user->rights->commande->creer) $error = true; } - if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) + if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { // Clean parameters - $predef=((! empty($idprod) && $conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : ''); $date_start=dol_mktime(0, 0, 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end=dol_mktime(0, 0, 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); @@ -737,8 +749,8 @@ else if ($action == 'addline' && $user->rights->commande->creer) } // Margin - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + $fournprice=(GETPOST('fournprice'.$predef)?GETPOST('fournprice'.$predef):''); + $buyingprice=(GETPOST('buying_price'.$predef)?GETPOST('buying_price'.$predef):''); // Local Taxes $localtax1_tx= get_localtax($tva_tx, 1, $object->client); @@ -749,7 +761,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + if (! empty($price_min) && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); setEventMessage($mesg, 'errors'); @@ -760,12 +772,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) $result = $object->addline( $desc, $pu_ht, - GETPOST('qty'), + $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, - GETPOST('remise_percent'), + $remise_percent, $info_bits, 0, $price_base_type, @@ -803,7 +815,6 @@ else if ($action == 'addline' && $user->rights->commande->creer) unset($_POST['qty']); unset($_POST['type']); - unset($_POST['idprod']); unset($_POST['remise_percent']); unset($_POST['price_ht']); unset($_POST['price_ttc']); @@ -815,10 +826,16 @@ else if ($action == 'addline' && $user->rights->commande->creer) unset($_POST['buying_price']); unset($_POST['np_marginRate']); unset($_POST['np_markRate']); - - // old method - unset($_POST['np_desc']); 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']); } else { @@ -1182,7 +1199,7 @@ else if ($action == 'update_extras') $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute')); if($ret < 0) $error++; - if (! $error) + if (! $error) { // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! @@ -1199,7 +1216,7 @@ else if ($action == 'update_extras') } else if ($reshook < 0) $error++; } - + if ($error) $action = 'edit_extras'; } @@ -1449,7 +1466,7 @@ if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->righ /* * View -*/ + */ llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); @@ -1460,9 +1477,9 @@ $formorder = new FormOrder($db); /********************************************************************* * -* Mode creation -* -*********************************************************************/ + * Mode creation + * + *********************************************************************/ if ($action == 'create' && $user->rights->commande->creer) { print_fiche_titre($langs->trans('CreateOrder')); @@ -1506,7 +1523,7 @@ if ($action == 'create' && $user->rights->commande->creer) $objectsrc->fetch($originid); if (empty($objectsrc->lines) && method_exists($objectsrc,'fetch_lines')) $objectsrc->fetch_lines(); $objectsrc->fetch_thirdparty(); - + //Replicate extrafields $objectsrc->fetch_optionals($originid); $object->array_options=$objectsrc->array_options; @@ -2311,25 +2328,34 @@ else /* * Lines - */ + */ $result = $object->getLinesArray(); - $numlines = count($object->lines); + + print '
+ + + + + '; + if (! empty($conf->use_javascript_ajax) && $object->statut == 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } - print ''; + print '
'; // Show object lines if (! empty($object->lines)) $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1); + $numlines = count($object->lines); + /* * Form to add new line - */ + */ if ($object->statut == 0 && $user->rights->commande->creer) { if ($action != 'editline') @@ -2359,7 +2385,10 @@ else } } print '
'; - print ''; + + print "
\n"; + + dol_fiche_end(); /* diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7e1eb0d7445..dc573de6eca 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1128,10 +1128,25 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $langs->load('errors'); $error = 0; - $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'); - $tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + // Set if we used free entry or predefined product + 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')) + { + $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 = ''; + } + $qty = GETPOST('qty'.$predef); + $remise_percent=GETPOST('remise_percent'.$predef); //Extrafields $extrafieldsline = new ExtraFields($db); @@ -1146,7 +1161,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } } - if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && (GETPOST('qty') < 0)) + if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0)) { setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); $error++; @@ -1161,7 +1176,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors'); $error++; } - if (! GETPOST('qty') && GETPOST('qty') == '') + if ($qty == '') { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); $error++; @@ -1172,7 +1187,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $error++; } - if (! $error && (GETPOST('qty') >= 0) && (! empty($product_desc) || ! empty($idprod))) + if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { $ret=$object->fetch($id); if ($ret < 0) @@ -1183,7 +1198,6 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $ret=$object->fetch_thirdparty(); // Clean parameters - $predef=((! empty($idprod) && $conf->global->MAIN_FEATURES_LEVEL < 2) ? '_predef' : ''); $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); @@ -1304,8 +1318,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } // Margin - $fournprice=(GETPOST('fournprice')?GETPOST('fournprice'):''); - $buyingprice=(GETPOST('buying_price')?GETPOST('buying_price'):''); + $fournprice=(GETPOST('fournprice'.$predef)?GETPOST('fournprice'.$predef):''); + $buyingprice=(GETPOST('buying_price'.$predef)?GETPOST('buying_price'.$predef):''); // Local Taxes $localtax1_tx= get_localtax($tva_tx, 1, $object->client); @@ -1314,7 +1328,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + if (! empty($price_min) && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))) { $mesg = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); setEventMessage($mesg, 'errors'); @@ -1325,12 +1339,12 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $result = $object->addline( $desc, $pu_ht, - GETPOST('qty'), + $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, - GETPOST('remise_percent'), + $remise_percent, $date_start, $date_end, 0, @@ -1370,7 +1384,6 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- unset($_POST['qty']); unset($_POST['type']); - unset($_POST['idprod']); unset($_POST['remise_percent']); unset($_POST['price_ht']); unset($_POST['price_ttc']); @@ -1382,10 +1395,16 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- unset($_POST['buying_price']); unset($_POST['np_marginRate']); unset($_POST['np_markRate']); - - // old method - unset($_POST['np_desc']); 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']); } else { @@ -1397,7 +1416,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- } } -else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['save'] == $langs->trans('Save')) +elseif ($action == 'updateligne' && $user->rights->facture->creer && $_POST['save'] == $langs->trans('Save')) { if (! $object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -2388,9 +2407,9 @@ if ($action == 'create') print ''; $newclassname=$classname; - if ($newclassname == 'Propal') $newclassname = 'CommercialProposal'; - elseif ($newclassname == 'Commande') $newclassname = 'Order'; - elseif ($newclassname == 'Expedition') $newclassname = 'Sending'; + if ($newclassname == 'Propal') $newclassname = 'CommercialProposal'; + elseif ($newclassname == 'Commande') $newclassname = 'Order'; + elseif ($newclassname == 'Expedition') $newclassname = 'Sending'; print ''.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).''; print ''.$langs->trans('TotalHT').''.price($objectsrc->total_ht).''; @@ -2491,1463 +2510,1468 @@ else if ($id > 0 || ! empty($ref)) { /* * Show object in view mode - */ + */ $result=$object->fetch($id,$ref); + if ($result <= 0) { dol_print_error($db, $object->error); exit; } // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - if ($result > 0) + if ($user->societe_id>0 && $user->societe_id!=$object->socid) accessforbidden('',0); + + $result=$object->fetch_thirdparty(); + + $soc = new Societe($db); + $soc->fetch($object->socid); + $selleruserevenustamp=$mysoc->useRevenueStamp(); + + $totalpaye = $object->getSommePaiement(); + $totalcreditnotes = $object->getSumCreditNotesUsed(); + $totaldeposits = $object->getSumDepositsUsed(); + //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits." selleruserrevenuestamp=".$selleruserevenustamp; + + // We can also use bcadd to avoid pb with floating points + // For example print 239.2 - 229.3 - 9.9; does not return 0. + //$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT); + //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); + $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT'); + + if ($object->paye) $resteapayer=0; + $resteapayeraffiche=$resteapayer; + + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - if ($user->societe_id>0 && $user->societe_id!=$object->socid) accessforbidden('',0); + $filterabsolutediscount="fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $filtercreditnote="fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + } + else + { + $filterabsolutediscount="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; + $filtercreditnote="fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + } - $result=$object->fetch_thirdparty(); + $absolute_discount=$soc->getAvailableDiscounts('',$filterabsolutediscount); + $absolute_creditnote=$soc->getAvailableDiscounts('',$filtercreditnote); + $absolute_discount=price2num($absolute_discount,'MT'); + $absolute_creditnote=price2num($absolute_creditnote,'MT'); - $soc = new Societe($db); - $soc->fetch($object->socid); - $selleruserevenustamp=$mysoc->useRevenueStamp(); + $author = new User($db); + if ($object->user_author) + { + $author->fetch($object->user_author); + } - $totalpaye = $object->getSommePaiement(); - $totalcreditnotes = $object->getSumCreditNotesUsed(); - $totaldeposits = $object->getSumDepositsUsed(); - //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits." selleruserrevenuestamp=".$selleruserevenustamp; + $objectidnext=$object->getIdReplacingInvoice(); - // We can also use bcadd to avoid pb with floating points - // For example print 239.2 - 229.3 - 9.9; does not return 0. - //$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT); - //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); - $resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT'); + $head = facture_prepare_head($object); - if ($object->paye) $resteapayer=0; - $resteapayeraffiche=$resteapayer; + dol_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'), 0, 'bill'); - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) + $formconfirm=''; + + // Confirmation de la conversion de l'avoir en reduc + if ($action == 'converttoreduc') + { + $text=$langs->trans('ConfirmConvertToReduc'); + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc','',"yes",2); + } + + // Confirmation to delete invoice + if ($action == 'delete') + { + $text=$langs->trans('ConfirmDeleteBill',$object->ref); + $formquestion=array(); + + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $filterabsolutediscount="fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - $filtercreditnote="fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $qualified_for_stock_change=$object->hasProductsOrServices(2); } else { - $filterabsolutediscount="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; - $filtercreditnote="fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + $qualified_for_stock_change=$object->hasProductsOrServices(1); } - $absolute_discount=$soc->getAvailableDiscounts('',$filterabsolutediscount); - $absolute_creditnote=$soc->getAvailableDiscounts('',$filtercreditnote); - $absolute_discount=price2num($absolute_discount,'MT'); - $absolute_creditnote=price2num($absolute_creditnote,'MT'); - - $author = new User($db); - if ($object->user_author) + if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut>=1) { - $author->fetch($object->user_author); + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct=new FormProduct($db); + $label=$object->type==2?$langs->trans("SelectWarehouseForStockDecrease"):$langs->trans("SelectWarehouseForStockIncrease"); + $formquestion=array( + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1,0,0,$langs->trans("NoStockAction")))); + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete',$formquestion,"yes",1); + }else { + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete','','',1); } + } - $objectidnext=$object->getIdReplacingInvoice(); - - $head = facture_prepare_head($object); - - dol_fiche_head($head, 'compta', $langs->trans('InvoiceCustomer'), 0, 'bill'); - - $formconfirm=''; - - // Confirmation de la conversion de l'avoir en reduc - if ($action == 'converttoreduc') + // Confirmation de la validation + if ($action == 'valid') + { + // on verifie si l'objet est en numerotation provisoire + $objectref = substr($object->ref, 1, 4); + if ($objectref == 'PROV') { - $text=$langs->trans('ConfirmConvertToReduc'); - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc','',"yes",2); - } - - // Confirmation to delete invoice - if ($action == 'delete') - { - $text=$langs->trans('ConfirmDeleteBill',$object->ref); - $formquestion=array(); - - $qualified_for_stock_change=0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + $savdate=$object->date; + if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) { - $qualified_for_stock_change=$object->hasProductsOrServices(2); - } - else - { - $qualified_for_stock_change=$object->hasProductsOrServices(1); + $object->date=dol_now(); + $object->date_lim_reglement=$object->calculate_date_lim_reglement(); } + $numref = $object->getNextNumRef($soc); + //$object->date=$savdate; + } + else + { + $numref = $object->ref; + } - if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut>=1) - { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct=new FormProduct($db); + $text=$langs->trans('ConfirmValidateBill',$numref); + if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; + $notify=new Notify($db); + $text.='
'; + $text.=$notify->confirmMessage('BILL_VALIDATE',$object->socid); + } + $formquestion=array(); + + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + + if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + { + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + $formproduct=new FormProduct($db); + $warehouse = new Entrepot($db); + $warehouse_array = $warehouse->list_array(); + if (count($warehouse_array) == 1) { + $label = $object->type==2?$langs->trans("WarehouseForStockIncrease", current($warehouse_array)):$langs->trans("WarehouseForStockDecrease", current($warehouse_array)); + $value = ''; + } else { + $label = $object->type==2?$langs->trans("SelectWarehouseForStockIncrease"):$langs->trans("SelectWarehouseForStockDecrease"); + $value = $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1); + } + $formquestion=array( + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)); + } + if ($object->type != 2 && $object->total_ttc < 0) // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on + { + $text.='
'.img_warning().' '.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive"); + } + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ValidateBill'),$text,'confirm_valid',$formquestion,(($object->type != 2 && $object->total_ttc < 0)?"no":"yes"),($conf->notification->enabled?0:2)); + } + + // Confirm back to draft status + if ($action == 'modif') + { + $text=$langs->trans('ConfirmUnvalidateBill',$object->ref); + $formquestion=array(); + + $qualified_for_stock_change=0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $qualified_for_stock_change=$object->hasProductsOrServices(2); + } + else + { + $qualified_for_stock_change=$object->hasProductsOrServices(1); + } + if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + { + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + $formproduct=new FormProduct($db); + $warehouse = new Entrepot($db); + $warehouse_array = $warehouse->list_array(); + if (count($warehouse_array) == 1) { + $label = $object->type==2?$langs->trans("WarehouseForStockDecrease", current($warehouse_array)):$langs->trans("WarehouseForStockIncrease", current($warehouse_array)); + $value = ''; + } else { $label=$object->type==2?$langs->trans("SelectWarehouseForStockDecrease"):$langs->trans("SelectWarehouseForStockIncrease"); - $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1,0,0,$langs->trans("NoStockAction")))); - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete',$formquestion,"yes",1); - }else { - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('DeleteBill'),$text,'confirm_delete','','',1); + $value = $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1); } + $formquestion=array( + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)); } - // Confirmation de la validation - if ($action == 'valid') + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('UnvalidateBill'),$text,'confirm_modif',$formquestion,"yes",1); + } + + // Confirmation du classement paye + if ($action == 'paid' && $resteapayer <= 0) + { + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ClassifyPaid'),$langs->trans('ConfirmClassifyPaidBill',$object->ref),'confirm_paid','',"yes",1); + } + if ($action == 'paid' && $resteapayer > 0) + { + // Code + $i=0; + $close[$i]['code']='discount_vat';$i++; + $close[$i]['code']='badcustomer';$i++; + // Help + $i=0; + $close[$i]['label']=$langs->trans("HelpEscompte").'

'.$langs->trans("ConfirmClassifyPaidPartiallyReasonDiscountVatDesc");$i++; + $close[$i]['label']=$langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");$i++; + // Texte + $i=0; + $close[$i]['reason']=$form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscountVat",$resteapayer,$langs->trans("Currency".$conf->currency)),$close[$i]['label'],1);$i++; + $close[$i]['reason']=$form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer",$resteapayer,$langs->trans("Currency".$conf->currency)),$close[$i]['label'],1);$i++; + // arrayreasons[code]=reason + foreach($close as $key => $val) { - // on verifie si l'objet est en numerotation provisoire - $objectref = substr($object->ref, 1, 4); - if ($objectref == 'PROV') - { - $savdate=$object->date; - if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) - { - $object->date=dol_now(); - $object->date_lim_reglement=$object->calculate_date_lim_reglement(); - } - $numref = $object->getNextNumRef($soc); - //$object->date=$savdate; - } - else - { - $numref = $object->ref; - } - - $text=$langs->trans('ConfirmValidateBill',$numref); - if (! empty($conf->notification->enabled)) - { - require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php'; - $notify=new Notify($db); - $text.='
'; - $text.=$notify->confirmMessage('BILL_VALIDATE',$object->socid); - } - $formquestion=array(); - - $qualified_for_stock_change=0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - $qualified_for_stock_change=$object->hasProductsOrServices(2); - } - else - { - $qualified_for_stock_change=$object->hasProductsOrServices(1); - } - - if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) - { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; - $formproduct=new FormProduct($db); - $warehouse = new Entrepot($db); - $warehouse_array = $warehouse->list_array(); - if (count($warehouse_array) == 1) { - $label = $object->type==2?$langs->trans("WarehouseForStockIncrease", current($warehouse_array)):$langs->trans("WarehouseForStockDecrease", current($warehouse_array)); - $value = ''; - } else { - $label = $object->type==2?$langs->trans("SelectWarehouseForStockIncrease"):$langs->trans("SelectWarehouseForStockDecrease"); - $value = $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1); - } - $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)); - } - if ($object->type != 2 && $object->total_ttc < 0) // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on - { - $text.='
'.img_warning().' '.$langs->trans("ErrorInvoiceOfThisTypeMustBePositive"); - } - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ValidateBill'),$text,'confirm_valid',$formquestion,(($object->type != 2 && $object->total_ttc < 0)?"no":"yes"),($conf->notification->enabled?0:2)); + $arrayreasons[$close[$key]['code']]=$close[$key]['reason']; } - // Confirm back to draft status - if ($action == 'modif') + // Cree un tableau formulaire + $formquestion=array( + 'text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), + array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), + array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100') + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ClassifyPaid'),$langs->trans('ConfirmClassifyPaidPartially',$object->ref),'confirm_paid_partially',$formquestion,"yes"); + } + + // Confirmation du classement abandonne + if ($action == 'canceled') + { + // S'il y a une facture de remplacement pas encore validee (etat brouillon), + // on ne permet pas de classer abandonner la facture. + if ($objectidnext) { - $text=$langs->trans('ConfirmUnvalidateBill',$object->ref); - $formquestion=array(); - - $qualified_for_stock_change=0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - $qualified_for_stock_change=$object->hasProductsOrServices(2); - } - else - { - $qualified_for_stock_change=$object->hasProductsOrServices(1); - } - if ($object->type != 3 && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) - { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; - $formproduct=new FormProduct($db); - $warehouse = new Entrepot($db); - $warehouse_array = $warehouse->list_array(); - if (count($warehouse_array) == 1) { - $label = $object->type==2?$langs->trans("WarehouseForStockDecrease", current($warehouse_array)):$langs->trans("WarehouseForStockIncrease", current($warehouse_array)); - $value = ''; - } else { - $label=$object->type==2?$langs->trans("SelectWarehouseForStockDecrease"):$langs->trans("SelectWarehouseForStockIncrease"); - $value = $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1); - } - $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)); - } - - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('UnvalidateBill'),$text,'confirm_modif',$formquestion,"yes",1); + $facturereplacement=new Facture($db); + $facturereplacement->fetch($objectidnext); + $statusreplacement=$facturereplacement->statut; } - - // Confirmation du classement paye - if ($action == 'paid' && $resteapayer <= 0) + if ($objectidnext && $statusreplacement == 0) { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ClassifyPaid'),$langs->trans('ConfirmClassifyPaidBill',$object->ref),'confirm_paid','',"yes",1); + print '
'.$langs->trans("ErrorCantCancelIfReplacementInvoiceNotValidated").'
'; } - if ($action == 'paid' && $resteapayer > 0) + else { // Code - $i=0; - $close[$i]['code']='discount_vat';$i++; - $close[$i]['code']='badcustomer';$i++; + $close[1]['code']='badcustomer'; + $close[2]['code']='abandon'; // Help - $i=0; - $close[$i]['label']=$langs->trans("HelpEscompte").'

'.$langs->trans("ConfirmClassifyPaidPartiallyReasonDiscountVatDesc");$i++; - $close[$i]['label']=$langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");$i++; + $close[1]['label']=$langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc"); + $close[2]['label']=$langs->trans("ConfirmClassifyAbandonReasonOtherDesc"); // Texte - $i=0; - $close[$i]['reason']=$form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscountVat",$resteapayer,$langs->trans("Currency".$conf->currency)),$close[$i]['label'],1);$i++; - $close[$i]['reason']=$form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer",$resteapayer,$langs->trans("Currency".$conf->currency)),$close[$i]['label'],1);$i++; - // arrayreasons[code]=reason - foreach($close as $key => $val) - { - $arrayreasons[$close[$key]['code']]=$close[$key]['reason']; - } + $close[1]['reason']=$form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer",$object->ref),$close[1]['label'],1); + $close[2]['reason']=$form->textwithpicto($langs->transnoentities("ConfirmClassifyAbandonReasonOther"),$close[2]['label'],1); + // arrayreasons + $arrayreasons[$close[1]['code']]=$close[1]['reason']; + $arrayreasons[$close[2]['code']]=$close[2]['reason']; // Cree un tableau formulaire $formquestion=array( - 'text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"), + 'text' => $langs->trans("ConfirmCancelBillQuestion"), array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100') ); - // Paiement incomplet. On demande si motif = escompte ou autre - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('ClassifyPaid'),$langs->trans('ConfirmClassifyPaidPartially',$object->ref),'confirm_paid_partially',$formquestion,"yes"); - } - // Confirmation du classement abandonne - if ($action == 'canceled') + $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$object->ref),'confirm_canceled',$formquestion,"yes"); + } + } + + // Confirmation de la suppression d'une ligne produit + if ($action == 'ask_deleteline') + { + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1); + } + + // Clone confirmation + if ($action == 'clone') + { + // Create an array for form + $formquestion=array( + //'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) + ); + // Paiement incomplet. On demande si motif = escompte ou autre + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes',1); + } + + if (! $formconfirm) + { + $parameters=array('lineid'=>$lineid); + $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + } + + // Print form confirm + print $formconfirm; + + + + + // Invoice content + + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + print ''; + + // Ref customer + print ''; + print ''; + + // Third party + print ''; + + // Type + print ''; + + // Relative and absolute discounts + $addrelativediscount=''.$langs->trans("EditRelativeDiscounts").''; + $addabsolutediscount=''.$langs->trans("EditGlobalDiscounts").''; + $addcreditnote=''.$langs->trans("AddCreditNote").''; + + print ''; + print ''; + } - $resteapayeraffiche=$resteapayer; + // Link for paypal payment + if (! empty($conf->paypal->enabled) && $object->statut != 0) + { + include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; + print showPaypalPaymentUrl('invoice',$object->ref); + } - // Loop on each credit note or deposit amount applied - $creditnoteamount=0; - $depositamount=0; - $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; - $sql.= " re.description, re.fk_facture_source"; - $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re"; - $sql.= " WHERE fk_facture = ".$object->id; - $resql=$db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $invoice=new Facture($db); - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $invoice->fetch($obj->fk_facture_source); - print ''; - print ''; - print ''; - $i++; - if ($invoice->type == 2) $creditnoteamount += $obj->amount_ttc; - if ($invoice->type == 3) $depositamount += $obj->amount_ttc; - } - } - else - { - dol_print_error($db); - } + print '
'; - // Paye partiellement 'escompte' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'discount_vat') - { - print '
'; - $resteapayeraffiche=0; - } - // Paye partiellement ou Abandon 'badcustomer' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'badcustomer') - { - print ''; - //$resteapayeraffiche=0; - } - // Paye partiellement ou Abandon 'product_returned' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'product_returned') - { - print ''; - $resteapayeraffiche=0; - } - // Paye partiellement ou Abandon 'abandon' - if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'abandon') - { - print ''; - $resteapayeraffiche=0; - } + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'invoice',$socid); - // Billed - print ''; - - // Remainder to pay - print ''; - print ''; - print ''; - } - else // Credit note - { - // Total already paid back - print ''; - - // Billed - print ''; - - // Remainder to pay back - print ''; - print ''; - print ''; - - // Sold credit note - //print ''; - //print ''; - } - - print '
'.$langs->trans('Ref').''; + $morehtmlref=''; + $discount=new DiscountAbsolute($db); + $result=$discount->fetch(0,$object->id); + if ($result > 0) + { + $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; + } + if ($result < 0) + { + dol_print_error('',$discount->error); + } + print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); + print '
'; + print ''; + if ($action != 'refclient' && ! empty($object->brouillon)) print ''; + print '
'; + print $langs->trans('RefCustomer'); + print ''.img_edit($langs->trans('Modify')).'
'; + print '
'; + if ($user->rights->facture->creer && $action == 'refclient') + { + print '
'; + print ''; + print ''; + print ''; + print ' '; + print '
'; + } + else + { + print $object->ref_client; + } + print '
'; + print ''; + print ''; + print ''; + print '
'.$langs->trans('Company').''; + if (! empty($conf->global->FACTURE_CHANGE_THIRDPARTY) && $action != 'editthirdparty' && $object->brouillon && $user->rights->facture->creer) + print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; + print '
'; + if ($action == 'editthirdparty') + { + $form->form_thirdparty($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,'socid'); + } + else + { + print '  '.$soc->getNomUrl(1,'compta'); + print '   '; + print '('.$langs->trans('OtherBills').''; + // Outstanding Bill + $outstandigBills=$soc->get_OutstandingBill(); + print ' - '.$langs->trans('CurrentOutstandingBill').': '; + print price($outstandigBills,'',$langs,0,0,-1,$conf->currency); + if ($soc->outstanding_limit != '') { - // S'il y a une facture de remplacement pas encore validee (etat brouillon), - // on ne permet pas de classer abandonner la facture. - if ($objectidnext) + if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); + print ' / '.price($soc->outstanding_limit); + } + print ')'; + } + print '
'.$langs->trans('Type').''; + print $object->getLibType(); + if ($object->type == 1) + { + $facreplaced=new Facture($db); + $facreplaced->fetch($object->fk_facture_source); + print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; + } + if ($object->type == 2) + { + $facusing=new Facture($db); + $facusing->fetch($object->fk_facture_source); + print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')'; + } + + $facidavoir=$object->getListIdAvoirFromInvoice(); + if (count($facidavoir) > 0) + { + print ' ('.$langs->transnoentities("InvoiceHasAvoir"); + $i=0; + foreach($facidavoir as $id) + { + if ($i==0) print ' '; + else print ','; + $facavoir=new Facture($db); + $facavoir->fetch($id); + print $facavoir->getNomUrl(1); + } + print ')'; + } + if ($objectidnext > 0) + { + $facthatreplace=new Facture($db); + $facthatreplace->fetch($objectidnext); + print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; + } + print '
'.$langs->trans('Discounts'); + print ''; + if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); + else print $langs->trans("CompanyHasNoRelativeDiscount"); + //print ' ('.$addrelativediscount.')'; + + if ($absolute_discount > 0) + { + print '. '; + if ($object->statut > 0 || $object->type == 2 || $object->type == 3) + { + if ($object->statut == 0) { - $facturereplacement=new Facture($db); - $facturereplacement->fetch($objectidnext); - $statusreplacement=$facturereplacement->statut; - } - if ($objectidnext && $statusreplacement == 0) - { - print '
'.$langs->trans("ErrorCantCancelIfReplacementInvoiceNotValidated").'
'; + print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); + print '. '; } else { - // Code - $close[1]['code']='badcustomer'; - $close[2]['code']='abandon'; - // Help - $close[1]['label']=$langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc"); - $close[2]['label']=$langs->trans("ConfirmClassifyAbandonReasonOtherDesc"); - // Texte - $close[1]['reason']=$form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer",$object->ref),$close[1]['label'],1); - $close[2]['reason']=$form->textwithpicto($langs->transnoentities("ConfirmClassifyAbandonReasonOther"),$close[2]['label'],1); - // arrayreasons - $arrayreasons[$close[1]['code']]=$close[1]['reason']; - $arrayreasons[$close[2]['code']]=$close[2]['reason']; - - // Cree un tableau formulaire - $formquestion=array( - 'text' => $langs->trans("ConfirmCancelBillQuestion"), - array('type' => 'radio', 'name' => 'close_code', 'label' => $langs->trans("Reason"), 'values' => $arrayreasons), - array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100') - ); - - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$object->ref),'confirm_canceled',$formquestion,"yes"); - } - } - - // Confirmation de la suppression d'une ligne produit - if ($action == 'ask_deleteline') - { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1); - } - - // Clone confirmation - if ($action == 'clone') - { - // Create an array for form - $formquestion=array( - //'text' => $langs->trans("ConfirmClone"), - //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) - ); - // Paiement incomplet. On demande si motif = escompte ou autre - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes',1); - } - - if (! $formconfirm) - { - $parameters=array('lineid'=>$lineid); - $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - } - - // Print form confirm - print $formconfirm; - - - - - // Invoice content - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - - // Ref customer - print ''; - print ''; - - // Third party - print ''; - - // Type - print ''; - - // Relative and absolute discounts - $addrelativediscount=''.$langs->trans("EditRelativeDiscounts").''; - $addabsolutediscount=''.$langs->trans("EditGlobalDiscounts").''; - $addcreditnote=''.$langs->trans("AddCreditNote").''; - - print ''; - - // Date invoice - print ''; + + // Date invoice + print ''; + + + // List of payments + + $sign=1; + if ($object->type == 2) $sign=-1; + + $nbrows=8; $nbcols=2; + if (! empty($conf->projet->enabled)) $nbrows++; + if (! empty($conf->banque->enabled)) $nbcols++; + //if (! empty($soc->outstandingbill)) $nbrows++; + if($mysoc->localtax1_assuj=="1") $nbrows++; + if($mysoc->localtax2_assuj=="1") $nbrows++; + if ($selleruserevenustamp) $nbrows++; + + print ''; + + // Conditions de reglement + print ''; + + // Date payment term + print ''; + + // Payment mode + print ''; + + // Amount + print ''; + print ''; + print ''; + print ''; + + // Amount Local Taxes + if ($mysoc->localtax1_assuj=="1" && $mysoc->useLocalTax(1)) //Localtax1 (example RE) + { + print ''; + print ''; + } + if ($mysoc->localtax2_assuj=="1" && $mysoc->useLocalTax(2)) //Localtax2 (example IRPF) + { + print ''; + print ''; + } + + // Revenue stamp + if ($selleruserevenustamp) // Test company use revenue stamp + { + print ''; + } + // Total with tax + print ''; - // List of payments + // Statut + print ''; + print ''; - $sign=1; - if ($object->type == 2) $sign=-1; + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load('projects'); + print ''; + print ''; - $label=($langs->trans("PaymentType".$objp->payment_code)!=("PaymentType".$objp->payment_code))?$langs->trans("PaymentType".$objp->payment_code):$objp->payment_label; - print ''; - if (! empty($conf->banque->enabled)) + if (! $objectidnext) { - $bankaccountstatic->id=$objp->baid; - $bankaccountstatic->ref=$objp->ref; - $bankaccountstatic->label=$objp->ref; - print ''; + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate) + { + print ''; + } + else + { + print '
'.$langs->trans('Modify').'
'; + } } - print ''; - print ''; - print ''; - $i++; + else + { + print '
'.$langs->trans('Modify').'
'; + } + } + } + + // 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 (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice + { + print ''; + } + else + { + print '
'.$langs->trans('ReOpen').'
'; + } + } + + // Validate + if ($object->statut == 0 && count($object->lines) > 0 && + ( + (($object->type == 0 || $object->type == 1 || $object->type == 3 || $object->type == 4) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) + || ($object->type == 2 && $object->total_ttc <= 0)) + ) + { + if ($user->rights->facture->valider) + { + print ''; + } + } + + // Send by mail + if (($object->statut == 1 || $object->statut == 2)) + { + if ($objectidnext) + { + print '
'.$langs->trans('SendByMail').'
'; + } + else + { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send) + { + print ''; + } + else print ''; + } + } + + if (! empty($conf->global->FACTURE_SHOW_SEND_REMINDER)) // For backward compatibility + { + if (($object->statut == 1 || $object->statut == 2) && $resteapayer > 0) + { + if ($objectidnext) + { + print '
'.$langs->trans('SendRemindByMail').'
'; + } + else + { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send) + { + print ''; + } + else print ''; + } + } + } + + // Create payment + if ($object->type != 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) + { + if ($objectidnext) + { + print '
'.$langs->trans('DoPayment').'
'; + } + else + { + if ($resteapayer == 0) + { + print '
'.$langs->trans('DoPayment').'
'; + } + else + { + print ''; + } + } + } + + // Reverse back money or convert to reduction + if ($object->type == 2 || $object->type == 3) + { + // For credit note only + if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) + { + 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 == 1 && $resteapayer == 0 && $user->rights->facture->creer) + { + 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)) ) + { + print ''; + } + + // Classify 'closed not completely paid' (possible si validee et pas encore classee payee) + if ($object->statut == 1 && $object->paye == 0 && $resteapayer > 0 + && $user->rights->facture->paiement) + { + if ($totalpaye > 0 || $totalcreditnotes > 0) + { + // If one payment or one credit note was linked to this invoice + print ''; + } + else + { + if ($objectidnext) + { + print '
'.$langs->trans('ClassifyCanceled').'
'; + } + else + { + print ''; + } + } + } + + // Clone + if (($object->type == 0 || $object->type == 3 || $object->type == 4) && $user->rights->facture->creer) + { + print ''; + } + + // Clone as predefined + if (($object->type == 0 || $object->type == 3 || $object->type == 4) && $object->statut == 0 && $user->rights->facture->creer) + { + if (! $objectidnext) + { + print ''; + } + } + + // Delete + if ($user->rights->facture->supprimer) + { + if (! $object->is_erasable()) + { + print ''; + } + else if ($objectidnext) + { + print ''; + } + elseif ($object->getSommePaiement()) + { + print ''; + } + else + { + print ''; } } else { - print ''; + print ''; } - //} - $db->free($result); + + print ''; + } + } + print '
'; + + if ($action != 'prerelance' && $action != 'presend') + { + print '
'; + print ''; // ancre + + // Documents generes + $filename=dol_sanitizeFileName($object->ref); + $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref); + $urlsource=$_SERVER['PHP_SELF'].'?facid='.$object->id; + $genallowed=$user->rights->facture->creer; + $delallowed=$user->rights->facture->supprimer; + + print $formfile->showdocuments('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); + $somethingshown=$formfile->numoffiles; + + // Linked object block + $somethingshown=$object->showLinkedObjectBlock(); + + if (empty($somethingshown) && $object->statut > 0) + { + print '
'.$langs->trans('LinkedOrder').''; + + print '
'.$langs->trans('Ref').''; - $morehtmlref=''; - $discount=new DiscountAbsolute($db); - $result=$discount->fetch(0,$object->id); - if ($result > 0) - { - $morehtmlref=' ('.$langs->trans("CreditNoteConvertedIntoDiscount",$discount->getNomUrl(1,'discount')).')'; - } - if ($result < 0) - { - dol_print_error('',$discount->error); - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref); - print '
'; - print ''; - if ($action != 'refclient' && ! empty($object->brouillon)) print ''; - print '
'; - print $langs->trans('RefCustomer'); - print ''.img_edit($langs->trans('Modify')).'
'; - print '
'; - if ($user->rights->facture->creer && $action == 'refclient') - { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print '
'; - } - else - { - print $object->ref_client; - } - print '
'; - print ''; - print ''; - print ''; - print '
'.$langs->trans('Company').''; - if (! empty($conf->global->FACTURE_CHANGE_THIRDPARTY) && $action != 'editthirdparty' && $object->brouillon && $user->rights->facture->creer) - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; - print '
'; - if ($action == 'editthirdparty') - { - $form->form_thirdparty($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,'socid'); - } - else - { - print '  '.$soc->getNomUrl(1,'compta'); - print '   '; - print '('.$langs->trans('OtherBills').''; - // Outstanding Bill - $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")); - print ' / '.price($soc->outstanding_limit); - } - print ')'; - } - print '
'.$langs->trans('Type').''; - print $object->getLibType(); - if ($object->type == 1) - { - $facreplaced=new Facture($db); - $facreplaced->fetch($object->fk_facture_source); - print ' ('.$langs->transnoentities("ReplaceInvoice",$facreplaced->getNomUrl(1)).')'; - } - if ($object->type == 2) - { - $facusing=new Facture($db); - $facusing->fetch($object->fk_facture_source); - print ' ('.$langs->transnoentities("CorrectInvoice",$facusing->getNomUrl(1)).')'; - } - - $facidavoir=$object->getListIdAvoirFromInvoice(); - if (count($facidavoir) > 0) - { - print ' ('.$langs->transnoentities("InvoiceHasAvoir"); - $i=0; - foreach($facidavoir as $id) - { - if ($i==0) print ' '; - else print ','; - $facavoir=new Facture($db); - $facavoir->fetch($id); - print $facavoir->getNomUrl(1); - } - print ')'; - } - if ($objectidnext > 0) - { - $facthatreplace=new Facture($db); - $facthatreplace->fetch($objectidnext); - print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')'; - } - print '
'.$langs->trans('Discounts'); - print ''; - if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - //print ' ('.$addrelativediscount.')'; - - if ($absolute_discount > 0) - { - print '. '; - if ($object->statut > 0 || $object->type == 2 || $object->type == 3) - { - if ($object->statut == 0) + if ($object->statut < 1 || $object->type == 2 || $object->type == 3) { - print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - print '. '; + $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); + print '
'.$text.'.
'; } else { - if ($object->statut < 1 || $object->type == 2 || $object->type == 3) - { - $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - print '
'.$text.'.
'; - } - else - { - $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); - $text2=$langs->trans("AbsoluteDiscountUse"); - print $form->textwithpicto($text,$text2); - } + $text=$langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); + $text2=$langs->trans("AbsoluteDiscountUse"); + print $form->textwithpicto($text,$text2); } } - else - { - // Remise dispo de type remise fixe (not credit note) - print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, $resteapayer, ' ('.$addabsolutediscount.')'); - } } else { - if ($absolute_creditnote > 0) // If not, link will be added later - { - if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' ('.$addabsolutediscount.')
'; - else print '. '; - } - else print '. '; + // Remise dispo de type remise fixe (not credit note) + print '
'; + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, $resteapayer, ' ('.$addabsolutediscount.')'); } - if ($absolute_creditnote > 0) + } + else + { + if ($absolute_creditnote > 0) // If not, link will be added later { - // If validated, we show link "add credit note to payment" - if ($object->statut != 1 || $object->type == 2 || $object->type == 3) - { - if ($object->statut == 0 && $object->type != 3) - { - $text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)); - print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse")); - } - else - { - print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'.'; - } - } - else - { - // Remise dispo de type avoir - if (! $absolute_discount) print '
'; - //$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer); - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We must allow credit not even if amount is higher - } - } - if (! $absolute_discount && ! $absolute_creditnote) - { - print $langs->trans("CompanyHasNoAbsoluteDiscount"); if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' ('.$addabsolutediscount.')
'; else print '. '; } - //if ($object->statut == 0 && $object->type != 2 && $object->type != 3) - // { - //if (! $absolute_discount && ! $absolute_creditnote) print '
'; - //print '   -   '; - //print $addabsolutediscount; - //print '   -   '.$addcreditnote; // We disbale link to credit note - //} - print '
'; - print ''; - if ($object->type != 2 && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('Date'); - print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; - print '
'; - - if ($object->type != 2) + else print '. '; + } + if ($absolute_creditnote > 0) + { + // If validated, we show link "add credit note to payment" + if ($object->statut != 1 || $object->type == 2 || $object->type == 3) { - if ($action == 'editinvoicedate') + if ($object->statut == 0 && $object->type != 3) { - $form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date,'invoicedate'); + $text=$langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)); + print $form->textwithpicto($text,$langs->trans("CreditNoteDepositUse")); } else { - print dol_print_date($object->date,'daytext'); + print $langs->trans("CompanyHasCreditNote",price($absolute_creditnote),$langs->transnoentities("Currency".$conf->currency)).'.'; } } else + { + // Remise dispo de type avoir + if (! $absolute_discount) print '
'; + //$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We must allow credit not even if amount is higher + } + } + if (! $absolute_discount && ! $absolute_creditnote) + { + print $langs->trans("CompanyHasNoAbsoluteDiscount"); + if ($object->statut == 0 && $object->type != 2 && $object->type != 3) print ' ('.$addabsolutediscount.')
'; + else print '. '; + } + //if ($object->statut == 0 && $object->type != 2 && $object->type != 3) + // { + //if (! $absolute_discount && ! $absolute_creditnote) print '
'; + //print '   -   '; + //print $addabsolutediscount; + //print '   -   '.$addcreditnote; // We disbale link to credit note + //} + print '
'; + print ''; + if ($object->type != 2 && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('Date'); + print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; + print '
'; + + if ($object->type != 2) + { + if ($action == 'editinvoicedate') + { + $form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date,'invoicedate'); + } + else { print dol_print_date($object->date,'daytext'); } + } + else + { + print dol_print_date($object->date,'daytext'); + } + print ''; + + print ''; + + // List of payments already done + print ''; + print ''; + print ''; + if (! empty($conf->banque->enabled)) print ''; + print ''; + print ''; + print ''; + + $var=true; + + // Payments already done (from payment on this invoice) + $sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,'; + $sql.= ' c.code as payment_code, c.libelle as payment_label,'; + $sql.= ' pf.amount,'; + $sql.= ' ba.rowid as baid, ba.ref, ba.label'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; + $sql.= ' WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid'; + $sql.= ' ORDER BY p.datep, p.tms'; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + $i = 0; + + //if ($object->type != 2) + //{ + if ($num > 0) + { + while ($i < $num) + { + $objp = $db->fetch_object($result); + $var=!$var; + print ''; + $label=($langs->trans("PaymentType".$objp->payment_code)!=("PaymentType".$objp->payment_code))?$langs->trans("PaymentType".$objp->payment_code):$objp->payment_label; + print ''; + if (! empty($conf->banque->enabled)) + { + $bankaccountstatic->id=$objp->baid; + $bankaccountstatic->ref=$objp->ref; + $bankaccountstatic->label=$objp->ref; + print ''; + } + print ''; + print ''; + print ''; + $i++; + } + } + else + { + print ''; + } + //} + $db->free($result); + } + else + { + dol_print_error($db); + } + + if ($object->type != 2) + { + // Total already paid + print ''; + + $resteapayeraffiche=$resteapayer; + + // Loop on each credit note or deposit amount applied + $creditnoteamount=0; + $depositamount=0; + $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; + $sql.= " re.description, re.fk_facture_source"; + $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re"; + $sql.= " WHERE fk_facture = ".$object->id; + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + $invoice=new Facture($db); + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $invoice->fetch($obj->fk_facture_source); + print ''; + print ''; + print ''; + $i++; + if ($invoice->type == 2) $creditnoteamount += $obj->amount_ttc; + if ($invoice->type == 3) $depositamount += $obj->amount_ttc; + } + } + else + { + dol_print_error($db); + } + + // Paye partiellement 'escompte' + if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'discount_vat') + { + print ''; + $resteapayeraffiche=0; + } + // Paye partiellement ou Abandon 'badcustomer' + if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'badcustomer') + { + print ''; + //$resteapayeraffiche=0; + } + // Paye partiellement ou Abandon 'product_returned' + if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'product_returned') + { + print ''; + $resteapayeraffiche=0; + } + // Paye partiellement ou Abandon 'abandon' + if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'abandon') + { + print ''; + $resteapayeraffiche=0; + } + + // Billed + print ''; + + // Remainder to pay + print ''; + print ''; + print ''; + } + else // Credit note + { + // Total already paid back + print ''; + + // Billed + print ''; + + // Remainder to pay back + print ''; + print ''; + print ''; + + // Sold credit note + //print ''; + //print ''; + } + + print '
'.($object->type == 2 ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' 
'; + print ''.img_object($langs->trans('ShowPayment'),'payment').' '; + print dol_print_date($db->jdate($objp->dp),'day').''.$label.' '.$objp->num_paiement.''; + if ($bankaccountstatic->id) print $bankaccountstatic->getNomUrl(1,'transactions'); + print ''.price($sign * $objp->amount).' 
'.$langs->trans("None").'
'; + if ($object->type != 3) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); + else print $langs->trans('AlreadyPaid'); + print ' :'.price($totalpaye).' 
'; + if ($invoice->type == 2) print $langs->trans("CreditNote").' '; + if ($invoice->type == 3) print $langs->trans("Deposit").' '; + print $invoice->getNomUrl(0); + print ' :'.price($obj->amount_ttc).''; + print 'rowid.'">'.img_delete().''; + print '
'; + print $form->textwithpicto($langs->trans("Discount").':',$langs->trans("HelpEscompte"),-1); + print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' 
'; + print $form->textwithpicto($langs->trans("Abandoned").':',$langs->trans("HelpAbandonBadCustomer"),-1); + print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' 
'; + print $form->textwithpicto($langs->trans("ProductReturned").':',$langs->trans("HelpAbandonProductReturned"),-1); + print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' 
'; + $text=$langs->trans("HelpAbandonOther"); + if ($object->close_note) $text.='

'.$langs->trans("Reason").':'.$object->close_note; + print $form->textwithpicto($langs->trans("Abandoned").':',$text,-1); + print '
'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' 
'.$langs->trans("Billed").' :'.price($object->total_ttc).' 
'; + if ($resteapayeraffiche >= 0) print $langs->trans('RemainderToPay'); + else print $langs->trans('ExcessReceived'); + print ' :'.price($resteapayeraffiche).' 
'; + print $langs->trans('AlreadyPaidBack'); + print ' :'.price($sign * $totalpaye).' 
'.$langs->trans("Billed").' :'.price($sign * $object->total_ttc).' 
'; + if ($resteapayeraffiche <= 0) print $langs->trans('RemainderToPayBack'); + else print $langs->trans('ExcessPaydBack'); + print ' :'.price($sign * $resteapayeraffiche).' 
'.$langs->trans('TotalTTC').' :'.price($sign * $object->total_ttc).' 
'; + + // Margin Infos + if (! empty($conf->margin->enabled)) + { + print '
'; + $object->displayMarginInfos($object->statut > 0); + } + + print '
'; + print ''; + if ($object->type != 2 && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('PaymentConditionsShort'); + print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; + print '
'; + if ($object->type != 2) + { + if ($action == 'editconditions') + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); + } + else + { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->cond_reglement_id,'none'); + } + } + else + { + print ' '; + } + print '
'; + print ''; + if ($object->type != 2 && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('DateMaxPayment'); + print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; + print '
'; + if ($object->type != 2) + { + if ($action == 'editpaymentterm') + { + $form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date_lim_reglement,'paymentterm'); + } + else + { + print dol_print_date($object->date_lim_reglement,'daytext'); + if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! isset($object->am)) print img_warning($langs->trans('Late')); + } + } + else + { + print ' '; + } + print '
'; + print ''; + if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; + print '
'; + if ($action == 'editmode') + { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); + } + else + { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none'); + } + print '
'.$langs->trans('AmountHT').''.price($object->total_ht,1,'',1,-1,-1,$conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva,1,'',1,-1,-1,$conf->currency).'
'.$langs->transcountry("AmountLT1",$mysoc->country_code).''.price($object->total_localtax1,1,'',1,-1,-1,$conf->currency).'
'.$langs->transcountry("AmountLT2",$mysoc->country_code).''.price($object->total_localtax2,1,'',1,-1,-1,$conf->currency).'
'; + print ''; + if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('RevenueStamp'); print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'
'; + print '
'; + if ($action == 'editrevenuestamp') + { + print '
'; + print ''; + print ''; + print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code); + //print ''; + print ' '; + print '
'; + } + else + { + print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency); + } + print '
'.$langs->trans('AmountTTC').''.price($object->total_ttc,1,'',1,-1,-1,$conf->currency).'
'.$langs->trans('Status').''.($object->getLibStatut(4,$totalpaye)).'
'; - $nbrows=8; $nbcols=2; - if (! empty($conf->projet->enabled)) $nbrows++; - if (! empty($conf->banque->enabled)) $nbcols++; - //if (! empty($soc->outstandingbill)) $nbrows++; - if($mysoc->localtax1_assuj=="1") $nbrows++; - if($mysoc->localtax2_assuj=="1") $nbrows++; - if ($selleruserevenustamp) $nbrows++; + print ''; + if ($action != 'classify') + { + print ''; + } + print '
'; + print $langs->trans('Project'); + print 'id.'">'; + print img_edit($langs->trans('SetProject'),1); + print '
'; - print '
'; - - print ''; - - // List of payments already done - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) print ''; - print ''; - print ''; + print ''; print ''; + } + // Other attributes (TODO Move this into an include) + $res=$object->fetch_optionals($object->id,$extralabels); + $parameters=array('colspan' => ' colspan="2"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + + foreach($extrafields->attribute_label as $key=>$label) + { + if ($action == 'edit_extras') { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + } else { + $value=$object->array_options["options_".$key]; + } + if ($extrafields->attribute_type[$key] == 'separate') + { + print $extrafields->showSeparator($key); + } + else + { + print 'attribute_required[$key])) print ' class="fieldrequired"'; + print '>'.$label.''."\n"; + } + } + } + + print '
'.($object->type == 2 ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' '; + if ($action == 'classify') + { + $form->form_project($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,$object->fk_project,'projectid'); + } + else + { + $form->form_project($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,$object->fk_project,'none'); + } + print '
'; + // Convert date into timestamp format + if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) + { + $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]); + } + + if ($action == 'edit_extras' && $user->rights->facture->creer && GETPOST('attribute') == $key) + { + print '
'; + print ''; + print ''; + print ''; + print ''; + + print $extrafields->showInputField($key,$value); + + print ''; + print '
'; + } + else + { + print $extrafields->showOutputField($key,$value); + if ($object->statut == 0 && $user->rights->facture->creer) print ''.img_picto('','edit').' '.$langs->trans('Modify').''; + } + print '

'; + + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + { + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + // Lines + $result = $object->getLinesArray(); + + + print '
+ + + + + '; + + + if (! empty($conf->use_javascript_ajax) && $object->statut == 0) + { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print ''; + + // Show object lines + if (! empty($object->lines)) + $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1); + + // Form to add new line + if ($object->statut == 0 && $user->rights->facture->creer && $action <> 'valid' && $action <> 'editline') + { $var=true; - // Payments already done (from payment on this invoice) - $sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,'; - $sql.= ' c.code as payment_code, c.libelle as payment_label,'; - $sql.= ' pf.amount,'; - $sql.= ' ba.rowid as baid, ba.ref, ba.label'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; - $sql.= ' WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid'; - $sql.= ' ORDER BY p.datep, p.tms'; - - $result = $db->query($sql); - if ($result) + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { - $num = $db->num_rows($result); - $i = 0; + // Add free or predefined products/services + $object->formAddObjectLine(1,$mysoc,$soc); + } + else + { + // Add free products/services + $object->formAddFreeProduct(1,$mysoc,$soc); - //if ($object->type != 2) - //{ - if ($num > 0) + // Add predefined products/services + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { - while ($i < $num) + $var=!$var; + $object->formAddPredefinedProduct(1,$mysoc,$soc); + } + } + + $parameters=array(); + $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + } + + print "
\n"; + + print "
\n"; + + dol_fiche_end(); + + + // Boutons actions + + if ($action != 'prerelance' && $action != 'presend') + { + if ($user->societe_id == 0 && $action <> 'valid' && $action <> 'editline') + { + print '
'; + + // Editer une facture deja validee, sans paiement effectue et pas exporte en compta + if ($object->statut == 1) + { + // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees + $ventilExportCompta = $object->getVentilExportCompta(); + + if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) { - $objp = $db->fetch_object($result); - $var=!$var; - print '
'; - print ''.img_object($langs->trans('ShowPayment'),'payment').' '; - print dol_print_date($db->jdate($objp->dp),'day').''.$label.' '.$objp->num_paiement.''; - if ($bankaccountstatic->id) print $bankaccountstatic->getNomUrl(1,'transactions'); - print ''.price($sign * $objp->amount).' 
'.$langs->trans("None").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + while ($i < $num) + { + $objp = $db->fetch_object($resqlorderlist); + if ($objp->socid == $soc->id) + { + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + + $i++; + } + print '
'.$langs->trans("Ref").''.$langs->trans("RefCustomer").''.$langs->trans("AmountHTShort").''.$langs->trans("Company").'
'; + print ''; + print ''.$objp->ref.''.$objp->ref_client.''.price($objp->total_ht).''.$objp->name.'
'; + print '
'; + print ''; + $db->free($resqlorderlist); } else { dol_print_error($db); } - if ($object->type != 2) - { - // Total already paid - print '
'; - if ($object->type != 3) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); - else print $langs->trans('AlreadyPaid'); - print ' :'.price($totalpaye).' 
'; - if ($invoice->type == 2) print $langs->trans("CreditNote").' '; - if ($invoice->type == 3) print $langs->trans("Deposit").' '; - print $invoice->getNomUrl(0); - print ' :'.price($obj->amount_ttc).''; - print 'rowid.'">'.img_delete().''; - print '
'; - print $form->textwithpicto($langs->trans("Discount").':',$langs->trans("HelpEscompte"),-1); - print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' 
'; - print $form->textwithpicto($langs->trans("Abandoned").':',$langs->trans("HelpAbandonBadCustomer"),-1); - print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' 
'; - print $form->textwithpicto($langs->trans("ProductReturned").':',$langs->trans("HelpAbandonProductReturned"),-1); - print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' 
'; - $text=$langs->trans("HelpAbandonOther"); - if ($object->close_note) $text.='

'.$langs->trans("Reason").':'.$object->close_note; - print $form->textwithpicto($langs->trans("Abandoned").':',$text,-1); - print '
'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).' 
'.$langs->trans("Billed").' :'.price($object->total_ttc).' 
'; - if ($resteapayeraffiche >= 0) print $langs->trans('RemainderToPay'); - else print $langs->trans('ExcessReceived'); - print ' :'.price($resteapayeraffiche).' 
'; - print $langs->trans('AlreadyPaidBack'); - print ' :'.price($sign * $totalpaye).' 
'.$langs->trans("Billed").' :'.price($sign * $object->total_ttc).' 
'; - if ($resteapayeraffiche <= 0) print $langs->trans('RemainderToPayBack'); - else print $langs->trans('ExcessPaydBack'); - print ' :'.price($sign * $resteapayeraffiche).' 
'.$langs->trans('TotalTTC').' :'.price($sign * $object->total_ttc).' 
'; - - // Margin Infos - if (! empty($conf->margin->enabled)) - { - print '
'; - $object->displayMarginInfos($object->statut > 0); - } - - print ''; - - // Conditions de reglement - print ''; - print ''; - if ($object->type != 2 && $action != 'editconditions' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('PaymentConditionsShort'); - print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; - print ''; - if ($object->type != 2) - { - if ($action == 'editconditions') - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); - } - else - { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->cond_reglement_id,'none'); - } - } - else - { - print ' '; - } - print ''; - - // Date payment term - print ''; - print ''; - if ($object->type != 2 && $action != 'editpaymentterm' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('DateMaxPayment'); - print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; - print ''; - if ($object->type != 2) - { - if ($action == 'editpaymentterm') - { - $form->form_date($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->date_lim_reglement,'paymentterm'); - } - else - { - print dol_print_date($object->date_lim_reglement,'daytext'); - if ($object->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $object->paye && $object->statut == 1 && ! isset($object->am)) print img_warning($langs->trans('Late')); - } - } - else - { - print ' '; - } - print ''; - - // Payment mode - print ''; - print ''; - if ($action != 'editmode' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; - print ''; - if ($action == 'editmode') - { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); - } - else - { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->mode_reglement_id,'none'); - } - print ''; - - // Amount - print ''.$langs->trans('AmountHT').''; - print ''.price($object->total_ht,1,'',1,-1,-1,$conf->currency).''; - print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,'',1,-1,-1,$conf->currency).''; - print ''; - - // Amount Local Taxes - if ($mysoc->localtax1_assuj=="1" && $mysoc->useLocalTax(1)) //Localtax1 (example RE) - { - print ''.$langs->transcountry("AmountLT1",$mysoc->country_code).''; - print ''.price($object->total_localtax1,1,'',1,-1,-1,$conf->currency).''; - } - if ($mysoc->localtax2_assuj=="1" && $mysoc->useLocalTax(2)) //Localtax2 (example IRPF) - { - print ''.$langs->transcountry("AmountLT2",$mysoc->country_code).''; - print ''.price($object->total_localtax2,1,'',1,-1,-1,$conf->currency).''; - } - - // Revenue stamp - if ($selleruserevenustamp) // Test company use revenue stamp - { - print ''; - print ''; - if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print ''; - print '
'; - print $langs->trans('RevenueStamp'); - print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'
'; - print ''; - if ($action == 'editrevenuestamp') - { - print '
'; - print ''; - print ''; - print $formother->select_revenue_stamp(GETPOST('revenuestamp'), 'revenuestamp', $mysoc->country_code); - //print ''; - print ' '; - print '
'; - } - else - { - print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency); - } - print ''; - } - - // Total with tax - print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,'',1,-1,-1,$conf->currency).''; - - // Statut - print ''.$langs->trans('Status').''; - print ''.($object->getLibStatut(4,$totalpaye)).''; - - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load('projects'); - print ''; - print ''; - - print ''; - if ($action != 'classify') - { - print ''; - } - print '
'; - print $langs->trans('Project'); - print 'id.'">'; - print img_edit($langs->trans('SetProject'),1); - print '
'; - - print ''; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,$object->fk_project,'projectid'); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?facid='.$object->id,$object->socid,$object->fk_project,'none'); - } - print ''; - print ''; - } - - // Other attributes (TODO Move this into an include) - $res=$object->fetch_optionals($object->id,$extralabels); - $parameters=array('colspan' => ' colspan="2"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - - foreach($extrafields->attribute_label as $key=>$label) - { - if ($action == 'edit_extras') { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - } else { - $value=$object->array_options["options_".$key]; - } - if ($extrafields->attribute_type[$key] == 'separate') - { - print $extrafields->showSeparator($key); - } - else - { - print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; - // Convert date into timestamp format - if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) - { - $value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$db->jdate($object->array_options['options_'.$key]); - } - - if ($action == 'edit_extras' && $user->rights->facture->creer && GETPOST('attribute') == $key) - { - print '
'; - print ''; - print ''; - print ''; - print ''; - - print $extrafields->showInputField($key,$value); - - print ''; - print '
'; - } - else - { - print $extrafields->showOutputField($key,$value); - if ($object->statut == 0 && $user->rights->facture->creer) print ''.img_picto('','edit').' '.$langs->trans('Modify').''; - } - print ''."\n"; - } - } - } - - print '
'; - - if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) - { - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) - { - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - // Lines - $result = $object->getLinesArray(); - - if (! empty($conf->use_javascript_ajax) && $object->statut == 0) - { - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; - } - - print ''; - - // Show object lines - if (! empty($object->lines)) - $ret=$object->printObjectLines($action,$mysoc,$soc,$lineid,1); - - // Form to add new line - if ($object->statut == 0 && $user->rights->facture->creer && $action <> 'valid' && $action <> 'editline') - { - $var=true; - - if ($conf->global->MAIN_FEATURES_LEVEL > 1) - { - // Add free or predefined products/services - $object->formAddObjectLine(1,$mysoc,$soc); - } - else - { - // Add free products/services - $object->formAddFreeProduct(1,$mysoc,$soc); - - // Add predefined products/services - if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) - { - $var=!$var; - $object->formAddPredefinedProduct(1,$mysoc,$soc); - } - } - - $parameters=array(); - $reshook=$hookmanager->executeHooks('formAddObjectLine',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - } - - print "
\n"; - - print "\n"; - - - // Boutons actions - - if ($action != 'prerelance' && $action != 'presend') - { - if ($user->societe_id == 0 && $action <> 'valid' && $action <> 'editline') - { - print '
'; - - // Editer une facture deja validee, sans paiement effectue et pas exporte en compta - if ($object->statut == 1) - { - // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees - $ventilExportCompta = $object->getVentilExportCompta(); - - if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) - { - if (! $objectidnext) - { - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate) - { - print ''; - } - else - { - print '
'.$langs->trans('Modify').'
'; - } - } - else - { - print '
'.$langs->trans('Modify').'
'; - } - } - } - - // 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 (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice - { - print ''; - } - else - { - print '
'.$langs->trans('ReOpen').'
'; - } - } - - // Validate - if ($object->statut == 0 && count($object->lines) > 0 && - ( - (($object->type == 0 || $object->type == 1 || $object->type == 3 || $object->type == 4) && (! empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) - || ($object->type == 2 && $object->total_ttc <= 0)) - ) - { - if ($user->rights->facture->valider) - { - print ''; - } - } - - // Send by mail - if (($object->statut == 1 || $object->statut == 2)) - { - if ($objectidnext) - { - print '
'.$langs->trans('SendByMail').'
'; - } - else - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send) - { - print ''; - } - else print ''; - } - } - - if (! empty($conf->global->FACTURE_SHOW_SEND_REMINDER)) // For backward compatibility - { - if (($object->statut == 1 || $object->statut == 2) && $resteapayer > 0) - { - if ($objectidnext) - { - print '
'.$langs->trans('SendRemindByMail').'
'; - } - else - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send) - { - print ''; - } - else print ''; - } - } - } - - // Create payment - if ($object->type != 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) - { - if ($objectidnext) - { - print '
'.$langs->trans('DoPayment').'
'; - } - else - { - if ($resteapayer == 0) - { - print '
'.$langs->trans('DoPayment').'
'; - } - else - { - print ''; - } - } - } - - // Reverse back money or convert to reduction - if ($object->type == 2 || $object->type == 3) - { - // For credit note only - if ($object->type == 2 && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) - { - 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 == 1 && $resteapayer == 0 && $user->rights->facture->creer) - { - 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)) ) - { - print ''; - } - - // Classify 'closed not completely paid' (possible si validee et pas encore classee payee) - if ($object->statut == 1 && $object->paye == 0 && $resteapayer > 0 - && $user->rights->facture->paiement) - { - if ($totalpaye > 0 || $totalcreditnotes > 0) - { - // If one payment or one credit note was linked to this invoice - print ''; - } - else - { - if ($objectidnext) - { - print '
'.$langs->trans('ClassifyCanceled').'
'; - } - else - { - print ''; - } - } - } - - // Clone - if (($object->type == 0 || $object->type == 3 || $object->type == 4) && $user->rights->facture->creer) - { - print ''; - } - - // Clone as predefined - if (($object->type == 0 || $object->type == 3 || $object->type == 4) && $object->statut == 0 && $user->rights->facture->creer) - { - if (! $objectidnext) - { - print ''; - } - } - - // Delete - if ($user->rights->facture->supprimer) - { - if (! $object->is_erasable()) - { - print ''; - } - else if ($objectidnext) - { - print ''; - } - elseif ($object->getSommePaiement()) - { - print ''; - } - else - { - print ''; - } - } - else - { - print ''; - } - - print '
'; - } - } - print '
'; - - if ($action != 'prerelance' && $action != 'presend') - { - print '
'; - print ''; // ancre - - // Documents generes - $filename=dol_sanitizeFileName($object->ref); - $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref); - $urlsource=$_SERVER['PHP_SELF'].'?facid='.$object->id; - $genallowed=$user->rights->facture->creer; - $delallowed=$user->rights->facture->supprimer; - - print $formfile->showdocuments('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); - $somethingshown=$formfile->numoffiles; - - // Linked object block - $somethingshown=$object->showLinkedObjectBlock(); - - if (empty($somethingshown) && $object->statut > 0) - { - print '
'.$langs->trans('LinkedOrder').''; - - print ''; - } - - // Link for paypal payment - if (! empty($conf->paypal->enabled) && $object->statut != 0) - { - include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; - print showPaypalPaymentUrl('invoice',$object->ref); - } - - print '
'; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'invoice',$socid); - - print '
'; - } - else - { - /* - * Affiche formulaire mail - */ - - // By default if $action=='presend' - $titreform='SendBillByMail'; - $topicmail='SendBillRef'; - $action='send'; - $modelmail='facture_send'; - - if ($action == 'prerelance') // For backward compatibility - { - $titrefrom='SendReminderBillByMail'; - $topicmail='SendReminderBillRef'; - $action='relance'; - $modelmail='facture_relance'; - } - - $ref = dol_sanitizeFileName($object->ref); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); - $file=$fileparams['fullname']; - - // Build document if it not exists - if (! $file || ! is_readable($file)) - { - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - - $result=facture_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); - $file=$fileparams['fullname']; - } - - print '
'; - print_titre($langs->trans($titreform)); - - // Cree l'objet formulaire mail - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - $formmail->fromtype = 'user'; - $formmail->fromid = $user->id; - $formmail->fromname = $user->getFullName($langs); - $formmail->frommail = $user->email; - $formmail->withfrom=1; - $liste=array(); - foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; - $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste; - $formmail->withtocc=$liste; - $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - if(empty($object->ref_client)) - { - $formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__'); - } - else if(!empty($object->ref_client)) - { - $formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__(__REFCLIENT__)'); - } - $formmail->withfile=2; - $formmail->withbody=1; - $formmail->withdeliveryreceipt=1; - $formmail->withcancel=1; - // Tableau des substitutions - $formmail->substit['__FACREF__']=$object->ref; - $formmail->substit['__SIGNATURE__']=$user->signature; - $formmail->substit['__REFCLIENT__']=$object->ref_client; - $formmail->substit['__PERSONALIZED__']=''; - $formmail->substit['__CONTACTCIVNAME__']=''; - - //Find the good contact adress - $custcontact=''; - $contactarr=array(); - $contactarr=$object->liste_contact(-1,'external'); - - if (is_array($contactarr) && count($contactarr)>0) { - foreach($contactarr as $contact) { - if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) { - - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; - - $contactstatic=new Contact($db); - $contactstatic->fetch($contact['id']); - $custcontact=$contactstatic->getFullName($langs,1); - } - } - - if (!empty($custcontact)) { - $formmail->substit['__CONTACTCIVNAME__']=$custcontact; - } - } - - - // Tableau des parametres complementaires du post - $formmail->param['action']=$action; - $formmail->param['models']=$modelmail; - $formmail->param['facid']=$object->id; - $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; - - // Init list of files - if (GETPOST("mode")=='init') - { - $formmail->clear_attached_files(); - $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); - } - - $formmail->show_form(); - - print '
'; - } + print ''; } else { - dol_print_error($db,$object->error); + /* + * Affiche formulaire mail + */ + + // By default if $action=='presend' + $titreform='SendBillByMail'; + $topicmail='SendBillRef'; + $action='send'; + $modelmail='facture_send'; + + if ($action == 'prerelance') // For backward compatibility + { + $titrefrom='SendReminderBillByMail'; + $topicmail='SendReminderBillRef'; + $action='relance'; + $modelmail='facture_relance'; + } + + $ref = dol_sanitizeFileName($object->ref); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); + $file=$fileparams['fullname']; + + // Build document if it not exists + if (! $file || ! is_readable($file)) + { + // Define output language + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $result=facture_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/')); + $file=$fileparams['fullname']; + } + + print '
'; + print_titre($langs->trans($titreform)); + + // Cree l'objet formulaire mail + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->fromtype = 'user'; + $formmail->fromid = $user->id; + $formmail->fromname = $user->getFullName($langs); + $formmail->frommail = $user->email; + $formmail->withfrom=1; + $liste=array(); + foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value; + $formmail->withto=GETPOST('sendto')?GETPOST('sendto'):$liste; + $formmail->withtocc=$liste; + $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; + if(empty($object->ref_client)) + { + $formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__'); + } + else if(!empty($object->ref_client)) + { + $formmail->withtopic=$langs->transnoentities($topicmail,'__FACREF__(__REFCLIENT__)'); + } + $formmail->withfile=2; + $formmail->withbody=1; + $formmail->withdeliveryreceipt=1; + $formmail->withcancel=1; + // Tableau des substitutions + $formmail->substit['__FACREF__']=$object->ref; + $formmail->substit['__SIGNATURE__']=$user->signature; + $formmail->substit['__REFCLIENT__']=$object->ref_client; + $formmail->substit['__PERSONALIZED__']=''; + $formmail->substit['__CONTACTCIVNAME__']=''; + + //Find the good contact adress + $custcontact=''; + $contactarr=array(); + $contactarr=$object->liste_contact(-1,'external'); + + if (is_array($contactarr) && count($contactarr)>0) { + foreach($contactarr as $contact) { + if ($contact['libelle']==$langs->trans('TypeContact_facture_external_BILLING')) { + + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + + $contactstatic=new Contact($db); + $contactstatic->fetch($contact['id']); + $custcontact=$contactstatic->getFullName($langs,1); + } + } + + if (!empty($custcontact)) { + $formmail->substit['__CONTACTCIVNAME__']=$custcontact; + } + } + + + // Tableau des parametres complementaires du post + $formmail->param['action']=$action; + $formmail->param['models']=$modelmail; + $formmail->param['facid']=$object->id; + $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + + // Init list of files + if (GETPOST("mode")=='init') + { + $formmail->clear_attached_files(); + $formmail->add_attached_files($file,basename($file),dol_mimetype($file)); + } + + $formmail->show_form(); + + print '
'; } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 315a2b9edff..73403fd0755 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -999,6 +999,9 @@ class Contrat extends CommonObject $pu=$pu_ttc; } + // Check parameters + if (empty($remise_percent)) $remise_percent=0; + // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index f096cac29c7..4a919ece44c 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -158,9 +158,9 @@ if (GETPOST('remonth') && GETPOST('reday') && GETPOST('reyear')) $datecontrat = dol_mktime(GETPOST('rehour'), GETPOST('remin'), 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); } +// Add contract if ($action == 'add' && $user->rights->contrat->creer) { - // Check if (empty($datecontrat)) { @@ -339,9 +339,30 @@ else if ($action == 'classin' && $user->rights->contrat->creer) $object->setProject(GETPOST('projectid')); } +// Add a new line else if ($action == 'addline' && $user->rights->contrat->creer) { - if (! GETPOST('qty')) + // Set if we used free entry or predefined product + 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')) + { + $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 = ''; + } + $qty = GETPOST('qty'.$predef); + $remise_percent=GETPOST('remise_percent'.$predef); + + if ($qty == '') { setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")),'errors'); $error++; @@ -362,41 +383,19 @@ else if ($action == 'addline' && $user->rights->contrat->creer) } $ret=$object->fetch_thirdparty(); - $date_start=''; - $date_end=''; - // Si ajout champ produit libre - if (GETPOST('mode') == 'libre') - { - if (GETPOST('date_start_slmonth') && GETPOST('date_start_slday') && GETPOST('date_start_slyear')) - { - $date_start=dol_mktime(GETPOST('date_start_slhour'), GETPOST('date_start_slmin'), 0, GETPOST('date_start_slmonth'), GETPOST('date_start_slday'), GETPOST('date_start_slyear')); - } - if (GETPOST('date_end_slmonth') && GETPOST('date_end_slday') && GETPOST('date_end_slyear')) - { - $date_end=dol_mktime(GETPOST('date_end_slhour'), GETPOST('date_end_slmin'), 0, GETPOST('date_end_slmonth'), GETPOST('date_end_slday'), GETPOST('date_end_slyear')); - } - } - // Si ajout champ produit predefini - if (GETPOST('mode') == 'predefined') - { - if (GETPOST('date_startmonth') && GETPOST('date_startday') && GETPOST('date_startyear')) - { - $date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - } - if (GETPOST('date_endmonth') && GETPOST('date_endday') && GETPOST('date_endyear')) - { - $date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); - } - } + // Clean parameters + $date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); + $date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); + $price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT'); // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit // Ecrase $base_price_type par celui du produit - if (GETPOST('idprod')) + if ($idprod > 0) { $prod = new Product($db); - $prod->fetch(GETPOST('idprod')); + $prod->fetch($idprod); $tva_tx = get_default_tva($mysoc,$object->thirdparty,$prod->id); $tva_npr = get_default_npr($mysoc,$object->thirdparty,$prod->id); @@ -426,22 +425,21 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU'); } else - { + { $pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU'); } } - $desc = $prod->description; - $desc.= $prod->description && GETPOST('np_desc') ? "\n" : ""; - $desc.= GETPOST('np_desc'); + $desc=$prod->description; + $desc=dol_concatdesc($desc,$product_desc); } else - { + { $pu_ht=GETPOST('price_ht'); $price_base_type = 'HT'; $tva_tx=GETPOST('tva_tx')?str_replace('*','',GETPOST('tva_tx')):0; // tva_tx field may be disabled, so we use vat rate 0 $tva_npr=preg_match('/\*/',GETPOST('tva_tx'))?1:0; - $desc=GETPOST('dp_desc'); + $desc=$product_desc; } $localtax1_tx=get_localtax($tva_tx,1,$object->societe); @@ -457,23 +455,23 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - if($price_min && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min))) + if($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))) { $object->error = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); $result = -1 ; } else - { + { // Insert line $result = $object->addline( $desc, $pu_ht, - GETPOST('qty'), + $qty, $tva_tx, $localtax1_tx, $localtax2_tx, - GETPOST('idprod'), - GETPOST('remise_percent'), + $idprod, + $remise_percent, $date_start, $date_end, $price_base_type, @@ -506,7 +504,6 @@ else if ($action == 'addline' && $user->rights->contrat->creer) unset($_POST['qty']); unset($_POST['type']); - unset($_POST['idprod']); unset($_POST['remise_percent']); unset($_POST['price_ht']); unset($_POST['price_ttc']); @@ -516,6 +513,16 @@ else if ($action == 'addline' && $user->rights->contrat->creer) unset($_POST['product_desc']); unset($_POST['fournprice']); unset($_POST['buying_price']); + 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']); } else { @@ -948,7 +955,7 @@ else if ($action == 'delete') { print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1); - + } /* @@ -969,7 +976,7 @@ else $text=$langs->trans('ConfirmValidateContract',$numref); print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1); - + } /* @@ -978,7 +985,7 @@ else if ($action == 'close') { print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1); - + } /* @@ -1306,6 +1313,7 @@ else } print ""; + print "\n"; @@ -1472,6 +1480,7 @@ else * Desactiver la ligne de contrat */ print '
'; + print ''; print ''; @@ -1525,13 +1534,22 @@ else } //print '
'; + // Form to add new line if ($user->rights->contrat->creer && ($object->statut >= 0)) { $dateSelector=1; - print '
'; - print ''; // Array with (n*2)+1 lines + print "\n"; + print ' + + + + + '; + + print '
'; + print '
'; // Array with (n*2)+1 lines // Trick to not show product entries $savproductenabled=$conf->product->enabled; @@ -1567,13 +1585,12 @@ else // Restore correct setup $conf->product->enabled = $savproductenabled; - print ''; - print '
'; + + print ''; } - - print ''; + dol_fiche_end(); /* @@ -1642,11 +1659,13 @@ llxFooter(); $db->close(); ?> + margin->enabled) { +if ($conf->margin->enabled && $action == 'editline') +{ ?> + - + + diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index cf47c22d1fa..806a745e20b 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -33,7 +33,7 @@ * @param string $urloption More parameters on URL request * @param int $minLength Minimum number of chars to trigger that Ajax search * @param int $autoselect Automatic selection if just one value - * @param array $ajaxoptions Multiple options array + * @param array $ajaxoptions Multiple options array (Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done * @return string Script */ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index 214b1ac1472..5a9d17e217d 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -32,12 +32,6 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob -
"> - - - - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
@@ -116,7 +110,7 @@ else { tva_assuj == "0") echo '0'; + if ($seller->tva_assuj == "0") echo '0'; else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); ?> @@ -137,7 +131,7 @@ else { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { echo '%'; } - elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { + if (! empty($conf->global->DISPLAY_MARK_RATES)) { echo '%'; } } @@ -155,7 +149,7 @@ else { } ?> - + service->enabled) && $dateSelector) if (! empty($object->element) && $object->element == 'contrat') { print $langs->trans("DateStartPlanned").' '; - $form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl"); + $form->select_date('',"date_start",$usehm,$usehm,1,"addline_sl"); print '   '.$langs->trans("DateEndPlanned").' '; - $form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl"); + $form->select_date('',"date_end",$usehm,$usehm,1,"addline_sl"); } else { @@ -214,7 +208,6 @@ if (! empty($conf->service->enabled) && $dateSelector) } ?> - rights->margins->creer) @@ -223,34 +216,29 @@ if (! empty($usemargins) && $user->rights->margins->creer) -
id; ?>" method="POST"> - - - - - - - -global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay=2; } else { @@ -45,7 +38,11 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> > global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> -
+
+ + + + global->MAIN_FEATURES_LEVEL > 1) @@ -187,12 +184,15 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 3306e995d58..4816c94e26d 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -32,12 +32,6 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob -
"> - - - - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> - - % + + % - - "> + + "> rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { - echo '%'; + echo '%'; } - elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { - echo '%'; + if (! empty($conf->global->DISPLAY_MARK_RATES)) { + echo '%'; } } else @@ -163,7 +157,7 @@ else { } ?> - + service->enabled) && $dateSelector) if (! empty($object->element) && $object->element == 'contrat') { print $langs->trans("DateStartPlanned").' '; - $form->select_date('',"date_start",$usehm,$usehm,1,"addline"); + $form->select_date('',"date_start_predef",$usehm,$usehm,1,"addline"); print '   '.$langs->trans("DateEndPlanned").' '; - $form->select_date('',"date_end",$usehm,$usehm,1,"addline"); + $form->select_date('',"date_end_predef",$usehm,$usehm,1,"addline"); } else { @@ -221,7 +215,6 @@ if (! empty($conf->service->enabled) && $dateSelector) } ?> - rights->margins->creer) @@ -230,52 +223,48 @@ if (! empty($usemargins) && $user->rights->margins->creer) '; - $var=true; print ''; print ''; @@ -1611,14 +1642,20 @@ elseif (! empty($object->id)) print ''; print ''; print '%'; - print ''; + print ''; print ''; - print ''; - // Ajout de produits/services predefinis if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { + print ''; + print ''; print ''; print $langs->trans("AddNewLine").' - '; @@ -1636,21 +1673,16 @@ elseif (! empty($object->id)) print ' '; print ''; - print '
'; - print ''; - print ''; - print ''; - $var=!$var; print ''; print ''; $ajaxoptions=array( - 'update' => array('pqty' => 'qty', 'p_remise_percent' => 'discount'), + 'update' => array('qty_predef' => 'qty_predef', 'remise_percent_predef' => 'remise_percent_predef'), 'option_disabled' => 'addPredefinedProductButton', 'error' => $langs->trans("NoPriceDefinedForThisSupplier") ); - $form->select_produits_fournisseurs($object->fourn_id, '', 'idprodfournprice', '', '', $ajaxoptions); + $form->select_produits_fournisseurs($object->fourn_id, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions); if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '
'; @@ -1666,16 +1698,17 @@ elseif (! empty($object->id)) $doleditor->Create(); print ''; - print ''; - print '%'; - print ''; + print ''; + print '%'; + print ''; print ''; - - print '
'; } } print ''; - print ''; + + print ''; + + dol_fiche_end(); if ($action != 'presend') @@ -1683,7 +1716,7 @@ elseif (! empty($object->id)) /** * Boutons actions */ - if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete') + if ($user->societe_id == 0 && $action != 'edit_line' && $action != 'delete') { print '
'; @@ -1801,9 +1834,9 @@ elseif (! empty($object->id)) * Linked object block */ $somethingshown=$object->showLinkedObjectBlock(); - + print '
'; - + // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index b6a232c2f54..18c515ac34e 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -477,7 +477,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) } // Modification d'une ligne -elseif ($action == 'update_line') +elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) { if (GETPOST('etat') == '1' && ! GETPOST('cancel')) // si on valide la modification { @@ -524,8 +524,32 @@ elseif ($action == 'update_line') } } -elseif ($action == 'addline') +elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) { + $langs->load('errors'); + $error=0; + + // Set if we used free entry or predefined product + 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')) + { + $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 = ''; + } + $qty = GETPOST('qty'.$predef); + $remise_percent=GETPOST('remise_percent'.$predef); + + $ret=$object->fetch($id); if ($ret < 0) { @@ -534,10 +558,10 @@ elseif ($action == 'addline') } $ret=$object->fetch_thirdparty(); - if (GETPOST('search_idprodfournprice') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1, with autocomplete, idprodfournprice is > 0 or '' + if (GETPOST('addline_predefined') || GETPOST('search_idprodfournprice') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' { $idprod=0; - $product=new Product($db); + $productsupplier=new ProductFournisseur($db); if (GETPOST('idprodfournprice') == '') { @@ -545,33 +569,39 @@ elseif ($action == 'addline') } if (GETPOST('idprodfournprice') > 0) { - $idprod=$product->get_buyprice(GETPOST('idprodfournprice'), $_POST['qty']); // Just to see if a price exists for the quantity. Not used to found vat + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat } if ($idprod > 0) { - $result=$product->fetch($idprod); + $result=$productsupplier->fetch($idprod); - // cas special pour lequel on a les meme reference que le fournisseur - // $label = '['.$product->ref.'] - '. $product->libelle; - $label = $product->description; - $label.= $product->description && $_POST['np_desc'] ? "\n" : ""; - $label.= $_POST['np_desc']; + $label = $productsupplier->libelle; - $tvatx=get_default_tva($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']); - $npr = get_default_npr($object->thirdparty, $mysoc, $product->id, $_POST['idprodfournprice']); + $desc = $productsupplier->description; + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); + + $tvatx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); + $npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); - $remise_percent=GETPOST('remise_percent'); - $type = $product->type; - $result=$object->addline($label, $product->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $_POST['qty'], $idprod, $remise_percent, '', '', 0, $npr); + $type = $productsupplier->type; + $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); + } + if ($idprod == 0) + { + // Product not selected + $error++; + $langs->load("errors"); + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ProductOrService")).'
'; } if ($idprod == -1) { // Quantity too low + $error++; $langs->load("errors"); $mesg='
'.$langs->trans("ErrorQtyTooLowForThisSupplier").'
'; } @@ -583,35 +613,37 @@ elseif ($action == 'addline') $tauxtva = price2num($tauxtva); $localtax1tx= get_localtax($tauxtva, 1, $mysoc,$object->thirdparty); $localtax2tx= get_localtax($tauxtva, 2, $mysoc,$object->thirdparty); - $remise_percent=GETPOST('remise_percent'); - if (! $_POST['dp_desc']) + if (! $product_desc) { + $error++; $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")).'
'; } else - { + { $type = $_POST["type"]; - if (! empty($_POST['amount'])) + + if (! empty($_POST['amount'])) { $ht = price2num($_POST['amount']); $price_base_type = 'HT'; - //$desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0) - $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva, $localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 + $result=$object->addline($product_desc, $ht, $tauxtva, $localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } else { $ttc = price2num($_POST['amountttc']); $ht = $ttc / (1 + ($tauxtva / 100)); $price_base_type = 'HT'; - $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva,$localtax1tx, $localtax2tx, $_POST['qty'], 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); + //print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0 + $result=$object->addline($product_desc, $ht, $tauxtva,$localtax1tx, $localtax2tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type); } } } //print "xx".$tva_tx; exit; - if ($result > 0) + if (! $error && $result > 0) { // Define output language $outputlangs = $langs; @@ -622,7 +654,8 @@ elseif ($action == 'addline') $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -633,15 +666,20 @@ elseif ($action == 'addline') unset($_POST['qty']); unset($_POST['type']); - unset($_POST['idprodfournprice']); unset($_POST['remise_percent']); unset($_POST['dp_desc']); - unset($_POST['np_desc']); unset($_POST['pu']); unset($_POST['tva_tx']); unset($_POST['label']); unset($localtax1_tx); unset($localtax2_tx); + + unset($_POST['idprodfournprice']); + unset($_POST['qty_predef']); + unset($_POST['remise_percent_predef']); + unset($_POST['fournprice_predef']); + unset($_POST['buying_price_predef']); + unset($_POST['np_desc']); } else if (empty($mesg)) { @@ -1103,6 +1141,7 @@ if ($action == 'create') print ''; print ''; print ''; + print ''; // Ref @@ -1374,6 +1413,7 @@ else */ $head = facturefourn_prepare_head($object); $titre=$langs->trans('SupplierInvoice'); + dol_fiche_head($head, 'card', $titre, 0, 'bill'); dol_htmloutput_mesg($mesg); @@ -1542,7 +1582,7 @@ else { if ($societe->localtax1_assuj=="1") $nbrows++; if ($societe->localtax2_assuj=="1") $nbrows++; - } + } print '
'; $sql = 'SELECT p.datep as dp, p.num_paiement, p.rowid, p.fk_bank,'; @@ -1790,8 +1830,21 @@ else /* * Lines */ + + + print '
id.(($action != 'edit_line')?'#add':'#line_'.GETPOST('lineid')).'" method="POST"> + + + + + + + + '; + + print '
'; - print ''; + print '
'; $var=1; $num=count($object->lines); for ($i = 0; $i < $num; $i++) @@ -1833,13 +1886,13 @@ else // Edit line if ($object->statut == 0 && $action == 'edit_line' && $_GET['etat'] == '0' && $_GET['lineid'] == $object->lines[$i]->rowid) { - print 'lines[$i]->rowid.'" method="post">'; - print ''; - print ''; print ''; // Show product and description print ''; - print ''; print ''; - print ''; } else // Affichage simple de la ligne { @@ -1972,7 +2024,7 @@ else /* * Form to add new line - */ + */ if ($object->statut == 0 && $action != 'edit_line') { @@ -1992,11 +2044,6 @@ else print ''; // Add free products/services form - print ''; - print ''; - print ''; - print ''; - $var=true; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; - print ''; - print ''; + print ''; // Ajout de produits/services predefinis if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { + print ''; + print ''; print ''; print ''; - // TODO Use the predefinedproductline_create.tpl.php file - print ''; - print ''; - print ''; - print ''; - - print ''; - $var=! $var; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; - print ''; } } print '
'; + + print ''; + if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product) { print ''; @@ -1888,11 +1941,10 @@ else print ' '; + print ''; print '
'; @@ -2022,23 +2069,30 @@ else print $form->load_tva('tauxtva',(GETPOST('tauxtva')?GETPOST('tauxtva'):-1),$societe,$mysoc); print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print '%  
'; print $langs->trans("AddNewLine").' - '; @@ -2057,30 +2111,16 @@ else print ' 
'; $ajaxoptions=array( - 'update' => array('pqty' => 'qty', 'p_remise_percent' => 'discount'), + 'update' => array('qty_predef' => 'qty_predef', 'remise_percent_predef' => 'remise_percent_predef'), 'disabled' => 'addPredefinedProductButton', 'error' => $langs->trans("NoPriceDefinedForThisSupplier") ); - $form->select_produits_fournisseurs($object->socid, '', 'idprodfournprice', '', '', $ajaxoptions); + $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions); if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '
'; @@ -2096,19 +2136,21 @@ else $doleditor->Create(); print '
%%  
'; - print ''; + print ''; + + dol_fiche_end(); + if ($action != 'presend') { From 56867b6fd9a6fbd1c8953e6f674c2cdac07cd393 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Nov 2013 23:45:17 +0100 Subject: [PATCH 22/45] Fix: Removed duplicate tests --- test/phpunit/WebservicesOrdersTest.php | 178 ------------------------- 1 file changed, 178 deletions(-) diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index c3e382a85e7..787a6086c27 100755 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -174,183 +174,5 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase return $result; } - - - /** - * testWSOtherGetVersions - * - * @return int - */ - public function testWSOtherGetVersions() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_other.php'; - $WS_METHOD = 'getVersions'; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - $result=''; - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__." call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
\n\n"; - print $soapclient->request; - print "
\n\n"; - print $soapclient->response; - } - - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); - } - - return $result; - } - - - /** - * testWSThirdparty - * - * @return int - */ - public function testWSThirdparty() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_thirdparty.php'; - $WS_METHOD = ''; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__."create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - $result=''; - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__." call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
\n\n"; - print $soapclient->request; - print "
\n\n"; - print $soapclient->response; - } - - print __METHOD__." result=".$result."\n"; - $this->assertEquals('OK',$result['result']['result_code']); - } - - return $result; - } - - - /** - * testWSUser - * - * @return int - */ - public function testWSUser() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $WS_DOL_URL = DOL_MAIN_URL_ROOT.'/webservices/server_user.php'; - $WS_METHOD = ''; - $ns='http://www.dolibarr.org/ns/'; - - // Set the WebService URL - print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; - $soapclient = new nusoap_client($WS_DOL_URL); - if ($soapclient) - { - $soapclient->soap_defencoding='UTF-8'; - $soapclient->decodeUTF8(false); - } - - // Call the WebService method and store its result in $result. - $authentication=array( - 'dolibarrkey'=>$conf->global->WEBSERVICES_KEY, - 'sourceapplication'=>'DEMO', - 'login'=>'admin', - 'password'=>'admin', - 'entity'=>''); - - // Test URL - $result=''; - if ($WS_METHOD) - { - $parameters = array('authentication'=>$authentication); - print __METHOD__." call method ".$WS_METHOD."\n"; - $result = $soapclient->call($WS_METHOD,$parameters,$ns,''); - if (! $result) - { - //var_dump($soapclient); - print $soapclient->error_str; - print "
\n\n"; - print $soapclient->request; - print "
\n\n"; - print $soapclient->response; - } - - print __METHOD__." result=".$result."\n"; - //$this->assertEquals('OK',$result['result']['result_code']); - } - - return $result; - } - } ?> \ No newline at end of file From afa5bdb837e34297d1986091d1a3c3f75f44eab1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 00:12:13 +0100 Subject: [PATCH 23/45] Fix: phpunit error --- .../class/companybankaccount.class.php | 86 ++++++++++--------- test/phpunit/CompanyBankAccountTest.php | 8 +- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 1cc32d1ff50..b40989336e9 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2010 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013 Peter Fontaine +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2010-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Peter Fontaine * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; /** - * \brief Class to manage bank accounts description of third parties + * Class to manage bank accounts description of third parties */ class CompanyBankAccount extends Account { @@ -232,48 +232,56 @@ class CompanyBankAccount extends Account /** * Set RIB as Default * - * @param int $id RIB id + * @param int $rid RIB id * @return int 0 if KO, 1 if OK */ - function setAsDefault($id) + function setAsDefault($rib=0) { - if ($id) { - $sql1 = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; - $sql1.= " WHERE rowid = ".$id; + $sql1 = "SELECT rowid as id, fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; + $sql1.= " WHERE rowid = ".($rib?$rib:$this->id); - $result1 = $this->db->query($sql1); - if ($result1) { - if ($this->db->num_rows($result1) == 0) { - return 0; - } else { - $obj = $this->db->fetch_object($result1); - $sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0 "; - $sql2.= "WHERE fk_soc = ".$obj->fk_soc; + dol_syslog(get_class($this).'::setAsDefault sql='.$sql1); + $result1 = $this->db->query($sql1); + if ($result1) + { + if ($this->db->num_rows($result1) == 0) + { + return 0; + } + else + { + $obj = $this->db->fetch_object($result1); - $sql3 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 1 "; - $sql3.= "WHERE rowid = ".$id; + $this->db->begin(); - $this->db->begin(); + $sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0 "; + $sql2.= "WHERE fk_soc = ".$obj->fk_soc; + dol_syslog(get_class($this).'::setAsDefault sql='.$sql2); + $result2 = $this->db->query($sql2); - $result2 = $this->db->query($sql2); - $result3 = $this->db->query($sql3); + $sql3 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 1 "; + $sql3.= "WHERE rowid = ".$obj->id; + dol_syslog(get_class($this).'::setAsDefault sql='.$sql3); + $result3 = $this->db->query($sql3); - if (!$result2 || !$result3) { - dol_print_error($this->db); - $this->db->rollback(); - return 0; - } else { - $this->db->commit(); - return 1; - } - } - } else { - dol_print_error($this->db); - return 0; - } - } else { - return 0; - } + if (!$result2 || !$result3) + { + dol_print_error($this->db); + $this->db->rollback(); + return -1; + } + else + { + $this->db->commit(); + return 1; + } + } + } + else + { + dol_print_error($this->db); + return -1; + } } } diff --git a/test/phpunit/CompanyBankAccountTest.php b/test/phpunit/CompanyBankAccountTest.php index c85bb8272b5..04925ddd603 100644 --- a/test/phpunit/CompanyBankAccountTest.php +++ b/test/phpunit/CompanyBankAccountTest.php @@ -131,9 +131,9 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase $localobject->initAsSpecimen(); $result=$localobject->create($user); + print __METHOD__." result=".$result." id=".$localobject->id."\n"; $this->assertLessThan($result, 0); - print __METHOD__." result=".$result."\n"; - return $result; + return $localobject->id; } /** @@ -155,9 +155,8 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase $localobject=new CompanyBankAccount($this->savdb); $result=$localobject->fetch($id); - - $this->assertLessThan($result, 0); print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); return $localobject; } @@ -178,7 +177,6 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase $db=$this->savdb; $result=$localobject->setAsDefault($localobject->id); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); return $localobject; From 4356496ee85ae6392358f2874f86ddceaebbd531 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 00:20:05 +0100 Subject: [PATCH 24/45] Qual: File is not a class of a module --- htdocs/core/class/html.formfile.class.php | 14 +-- htdocs/{link => core}/class/link.class.php | 94 +++++++++++-------- htdocs/core/lib/files.lib.php | 8 +- .../tpl/document_actions_pre_headers.tpl.php | 30 +++--- 4 files changed, 79 insertions(+), 67 deletions(-) rename htdocs/{link => core}/class/link.class.php (88%) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 45221876e91..189cec49f80 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1051,7 +1051,7 @@ class FormFile global $bc; global $sortfield, $sortorder; - require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; $link = new Link($this->db); $links = array(); if ($sortfield == "name") { @@ -1066,9 +1066,9 @@ class FormFile // Show list of associated links print_titre($langs->trans("LinkedFiles")); - + print '
'; - + print ''; print ''; print_liste_field_titre( @@ -1113,12 +1113,12 @@ class FormFile if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $var = true; - foreach ($links as $link) + foreach ($links as $link) { $var =! $var; print ''; //edit mode - if ($action == 'update' && $selected === $link->id) + if ($action == 'update' && $selected === $link->id) { print '\n"; } - if ($nboflinks == 0) + if ($nboflinks == 0) { print '
'; print ''; @@ -1157,7 +1157,7 @@ class FormFile } print "
'; print $langs->trans("NoLinkFound"); @@ -1166,7 +1166,7 @@ class FormFile print "
"; print '
'; - + return $nboflinks; } diff --git a/htdocs/link/class/link.class.php b/htdocs/core/class/link.class.php similarity index 88% rename from htdocs/link/class/link.class.php rename to htdocs/core/class/link.class.php index 0bb57c52cf6..8100d526718 100644 --- a/htdocs/link/class/link.class.php +++ b/htdocs/core/class/link.class.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/link/class/link.class.php + * \file htdocs/core/class/link.class.php * \ingroup link * \brief File for link class */ @@ -39,6 +39,7 @@ class Link extends CommonObject public $objecttype; public $objectid; + /** * Constructor * @@ -102,9 +103,9 @@ class Link extends CommonObject include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers('LINK_CREATE', $this, $user, $langs, $conf); - if ($result < 0) { - $error++; - $this->errors = $interface->errors; + if ($result < 0) { + $error++; + $this->errors = $interface->errors; } // Fin appel triggers } else { @@ -161,12 +162,12 @@ class Link extends CommonObject dol_syslog(get_class($this)."::Update id = " . $this->id . " call_trigger = " . $call_trigger); // Check parameters - if (empty($this->url)) + if (empty($this->url)) { $this->error = $langs->trans("NoURL"); return -1; } - + // Clean parameters $this->url = clean_url($this->url,1); if (empty($this->label)) $this->label = basename($this->url); @@ -176,7 +177,7 @@ class Link extends CommonObject $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "links SET "; - $sql .= "entity = '" . $conf->entity ."'"; + $sql .= "entity = '" . $conf->entity ."'"; $sql .= ", datea = '" . $this->db->idate(dol_now()) . "'"; $sql .= ", url = '" . $this->db->escape($this->url) . "'"; $sql .= ", label = '" . $this->db->escape($this->label) . "'"; @@ -184,25 +185,24 @@ class Link extends CommonObject $sql .= ", objectid = " . $this->objectid; $sql .= " WHERE rowid = '" . $this->id ."'"; - - dol_syslog(get_class($this)."::Update sql = " .$sql); + dol_syslog(get_class($this)."::update sql = " .$sql); $resql = $this->db->query($sql); if ($resql) { - if ($call_trigger) + if ($call_trigger) { // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface = new Interfaces($this->db); $result = $interface->run_triggers('LINK_MODIFY', $this, $user, $langs, $conf); - if ($result < 0) { + if ($result < 0) { $error++; $this->errors = $interface->errors; } // Fin appel triggers } - if (! $error) + if (! $error) { dol_syslog(get_class($this) . "::Update success"); $this->db->commit(); @@ -211,16 +211,16 @@ class Link extends CommonObject $this->db->rollback(); return -1; } - } - else + } + else { - if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') + if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { // Doublon $this->error = $langs->trans("ErrorDuplicateField"); $result = -1; } - else + else { $this->error = $langs->trans("Error sql = " . $sql); dol_syslog(get_class($this) . "::Update fails update = " . $this->error, LOG_ERR); @@ -233,34 +233,39 @@ class Link extends CommonObject /** * Loads all links from database - * + * * @param array &$links array of Link objects to fill * @param string $objecttype type of the associated object in dolibarr * @param int $objectid id of the associated object in dolibarr * @param string $sortfield field used to sort * @param string $sortorder sort order * @return 1 if ok, 0 if no records, -1 if error - * + * * */ public function fetchAll(&$links, $objecttype, $objectid, $sortfield=null, $sortorder=null) { global $conf; + $sql = "SELECT rowid, entity, datea, url, label , objecttype, objectid FROM " . MAIN_DB_PREFIX . "links"; $sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid; - if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity; + if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity; if ($sortfield) { if (empty($sortorder)) { $sortorder = "ASC"; } $sql .= " ORDER BY " . $sortfield . " " . $sortorder; } + + dol_syslog(get_class($this)."::fetchAll sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); - dol_syslog(get_class($this)."::fetchAll " . $sql, LOG_DEBUG); - if ($resql) { + if ($resql) + { $num = $this->db->num_rows($resql); dol_syslog(get_class($this)."::fetchAll " . $num . "records", LOG_DEBUG); - if ($num > 0) { - while ($obj = $this->db->fetch_object($resql)) { + if ($num > 0) + { + while ($obj = $this->db->fetch_object($resql)) + { $link = new Link($db); $link->id = $obj->rowid; $link->entity = $obj->entity; @@ -281,25 +286,31 @@ class Link extends CommonObject } } - /* + /** * Loads a link from database - * @param rowid id of link to load - * @return int 1 if ok, 0 if no record found, -1 if error - * - * */ + * + * @param int $rowid Id of link to load + * @return int 1 if ok, 0 if no record found, -1 if error + * + **/ public function fetch($rowid=null) { global $conf; + if (empty($rowid)) { $rowid = $this->id; } + $sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links"; $sql .= " WHERE rowid = " . $rowid; if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity; + + dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); - dol_syslog(get_class($this)."::fetch " . $sql, LOG_DEBUG); - if ($resql) { - if($this->db->num_rows($resql) > 0) { + if ($resql) + { + if($this->db->num_rows($resql) > 0) + { $obj = $this->db->fetch_object($resql); $this->entity = $obj->entity; $this->datea = $this->db->jdate($obj->datea); @@ -308,14 +319,14 @@ class Link extends CommonObject $this->objecttype = $obj->objecttype; $this->objectid = $obj->objectid; return 1; - } else { - $this->error = 'Fetch no link found for id = ' . $rowid; - dol_syslog($this->error, LOG_ERR); + } + else + { return 0; } } else { - dol_syslog($this->db->error(), LOG_ERR); - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); + dol_syslog($this->error, LOG_ERR); return -1; } } @@ -335,11 +346,12 @@ class Link extends CommonObject $this->db->begin(); // Remove link - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "links"; $sql.= " WHERE rowid = " . $this->id; + dol_syslog(get_class($this)."::delete sql=" . $sql, LOG_DEBUG); - if (! $this->db->query($sql)) { + if (! $this->db->query($sql)) + { $error++; $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::delete error -4 " . $this->error, LOG_ERR); @@ -351,9 +363,9 @@ class Link extends CommonObject include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result = $interface->run_triggers('LINK_DELETE', $this, $user, $langs, $conf); - if ($result < 0) { - $error++; - $this->errors = $interface->errors; + if ($result < 0) { + $error++; + $this->errors = $interface->errors; } // Fin appel triggers } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 17d96bd3356..ae1cf90a393 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1011,12 +1011,12 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio // Define $destpath (path to file including filename) and $destfile (only filename) $destpath=$upload_dir . "/" . $_FILES[$varfiles]['name']; $destfile=$_FILES[$varfiles]['name']; - if ($savingdocmask) + if ($savingdocmask) { $destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); $destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); - } - + } + $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles); if (is_numeric($resupload) && $resupload > 0) { @@ -1058,7 +1058,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio } } elseif ($link) { if (dol_mkdir($upload_dir) >= 0) { - require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; $linkObject = new Link($db); $linkObject->entity = $conf->entity; $linkObject->url = $link; diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index 96344944666..06edca3c7c7 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -25,7 +25,7 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { } elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { if ($object->id) { $link = GETPOST('link', 'alpha'); - if ($link) + if ($link) { if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') { $link = 'http://' . $link; @@ -37,13 +37,13 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { // Delete file/link -if ($action == 'confirm_deletefile' && $confirm == 'yes') +if ($action == 'confirm_deletefile' && $confirm == 'yes') { - if ($object->id) + if ($object->id) { $urlfile = GETPOST('urlfile', 'alpha'); $linkid = GETPOST('linkid', 'int'); - if ($urlfile) + if ($urlfile) { $file = $upload_dir . "/" . $urlfile; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). @@ -53,10 +53,10 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') } else { setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors'); } - } - elseif ($linkid) + } + elseif ($linkid) { - require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; $link = new Link($db); $link->id = $linkid; $link->fetch(); @@ -71,29 +71,29 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); exit; } -} -elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha')) +} +elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha')) { - require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; $langs->load('link'); $link = new Link($db); $link->id = GETPOST('linkid', 'int'); $f = $link->fetch(); - if ($f) + if ($f) { $link->url = GETPOST('link', 'alpha'); - if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://') + if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://') { $link->url = 'http://' . $link->url; } $link->label = GETPOST('label', 'alpha'); $res = $link->update($user); - if (!$res) + if (!$res) { setEventMessage($langs->trans("ErrorFailedToUpdateLink", $link->label)); } - } - else + } + else { //error fetching } From d209d931e47d45d46c91e442ec0236a18093c5eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 00:29:11 +0100 Subject: [PATCH 25/45] Doxygen --- htdocs/societe/class/companybankaccount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index b40989336e9..8b8e3b382c7 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -232,7 +232,7 @@ class CompanyBankAccount extends Account /** * Set RIB as Default * - * @param int $rid RIB id + * @param int $rib RIB id * @return int 0 if KO, 1 if OK */ function setAsDefault($rib=0) From 5703dfe55a9b9e1a6295ef62bd5cc98598c2e9ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 11:31:34 +0100 Subject: [PATCH 26/45] Trans --- htdocs/langs/en_US/cron.lang | 3 ++- htdocs/langs/fr_FR/cron.lang | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 86943b910e9..80a29c14e9e 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -32,6 +32,7 @@ CronExplainHowToRunWin=On Microsoft(tm) Windows environement you can use Schedul CronJobs=Scheduled jobs CronListActive= List of active jobs CronListInactive= List of disabled jobs +CronListActive= List of scheduled jobs # @@ -42,7 +43,7 @@ CronLastOutput=Last run output CronLastResult=Last result code CronListOfCronJobs=List of scheduled jobs CronCommand=Command -CronList= Job list +CronList=Jobs list CronDelete= Delete cron jobs CronConfirmDelete= Are you sure you want to delete this cron job ? CronExecute=Launch job diff --git a/htdocs/langs/fr_FR/cron.lang b/htdocs/langs/fr_FR/cron.lang index d4e10c80fca..3659084ac4b 100644 --- a/htdocs/langs/fr_FR/cron.lang +++ b/htdocs/langs/fr_FR/cron.lang @@ -29,9 +29,10 @@ CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez uti # # Menu # -CronJobs=Travaux planifiés +CronJobs=Travaux programmés CronListActive= Liste des travaux actifs CronListInactive= Liste des travaux inactifs +CronListActive= Liste des travaux programmés # @@ -42,15 +43,15 @@ CronLastOutput=Sortie du dernier lancement CronLastResult=Dernier code de retour CronListOfCronJobs=Liste des travaux planifiés CronCommand=Commande -CronList= Liste des travaux -CronDelete= Supprimer les travaux cron -CronConfirmDelete= Êtes-vous sûr de vouloir supprimer ces travaux cron ? +CronList=Liste des travaux +CronDelete=Supprimer les travaux cron +CronConfirmDelete=Êtes-vous sûr de vouloir supprimer ces travaux cron ? CronExecute=Lancer cette tâche -CronConfirmExecute= Êtes-vous sûr de vouloir lancer ce travail maintenant? -CronInfo= Les travaux planifiés permettent d'exécuter des tâches à intervales réguliers +CronConfirmExecute=Êtes-vous sûr de vouloir lancer ce travail maintenant? +CronInfo=Les travaux planifiés permettent d'exécuter des tâches à intervales réguliers CronWaitingJobs=Travaux en attente CronTask=Tâche -CronNone= Aucun(e) +CronNone=Aucun(e) CronDtStart=Date de début CronDtEnd=Date de fin CronDtNextLaunch=Prochaine exécution From 2b63fd67b50e6623821a470fd317fb8f00beda7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 11:42:28 +0100 Subject: [PATCH 27/45] Minor fix in cron feature --- htdocs/langs/en_US/cron.lang | 4 ++-- htdocs/langs/fr_FR/cron.lang | 10 +++++----- htdocs/public/cron/cron_run_jobs.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 80a29c14e9e..bd4b72b8236 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -18,8 +18,8 @@ Permission23104 = Execute Scheduled task # Admin # CronSetup= Scheduled job management setup -URLToLaunchCronJobs=URL to launch cron jobs -OrToLaunchASpecificJob=Or to launch a specific job +URLToLaunchCronJobs=URL to check and launch cron jobs if required +OrToLaunchASpecificJob=Or to check and launch a specific job KeyForCronAccess=Security key for URL to launch cron jobs FileToLaunchCronJobs=Command line to launch cron jobs CronExplainHowToRunUnix=On Unix environment you should use crontab to run Command line each minutes diff --git a/htdocs/langs/fr_FR/cron.lang b/htdocs/langs/fr_FR/cron.lang index 3659084ac4b..77680202616 100644 --- a/htdocs/langs/fr_FR/cron.lang +++ b/htdocs/langs/fr_FR/cron.lang @@ -17,11 +17,11 @@ Permission23104 = Lancer un travail planifié # # Admin # -CronSetup= Page de configuration du module - Gestion des travaux planifiées -URLToLaunchCronJobs=URL pour lancer les travaux planifiés actifs -OrToLaunchASpecificJob=Ou pour lancer un travail planifié spécifique -KeyForCronAccess=Clé de sécurité pour l'URL de lancement des travaux planifiés -FileToLaunchCronJobs=Commande pour lancer les travaux planifiés actifs +CronSetup= Page de configuration du module - Gestion des travaux programmés +URLToLaunchCronJobs=URL pour vérifier et lancer les travaux programmés actifs +OrToLaunchASpecificJob=Ou pour vérifier et lancer un travail programmé spécifique +KeyForCronAccess=Clé de sécurité pour l'URL de lancement des travaux programmés +FileToLaunchCronJobs=Commande pour lancer les travaux programmés actifs CronExplainHowToRunUnix=Sur un environnement Unix vous pouvez utiliser 'crontab' pour exécuter une commande toute les minutes CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez utiliser le planificateur de tâche pour lancer une commande toute les minutes diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 7473720ed10..0f56be678a7 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -92,7 +92,7 @@ else exit; } } -$id = GETPOST('id','int'); +$id = GETPOST('id','alpha'); // We accept non numeric id. We will filter later. // create a jobs object From e8101e3cdedc295f2ffdd349623ebbbe3103ab8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 12:00:42 +0100 Subject: [PATCH 28/45] Fix: Missing field --- htdocs/install/mysql/migration/3.4.0-3.5.0.sql | 4 +++- htdocs/install/mysql/tables/llx_c_chargesociales.sql | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index a091e7f089c..2f322881431 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -83,7 +83,9 @@ ALTER TABLE llx_propaldet_extrafields ADD INDEX idx_propaldet_extrafields (fk_ob DROP table llx_adherent_options; DROP table llx_adherent_options_label; -ALTER TABLE llx_user ADD accountancy_code VARCHAR( 24 ) NULL; +ALTER TABLE llx_user ADD accountancy_code VARCHAR(24) NULL; +ALTER TABLE llx_c_chargesociales ADD accountancy_code varchar(24) DEFAULT NULL; + DELETE FROM llx_boxes where box_id IN (SELECT rowid FROM llx_boxes_def where file='box_activity.php' AND note IS NULL); DELETE FROM llx_boxes_def where file='box_activity.php' AND note IS NULL; diff --git a/htdocs/install/mysql/tables/llx_c_chargesociales.sql b/htdocs/install/mysql/tables/llx_c_chargesociales.sql index b6120f31932..b9c448e1d95 100644 --- a/htdocs/install/mysql/tables/llx_c_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_c_chargesociales.sql @@ -24,7 +24,7 @@ create table llx_c_chargesociales deductible smallint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, code varchar(12) NOT NULL, - accountancy_code varchar(15) DEFAULT NULL, + accountancy_code varchar(24) DEFAULT NULL, fk_pays integer DEFAULT 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; From 69f0d596ba0527548050d5e7d80f339f49d83abb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 12:20:53 +0100 Subject: [PATCH 29/45] Fix: Pagination --- htdocs/compta/charges/index.php | 59 +++++++++++++++---------------- htdocs/core/lib/functions.lib.php | 16 ++++----- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 909417d0e71..21d68d42663 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -65,28 +65,26 @@ llxHeader('',$langs->trans("TaxAndDividendsArea")); $title=$langs->trans("TaxAndDividendsArea"); if ($_GET["mode"] == 'sconly') $title=$langs->trans("SocialContributionsPayments"); -print_fiche_titre($title,($year?"".img_previous()." ".$langs->trans("Year")." $year ".img_next()."":"")); +$param=''; +if (GETPOST("mode") == 'sconly') $param='&mode=sconly'; +if ($sortfield) $param.='&sortfield='.$sortfield; +if ($sortorder) $param.='&sortorder='.$sortorder; -if ($_GET["mode"] != 'sconly') +print_fiche_titre($title, ($year?"".img_previous()." ".$langs->trans("Year")." $year ".img_next()."":"")); + +if ($year) $param.='&year='.$year; + +// Social contributions only +if (GETPOST("mode") != 'sconly') { print $langs->trans("DescTaxAndDividendsArea").'
'; print "
"; -} - -// Social contributions -if ($_GET["mode"] != 'sconly') -{ - print_titre($langs->trans("SocialContributionsPayments")); -} - -if ($_GET["mode"] == 'sconly') -{ - $param='&mode=sconly'; + print_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); } print ''; -print ""; +print ''; print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); @@ -110,10 +108,10 @@ if ($year > 0) // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire $sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; - $sql .= "OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; + $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= ")"; } -$sql.= $db->order($sortfield,$sortorder); +if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); //$sql.= $db->plimit($limit+1,$offset); //print $sql; @@ -184,18 +182,18 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') $tva = new Tva($db); - print_titre($langs->trans("VATPayments")); + print_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); - $sql = "SELECT f.rowid, f.amount, f.label, f.datev as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."tva as f "; - $sql.= " WHERE f.entity = ".$conf->entity; + $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."tva as pv"; + $sql.= " WHERE pv.entity = ".$conf->entity; if ($year > 0) { // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance, // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire - $sql.= " AND f.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; + $sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } - $sql.= " ORDER BY dm DESC"; + if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); $result = $db->query($sql); if ($result) @@ -205,12 +203,12 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') $total = 0 ; print '
'; print ''; - print ''; - print ""; - print '"; - print '"; - print '"; - print '"; + print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; while ($i < $num) @@ -227,12 +225,13 @@ if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') print '"; + // Ref payment $tva_static->id=$obj->rowid; $tva_static->ref=$obj->rowid; - print '\n"; + print '\n"; print '\n"; - print ""; + print '"; print "\n"; $i++; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a311c78b496..220721d6f5e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1212,7 +1212,7 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64) $newskype.=' '; $newskype.=dol_trunc($skype,$max); $newskype.=''; - + if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $type='AC_SKYPE'; $link=''; @@ -2372,7 +2372,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar * Get title line of an array * * @param string $name Label of field - * @param int $thead 0=To use with standard table forat, 1=To use inside , 2=To use with
+ * @param int $thead 0=To use with standard table forat, 1=To use inside
, 2=To use with
* @param string $file Url used when we click on sort picto * @param string $field Field to use for new sorting. Empty if this field is not sortable. * @param string $begin ("" by defaut) @@ -2392,7 +2392,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m $tag='th'; if ($thead==2) $tag='div'; - + // If field is used as sort criteria we use a specific class // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") if ($field && ($sortfield == $field || $sortfield == preg_replace("/^[^\.]+\./","",$field))) $out.= '<'.$tag.' class="liste_titre_sel" '. $moreattrib.'>'; @@ -2449,7 +2449,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m } /** - * Show a title (deprecated. use print_fiche_titre instrad) + * Show a title (deprecated. use print_fiche_titre instead) * * @param string $title Title to show * @return string Title to show @@ -2462,16 +2462,16 @@ function print_titre($title) /** * Show a title with picto * - * @param string $titre Title to show + * @param string $title Title to show * @param string $mesg Added message to show on right * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $id To force an id on html objects * @return void */ -function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='') +function print_fiche_titre($title, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='') { - print load_fiche_titre($titre, $mesg, $picto, $pictoisfullpath, $id); + print load_fiche_titre($title, $mesg, $picto, $pictoisfullpath, $id); } /** @@ -3004,7 +3004,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr $sql.= " WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$thirdparty_seller->country_code."'"; $sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC"; $sql.= $db->plimit(1); - + $resql=$db->query($sql); if ($resql) { From 2d260fa6dd848b17b793f2b267e3b63242ca5a4d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 14:25:53 +0100 Subject: [PATCH 30/45] Fix: Missing alignement --- htdocs/product/composition/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/composition/fiche.php b/htdocs/product/composition/fiche.php index fac6402e300..f770e48b715 100644 --- a/htdocs/product/composition/fiche.php +++ b/htdocs/product/composition/fiche.php @@ -376,7 +376,7 @@ if ($id > 0 || ! empty($ref)) print '
'; - print ''; + print ''; if (! empty($conf->stock->enabled)) print ''; print ''; print '
'.$langs->trans("PeriodEndDate").'".$langs->trans("Label")."'.$langs->trans("ExpectedToPay")."'.$langs->trans("RefPayment")."'.$langs->trans("DatePayment")."'.$langs->trans("PayedByThisPayment")."
'.price($obj->amount)."'.$tva_static->getNomUrl(1)."'.$tva_static->getNomUrl(1)."'.dol_print_date($db->jdate($obj->dm),'day')."".price($obj->amount)."'.price($obj->amount)."
'.$langs->trans("TotalBuyingPriceMin").': '; if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; print ''.($atleastonenotdefined?'':price($total,'','',0,0,-1,$conf->currency)).''.($atleastonenotdefined?'':price($total,'','',0,0,-1,$conf->currency)).' 
'; From 4d31a0ca2a93bc851e8821156bc6985509063b09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 14:27:17 +0100 Subject: [PATCH 31/45] Fix: Removed duplicate line --- .tx/config | 1 - 1 file changed, 1 deletion(-) diff --git a/.tx/config b/.tx/config index 6cad9c72c20..84e8e9f842f 100644 --- a/.tx/config +++ b/.tx/config @@ -7,7 +7,6 @@ file_filter = htdocs/langs//admin.lang source_file = htdocs/langs/en_US/admin.lang source_lang = en_US type = MOZILLAPROPERTIES -lang_map = uz_UZ: uz [dolibarr.agenda] file_filter = htdocs/langs//agenda.lang From a71e4c598a4e5e5f8f74496bd360f2f642c1ce05 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2013 15:41:42 +0100 Subject: [PATCH 32/45] Fix: Must navigate between all thirdparties elligible for tab. --- htdocs/comm/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 1e084406ae0..29ee792c738 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -202,7 +202,7 @@ if ($id > 0) print ''; print ''; From b28d15574e5b857191f6331c6c81b7819e4d1025 Mon Sep 17 00:00:00 2001 From: hameau Date: Mon, 18 Nov 2013 17:34:08 +0100 Subject: [PATCH 33/45] Update main.lang Minor typos; capitalise month names; minor fr->en. --- htdocs/langs/en_US/main.lang | 72 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index dc05a09916f..37be1d12b25 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1,13 +1,13 @@ # Dolibarr language file - Source file is en_US - main DIRECTION=ltr -# Note for chinese: -# msungstdlight or cid0ct are for traditionnal chinese (traditionnal does not render with ubuntu pdf reader) -# stsongstdlight or cid0cs are for simplified chinese -# To read chinese pdf with linux: sudo apt-get install poppler-data +# Note for Chinese: +# msungstdlight or cid0ct are for traditional Chinese (traditional does not render with Ubuntu pdf reader) +# stsongstdlight or cid0cs are for simplified Chinese +# To read Chinese pdf with Linux: sudo apt-get install poppler-data FONTFORPDF=helvetica FONTSIZEFORPDF=10 -SeparatorDecimal=, -SeparatorThousand=None +SeparatorDecimal=. +SeparatorThousand=, FormatDateShort=%m/%d/%Y FormatDateShortInput=%m/%d/%Y FormatDateShortJava=MM/dd/yyyy @@ -65,7 +65,7 @@ BackgroundColorByDefault=Default background color FileWasNotUploaded=A file is selected for attachment but was not yet uploaded. Click on "Attach file" for this. NbOfEntries=Nb of entries GoToWikiHelpPage=Read online help (need Internet access) -GoToHelpPage=Read help +GoToHelpPage=Read help RecordSaved=Record saved RecordDeleted=Record deleted LevelOfFeature=Level of features @@ -226,7 +226,7 @@ DateValueShort=Value date DateOperation=Operation date DateOperationShort=Oper. Date DateLimit=Limit date -DateRequest=Request date +DateRequest=Request date DateProcess=Process date DatePlanShort=Date planed DateRealShort=Date real. @@ -447,30 +447,30 @@ SeptemberMin=Sep OctoberMin=Oct NovemberMin=Nov DecemberMin=Dec -Month01=january -Month02=february -Month03=march -Month04=april -Month05=may -Month06=june -Month07=july -Month08=august -Month09=september -Month10=october -Month11=november -Month12=december -MonthShort01=jan -MonthShort02=feb -MonthShort03=mar -MonthShort04=apr -MonthShort05=may -MonthShort06=jun -MonthShort07=jul -MonthShort08=aug -MonthShort09=sep -MonthShort10=oct -MonthShort11=nov -MonthShort12=dec +Month01=January +Month02=February +Month03=March +Month04=April +Month05=May +Month06=June +Month07=July +Month08=August +Month09=September +Month10=October +Month11=November +Month12=December +MonthShort01=Jan +MonthShort02=Feb +MonthShort03=Mar +MonthShort04=Apr +MonthShort05=May +MonthShort06=Jun +MonthShort07=Jul +MonthShort08=Aug +MonthShort09=Sep +MonthShort10=Oct +MonthShort11=Nov +MonthShort12=Dec AttachedFiles=Attached files and documents FileTransferComplete=File was uploaded successfuly DateFormatYYYYMM=YYYY-MM @@ -607,7 +607,7 @@ MenuManager=Menu manager NoMenu=No sub-menu WarningYouAreInMaintenanceMode=Warning, you are in a maintenance mode, so only login %s is allowed to use application at the moment. CoreErrorTitle=System error -CoreErrorMessage=Sorry, an error occurred. Check the logs or contact your system administrator. +CoreErrorMessage=Sorry, an error occurred. Check the logs or contact your system administrator. CreditCard=Credit card FieldsWithAreMandatory=Fields with %s are mandatory FieldsWithIsForPublic=Fields with %s are shown on public list of members. If you don't want this, check off the "public" box. @@ -632,7 +632,7 @@ IM=Instant messaging NewAttribute=New attribute AttributeCode=Attribute code OptionalFieldsSetup=Extra attributes setup -URLPhoto=Url of photo/logo +URLPhoto=URL of photo/logo SetLinkToThirdParty=Link to another third party CreateDraft=Create draft ClickToEdit=Click to edit @@ -642,7 +642,7 @@ ByTown=By town ByDate=By date ByMonthYear=By month/year ByYear=By year -ByMonth=by month +ByMonth=By month ByDay=By day BySalesRepresentative=By sales representative LinkedToSpecificUsers=Linked to a particular user contact @@ -660,7 +660,7 @@ toward=toward Access=Access HelpCopyToClipboard=Use Ctrl+C to copy to clipboard SaveUploadedFileWithMask=Save file on server with name "%s" (otherwise "%s") -OriginFileName=Nom d'origine +OriginFileName=Original filename # Week day Monday=Monday From 0501491475bd8bf64eafbc503d68422ad1fd1f68 Mon Sep 17 00:00:00 2001 From: hameau Date: Mon, 18 Nov 2013 17:45:19 +0100 Subject: [PATCH 34/45] Update printipp.lang Minor typos; minor translation fr->en. --- htdocs/langs/en_US/printipp.lang | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/printipp.lang b/htdocs/langs/en_US/printipp.lang index 9df63bd9961..cc719fddded 100644 --- a/htdocs/langs/en_US/printipp.lang +++ b/htdocs/langs/en_US/printipp.lang @@ -1,9 +1,9 @@ # Dolibarr language file - Source file is en_US - printipp -PrintIPPSetup=Setup of module Direct Print -PrintIPPDesc=Ce module permet d'ajouter un bouton d'impression direct des documents vers votre imprimante. Il requiert un systeme Linux équipé de Cups. -PRINTIPP_ENABLED=Show picto "Direct print" into list of documents +PrintIPPSetup=Setup of Direct Print module +PrintIPPDesc=This module adds a Print button to send documents directly to a printer. It requires a Linux system with CUPS installed. +PRINTIPP_ENABLED=Show "Direct print" icon in document lists PRINTIPP_HOST=Print server PRINTIPP_PORT=Port PRINTIPP_USER=Login PRINTIPP_PASSWORD=Password -NoPrinterFound=No printers found (check your Cups etup) +NoPrinterFound=No printers found (check your CUPS setup) From c04d454d4f1b4bad724a2eb5c8ede0fb9eac6242 Mon Sep 17 00:00:00 2001 From: hameau Date: Mon, 18 Nov 2013 18:05:36 +0100 Subject: [PATCH 35/45] Update withdrawals.lang Minor typos. --- htdocs/langs/en_US/withdrawals.lang | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 2d1ba3584c3..91d4a473d6e 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -18,8 +18,8 @@ RequestStandingOrderToTreat=Request for standing orders to treat RequestStandingOrderTreated=Request for standing orders treated CustomersStandingOrders=Customer standing orders CustomerStandingOrder=Customer standing order -NbOfInvoiceToWithdraw=Nb of invoice with withdraw request -NbOfInvoiceToWithdrawWithInfo=Nb of invoice with withdraw request for customers having defined bank account information +NbOfInvoiceToWithdraw=No. of invoice with withdraw request +NbOfInvoiceToWithdrawWithInfo=No. of invoice with withdraw request for customers having defined bank account information InvoiceWaitingWithdraw=Invoice waiting for withdraw AmountToWithdraw=Amount to withdraw WithdrawsRefused=Withdraws refused @@ -34,14 +34,14 @@ ThirdPartyBankCode=Third party bank code ThirdPartyDeskCode=Third party desk code NoInvoiceCouldBeWithdrawed=No invoice withdrawed with success. Check that invoice are on companies with a valid BAN. ClassCredited=Classify credited -ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account ? -TransData=Date Transmission -TransMetod=Method Transmission +ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account? +TransData=Transmission date +TransMetod=Transmission method Send=Send Lines=Lines -StandingOrderReject=Issue a reject +StandingOrderReject=Issue a rejection InvoiceRefused=Invoice refused -WithdrawalRefused=Withdrawal Refused +WithdrawalRefused=Withdrawal refused WithdrawalRefusedConfirm=Are you sure you want to enter a withdrawal rejection for society RefusedData=Date of rejection RefusedReason=Reason for rejection @@ -51,15 +51,15 @@ InvoiceRefused=Charge the rejection to customer Status=Status StatusUnknown=Unknown StatusWaiting=Waiting -StatusTrans=Transmitted +StatusTrans=Sent StatusCredited=Credited StatusRefused=Refused StatusMotif0=Unspecified -StatusMotif1=Provision insuffisante -StatusMotif2=Tirage conteste +StatusMotif1=Insufficient funds +StatusMotif2=Request contested StatusMotif3=No Withdrawal order StatusMotif4=Customer Order -StatusMotif5=RIB inexploitable +StatusMotif5=RIB unusable StatusMotif6=Account without balance StatusMotif7=Judicial Decision StatusMotif8=Other reason @@ -78,18 +78,18 @@ BankToReceiveWithdraw=Bank account to receive withdraws CreditDate=Credit on WithdrawalFileNotCapable=Unable to generate withdrawal receipt file for your country ShowWithdraw=Show Withdraw -IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one withdrawal payment not yet processed, it won't be set as payed to allow to manage withdrawal before. -DoStandingOrdersBeforePayments=This tabs allows you to request for a standing order. Once it will be finished, you can type the payment to close the invoice. +IfInvoiceNeedOnWithdrawPaymentWontBeClosed=However, if invoice has at least one withdrawal payment not yet processed, it won't be set as paid to allow prior withdrawal management. +DoStandingOrdersBeforePayments=This tab allows you to request a standing order. Once it is complete, you can type the payment to close the invoice. WithdrawalFile=Withdrawal file SetToStatusSent=Set to status "File Sent" -ThisWillAlsoAddPaymentOnInvoice=This will also create payments onto invoices and will classify them to paid +ThisWillAlsoAddPaymentOnInvoice=This will also apply payments to invoices and will classify them as "Paid" ### Notifications InfoCreditSubject=Payment of standing order %s by the bank InfoCreditMessage=The standing order %s has been paid by the bank
Data of payment: %s InfoTransSubject=Transmission of standing order %s to bank -InfoTransMessage=The standing order %s has been transmited to bank by %s %s.

-InfoTransData=Amount: %s
Metode: %s
Date: %s +InfoTransMessage=The standing order %s has been sent to bank by %s %s.

+InfoTransData=Amount: %s
Method: %s
Date: %s InfoFoot=This is an automated message sent by Dolibarr InfoRejectSubject=Standing order refused InfoRejectMessage=Hello,

the standing order of invoice %s related to the company %s, with an amount of %s has been refused by the bank.

--
%s From a94fb12e5e6e8b213b18f42f8a70b06ee1b1c35e Mon Sep 17 00:00:00 2001 From: hameau Date: Mon, 18 Nov 2013 18:07:17 +0100 Subject: [PATCH 36/45] Update other.lang Minor typo --- htdocs/langs/en_US/other.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index c6a72ec672a..76acd7022fc 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -6,7 +6,7 @@ Tools=Tools ToolsDesc=This area is dedicated to group miscellaneous tools not available into other menu entries.

Those tools can be reached from menu on the side. Birthday=Birthday BirthdayDate=Birthday -DateToBirth=Date to birth +DateToBirth=Date of birth BirthdayAlertOn= birthday alert active BirthdayAlertOff= birthday alert inactive Notify_FICHINTER_VALIDATE=Intervention validated From 9d2dee207a5e87433a93e9e7c98f2008607da60b Mon Sep 17 00:00:00 2001 From: hameau Date: Mon, 18 Nov 2013 18:13:34 +0100 Subject: [PATCH 37/45] Update bills.lang Minor typos --- htdocs/langs/en_US/bills.lang | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 0903f98a301..e03b31c1929 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -383,13 +383,13 @@ PaymentInvoiceRef=Payment invoice %s ValidateInvoice=Validate invoice Cash=Cash Reported=Delayed -DisabledBecausePayments=Not possible since there is some payments -CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least one invoice classified payed +DisabledBecausePayments=Not possible since there are some payments +CantRemovePaymentWithOneInvoicePaid=Can't remove payment since there is at least one invoice classified paid ExpectedToPay=Expected payment -PayedByThisPayment=Payed by this payment -ClosePaidInvoicesAutomatically=Classify "Payed" all standard or replacement invoices entirely payed. -ClosePaidCreditNotesAutomatically=Classify "Payed" all credit notes entirely paid back. -AllCompletelyPayedInvoiceWillBeClosed=All invoice with no remain to pay will be automatically closed to status "Payed". +PayedByThisPayment=Paid by this payment +ClosePaidInvoicesAutomatically=Classify "Paid" all standard or replacement invoices entirely paid. +ClosePaidCreditNotesAutomatically=Classify "Paid" all credit notes entirely paid back. +AllCompletelyPayedInvoiceWillBeClosed=All invoice with no remain to pay will be automatically closed to status "Paid". ToMakePayment=Pay ToMakePaymentBack=Pay back ListOfYourUnpaidInvoices=List of unpaid invoices @@ -405,11 +405,11 @@ 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 (Template recommanded) +PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (recommended Template) # oursin PDF Model -PDFOursinDescription=Invoice PDF template Oursin. A complete invoice template (Template alternative) +PDFOursinDescription=Invoice PDF template Oursin. A complete invoice template (alternative Template) # NumRef Modules -TerreNumRefModelDesc1=Return numero with format %syymm-nnnn for standard and replacement invoices, %syymm-nnnn for credit notes and %syymm-nnnn for deposits where yy is year, mm is month and nnnn is a sequence with no break and no return to 0 -MarsNumRefModelDesc1=Return numero 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 +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 870b78fc19184fbd8d36588df1af0620c95b2883 Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 19 Nov 2013 10:41:00 +0100 Subject: [PATCH 38/45] [ bug #1142 ] Set paiement on invoice --- htdocs/fourn/facture/paiement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index f9ab0cd0cab..e4c0e27ce47 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -265,7 +265,7 @@ if ($action == 'create' || $action == 'add_paiement') $sql.= ' AND f.fk_soc = '.$object->socid; $sql.= ' AND f.paye = 0'; $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee - $sql.= ' GROUP BY f.rowid, f.ref_supplier, f.total_ht, f.total_ttc, f.datef'; + $sql.= ' GROUP BY f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef'; $resql = $db->query($sql); if ($resql) { From 68718c6100bc971c56678dd0b05c6961dc9327bb Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Tue, 19 Nov 2013 10:42:29 +0100 Subject: [PATCH 39/45] Update changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index efe4c3c2eb1..f6d72624b4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ Fix: Bad rounding on margin calculations and display. Fix: Option drop table into backup was broken. Fix: [ bug #1105 ] Searching Boxes other search option Fix: wrong buy price update +Fix :[ bug #1142 ] Set paiement on invoice (PGSql) ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined From c885389ac6c67fe5f92f79eace6776c087191572 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Tue, 19 Nov 2013 14:22:39 +0100 Subject: [PATCH 40/45] included the FormContract class to avoid fatal error --- htdocs/fichinter/fiche.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index f0f68e093fc..36178057338 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcontract.class.php'; if (! empty($conf->projet->enabled)) { From 83f99b5ba60894aa6c94fe0d21bbcd1d1dc6de64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 19 Nov 2013 14:36:55 +0100 Subject: [PATCH 41/45] Use LF instead of CRLF --- dev/translation/autotranslator.class.php | 22 +++++++-------- htdocs/langs/lv_LV/link.lang | 36 ++++++++++++------------ htdocs/langs/lv_LV/printipp.lang | 36 ++++++++++++------------ htdocs/langs/sk_SK/link.lang | 36 ++++++++++++------------ htdocs/langs/sk_SK/printipp.lang | 36 ++++++++++++------------ 5 files changed, 83 insertions(+), 83 deletions(-) diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 06b458811ab..288cda7101d 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -154,14 +154,14 @@ class autoTranslator if (isset($this->_translatedFiles[$file]) && count($this->_translatedFiles[$file])>0) { $fp = fopen($destPath, 'a'); - fwrite($fp, "\r\n"); - fwrite($fp, "\r\n"); - fwrite($fp, "// START - Lines generated via autotranslator.php tool (".$this->_time.").\r\n"); - fwrite($fp, "// Reference language: ".$this->_refLang." -> ".$my_destlang."\r\n"); + fwrite($fp, "\n"); + fwrite($fp, "\n"); + fwrite($fp, "// START - Lines generated via autotranslator.php tool (".$this->_time.").\n"); + fwrite($fp, "// Reference language: ".$this->_refLang." -> ".$my_destlang."\n"); foreach( $this->_translatedFiles[$file] as $line) { - fwrite($fp, $line . "\r\n"); + fwrite($fp, $line . "\n"); } - fwrite($fp, "// STOP - Lines generated via autotranslator.php tool (".$this->_time_end.").\r\n"); + fwrite($fp, "// STOP - Lines generated via autotranslator.php tool (".$this->_time_end.").\n"); fclose($fp); } return; @@ -177,11 +177,11 @@ class autoTranslator private function createTranslationFile($path,$my_destlang) { $fp = fopen($path, 'w+'); - fwrite($fp, "/*\r\n"); - fwrite($fp, " * Language code: {$my_destlang}\r\n"); - fwrite($fp, " * Automatic generated via autotranslator.php tool\r\n"); - fwrite($fp, " * Generation date " . $this->_time. "\r\n"); - fwrite($fp, " */\r\n"); + fwrite($fp, "/*\n"); + fwrite($fp, " * Language code: {$my_destlang}\n"); + fwrite($fp, " * Automatic generated via autotranslator.php tool\n"); + fwrite($fp, " * Generation date " . $this->_time. "\n"); + fwrite($fp, " */\n"); fclose($fp); return; } diff --git a/htdocs/langs/lv_LV/link.lang b/htdocs/langs/lv_LV/link.lang index b868996db5d..65f81c8548d 100644 --- a/htdocs/langs/lv_LV/link.lang +++ b/htdocs/langs/lv_LV/link.lang @@ -1,18 +1,18 @@ -/* - * Language code: lv_LV - * Automatic generated via autotranslator.php tool - * Generation date 2013-11-08 23:35:59 - */ - - -// START - Lines generated via autotranslator.php tool (2013-11-09 12:40:15). -// Reference language: en_US -> lv_LV -LinkANewFile=Saite jaunu failu / dokumentu -LinkedFiles=Saistīts failus un dokumentus -NoLinkFound=Nav reģistrētu saites -LinkComplete=Fails ir saistīts veiksmīgi -ErrorFileNotLinked=Failu nevar saistīt -LinkRemoved=Saite %s ir noņemta -ErrorFailedToDeleteLink=Neizdevās noņemt saiti "%s" -ErrorFailedToUpdateLink=Neizdevās atjaunināt saikne "%s" -// STOP - Lines generated via autotranslator.php tool (2013-11-09 12:40:57). +/* + * Language code: lv_LV + * Automatic generated via autotranslator.php tool + * Generation date 2013-11-08 23:35:59 + */ + + +// START - Lines generated via autotranslator.php tool (2013-11-09 12:40:15). +// Reference language: en_US -> lv_LV +LinkANewFile=Saite jaunu failu / dokumentu +LinkedFiles=Saistīts failus un dokumentus +NoLinkFound=Nav reģistrētu saites +LinkComplete=Fails ir saistīts veiksmīgi +ErrorFileNotLinked=Failu nevar saistīt +LinkRemoved=Saite %s ir noņemta +ErrorFailedToDeleteLink=Neizdevās noņemt saiti "%s" +ErrorFailedToUpdateLink=Neizdevās atjaunināt saikne "%s" +// STOP - Lines generated via autotranslator.php tool (2013-11-09 12:40:57). diff --git a/htdocs/langs/lv_LV/printipp.lang b/htdocs/langs/lv_LV/printipp.lang index bba261c4d07..4a1fa4d4ed3 100644 --- a/htdocs/langs/lv_LV/printipp.lang +++ b/htdocs/langs/lv_LV/printipp.lang @@ -1,18 +1,18 @@ -/* - * Language code: lv_LV - * Automatic generated via autotranslator.php tool - * Generation date 2013-11-09 12:40:15 - */ - - -// START - Lines generated via autotranslator.php tool (2013-11-09 12:40:15). -// Reference language: en_US -> lv_LV -PrintIPPSetup=Setup moduļa Direct Print -PrintIPPDesc=Ce modulis Përmet d'Ajouter ANO Bouton d'iespaids tieši des dokumenti vers votre imprimante. Il requiert ANO systeme Linux équipé de Kausi. -PRINTIPP_ENABLED=Rādīt Picto "Direct print" par dokumentu saraksts -PRINTIPP_HOST=Drukas serveris -PRINTIPP_PORT=Osta -PRINTIPP_USER=Login -PRINTIPP_PASSWORD=Parole -NoPrinterFound=Nav printeri atrasts (pārbaudiet savu tases etup) -// STOP - Lines generated via autotranslator.php tool (2013-11-09 12:49:40). +/* + * Language code: lv_LV + * Automatic generated via autotranslator.php tool + * Generation date 2013-11-09 12:40:15 + */ + + +// START - Lines generated via autotranslator.php tool (2013-11-09 12:40:15). +// Reference language: en_US -> lv_LV +PrintIPPSetup=Setup moduļa Direct Print +PrintIPPDesc=Ce modulis Përmet d'Ajouter ANO Bouton d'iespaids tieši des dokumenti vers votre imprimante. Il requiert ANO systeme Linux équipé de Kausi. +PRINTIPP_ENABLED=Rādīt Picto "Direct print" par dokumentu saraksts +PRINTIPP_HOST=Drukas serveris +PRINTIPP_PORT=Osta +PRINTIPP_USER=Login +PRINTIPP_PASSWORD=Parole +NoPrinterFound=Nav printeri atrasts (pārbaudiet savu tases etup) +// STOP - Lines generated via autotranslator.php tool (2013-11-09 12:49:40). diff --git a/htdocs/langs/sk_SK/link.lang b/htdocs/langs/sk_SK/link.lang index 910d15af974..abfa69d7e2a 100644 --- a/htdocs/langs/sk_SK/link.lang +++ b/htdocs/langs/sk_SK/link.lang @@ -1,18 +1,18 @@ -/* - * Language code: sk_SK - * Automatic generated via autotranslator.php tool - * Generation date 2013-11-08 23:25:26 - */ - - -// START - Lines generated via autotranslator.php tool (2013-11-08 23:25:26). -// Reference language: en_US -> sk_SK -LinkANewFile=Prepojenie nový súbor / dokument -LinkedFiles=Prepojené súbory a dokumenty -NoLinkFound=Žiadny registrovaný odkazy -LinkComplete=Súbor bol úspešne pripojil -ErrorFileNotLinked=Súbor nemohol byť spojená -LinkRemoved=Odkaz %s bol odstránený -ErrorFailedToDeleteLink=Nepodarilo sa odstrániť odkaz "%s" -ErrorFailedToUpdateLink=Nepodarilo sa aktualizovať odkaz "%s" -// STOP - Lines generated via autotranslator.php tool (2013-11-08 23:35:10). +/* + * Language code: sk_SK + * Automatic generated via autotranslator.php tool + * Generation date 2013-11-08 23:25:26 + */ + + +// START - Lines generated via autotranslator.php tool (2013-11-08 23:25:26). +// Reference language: en_US -> sk_SK +LinkANewFile=Prepojenie nový súbor / dokument +LinkedFiles=Prepojené súbory a dokumenty +NoLinkFound=Žiadny registrovaný odkazy +LinkComplete=Súbor bol úspešne pripojil +ErrorFileNotLinked=Súbor nemohol byť spojená +LinkRemoved=Odkaz %s bol odstránený +ErrorFailedToDeleteLink=Nepodarilo sa odstrániť odkaz "%s" +ErrorFailedToUpdateLink=Nepodarilo sa aktualizovať odkaz "%s" +// STOP - Lines generated via autotranslator.php tool (2013-11-08 23:35:10). diff --git a/htdocs/langs/sk_SK/printipp.lang b/htdocs/langs/sk_SK/printipp.lang index 824e51a686b..1b051dae6cb 100644 --- a/htdocs/langs/sk_SK/printipp.lang +++ b/htdocs/langs/sk_SK/printipp.lang @@ -1,18 +1,18 @@ -/* - * Language code: sk_SK - * Automatic generated via autotranslator.php tool - * Generation date 2013-11-08 23:25:26 - */ - - -// START - Lines generated via autotranslator.php tool (2013-11-08 23:25:26). -// Reference language: en_US -> sk_SK -PrintIPPSetup=Nastavenie modulu Priama tlač -PrintIPPDesc=Ce modul Permet d'un ajouter Bouton d'dojem priame des dokumenty vers votre imprimante. Il requiert un systeme Linux Equipe de poháre. -PRINTIPP_ENABLED=Zobraziť Piktogram "Priama tlač" do zoznamu dokumentov -PRINTIPP_HOST=Tlačový server -PRINTIPP_PORT=Prístav -PRINTIPP_USER=Prihlásenie -PRINTIPP_PASSWORD=Heslo -NoPrinterFound=Žiadne tlačiarne nájdené (skontrolujte poháre Nasta) -// STOP - Lines generated via autotranslator.php tool (2013-11-08 23:48:51). +/* + * Language code: sk_SK + * Automatic generated via autotranslator.php tool + * Generation date 2013-11-08 23:25:26 + */ + + +// START - Lines generated via autotranslator.php tool (2013-11-08 23:25:26). +// Reference language: en_US -> sk_SK +PrintIPPSetup=Nastavenie modulu Priama tlač +PrintIPPDesc=Ce modul Permet d'un ajouter Bouton d'dojem priame des dokumenty vers votre imprimante. Il requiert un systeme Linux Equipe de poháre. +PRINTIPP_ENABLED=Zobraziť Piktogram "Priama tlač" do zoznamu dokumentov +PRINTIPP_HOST=Tlačový server +PRINTIPP_PORT=Prístav +PRINTIPP_USER=Prihlásenie +PRINTIPP_PASSWORD=Heslo +NoPrinterFound=Žiadne tlačiarne nájdené (skontrolujte poháre Nasta) +// STOP - Lines generated via autotranslator.php tool (2013-11-08 23:48:51). From 7945011955b9ffb28ef9a07772dea9009b9b7238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 19 Nov 2013 17:54:36 +0100 Subject: [PATCH 42/45] Make AJAX new line form work again FIXME: Factorize! --- htdocs/comm/propal.php | 6 ++++++ htdocs/commande/fiche.php | 6 ++++++ htdocs/compta/facture.php | 6 ++++++ htdocs/contrat/fiche.php | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 685841560bd..447e065219e 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -653,6 +653,12 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $price_ht = ''; $tva_tx = ''; } + if (GETPOST('usenewaddlineform')) { + $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'); + $tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + } $qty = GETPOST('qty'.$predef); $remise_percent=GETPOST('remise_percent'.$predef); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index ccc2f13cbea..d40d8bf5a7c 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -587,6 +587,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) $price_ht = ''; $tva_tx = ''; } + if (GETPOST('usenewaddlineform')) { + $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'); + $tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + } $qty = GETPOST('qty'.$predef); $remise_percent=GETPOST('remise_percent'.$predef); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index dc573de6eca..293796c77a5 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1145,6 +1145,12 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $price_ht = ''; $tva_tx = ''; } + if (GETPOST('usenewaddlineform')) { + $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'); + $tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + } $qty = GETPOST('qty'.$predef); $remise_percent=GETPOST('remise_percent'.$predef); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 4a919ece44c..65d485d129c 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -359,6 +359,12 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $price_ht = ''; $tva_tx = ''; } + if (GETPOST('usenewaddlineform')) { + $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'); + $tva_tx=(GETPOST('tva_tx')?GETPOST('tva_tx'):0); + } $qty = GETPOST('qty'.$predef); $remise_percent=GETPOST('remise_percent'.$predef); From c92d0fe96671a28a4aa8f88415fb339dd1c3462f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Nov 2013 23:06:25 +0100 Subject: [PATCH 43/45] Fix: phpunit --- test/phpunit/DateLibTest.php | 2 +- test/phpunit/DateLibTzFranceTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index eb3fa40f98d..470b74df861 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -258,7 +258,7 @@ class DateLibTest extends PHPUnit_Framework_TestCase // Check %a and %b format for en_US $result=dol_print_date(0,'%a %b',true,$outputlangs); print __METHOD__." result=".$result."\n"; - $this->assertEquals('Thu jan',$result); + $this->assertEquals('Thu Jan',$result); return $result; } diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php index 889c6be3c3c..17db4e3e164 100644 --- a/test/phpunit/DateLibTzFranceTest.php +++ b/test/phpunit/DateLibTzFranceTest.php @@ -193,7 +193,7 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase // Check %a and %b format for en_US $result=dol_print_date(0,'%a %b',false,$outputlangs); print __METHOD__." result=".$result."\n"; - $this->assertEquals('Thu jan',$result); + $this->assertEquals('Thu Jan',$result); return $result; } From f305524e29795f41fae1b227cca193a08cdba3b0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 20 Nov 2013 09:34:54 +0100 Subject: [PATCH 44/45] Revert "Qual: Removed not used file" This reverts commit 603c2aa938eb525f35d0529787a54a40c49abab6. --- htdocs/societe/class/address.class.php | 524 +++++++++++++++++++++++++ 1 file changed, 524 insertions(+) create mode 100644 htdocs/societe/class/address.class.php diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php new file mode 100644 index 00000000000..0f1091b37ce --- /dev/null +++ b/htdocs/societe/class/address.class.php @@ -0,0 +1,524 @@ + + * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/societe/class/address.class.php + * \ingroup societe + * \brief Fichier de la classe des adresses des tiers + */ + + +/** + * \class Address + * \brief Class to manage addresses + */ +class Address +{ + var $db; + + var $id; + var $type; + var $label; + var $socid; + var $name; + var $address; + var $zip; + var $town; + var $country_id; + var $country_code; + var $phone; + var $fax; + var $note; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + } + + /** + * Create address into database + * + * @param int $socid Company socid + * @param User $user Object user making creation + * @return int 0 if OK, < 0 if KO + */ + function create($socid, $user='') + { + global $langs,$conf; + + // Nettoyage parametres + $this->name = trim($this->name); + $this->label = trim($this->label); + + dol_syslog(get_class($this)."::create label=".$this->label); + + $this->db->begin(); + + $result = $this->verify(); + + if ($result >= 0) + { + $now=dol_now(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_address (label, fk_soc, name, datec, fk_user_creat) "; + $sql .= " VALUES ('".$this->db->escape($this->label)."', '".$socid."', '".$this->db->escape($this->name)."', ".$this->db->idate($now).", '".$user->id."')"; + + $result=$this->db->query($sql); + if ($result) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_address"); + + $ret = $this->update($this->id, $socid, $user); + + if ($ret >= 0) + { + dol_syslog(get_class($this)."::create success id=".$this->id); + $this->db->commit(); + return 0; + } + else + { + dol_syslog(get_class($this)."::create echec update"); + $this->db->rollback(); + return -3; + } + } + else + + { + if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + + $this->error=$langs->trans("ErrorCompanyNameAlreadyExists",$this->nom); + } + else + { + dol_syslog(get_class($this)."::create echec insert sql=$sql"); + } + $this->db->rollback(); + return -2; + } + + } + else + { + $this->db->rollback(); + dol_syslog(get_class($this)."::create echec verify sql=$sql"); + return -1; + } + } + + + /** + * Verification lors de la modification de l'adresse + * + * @return int 0 if OK, <0 if KO + */ + function verify() + { + $this->label = trim($this->label); + $this->name = trim($this->name); + $result = 0; + if (!$this->name || !$this->label) + { + $this->error = "The name of company and the label can not be empty.\n"; + $result = -2; + } + return $result; + } + + + /** + * Mise a jour des parametres de l'adresse + * + * @param int $id id address + * @param int $socid id third party + * @param User $user Utilisateur qui demande la mise a jour + * @return int <0 if KO, >=0 if OK + */ + function update($id, $socid, $user='') + { + global $langs; + + // Clean parameters + $this->fk_soc = $socid; + $this->label = trim($this->label); + $this->name = trim($this->name); + $this->address = trim($this->address); + $this->zip = trim($this->zip); + $this->town = trim($this->town); + $this->country_id = trim($this->country_id); + $this->phone = trim($this->phone); + $this->phone = preg_replace("/\s/","",$this->phone); + $this->phone = preg_replace("/\./","",$this->phone); + $this->fax = trim($this->fax); + $this->fax = preg_replace("/\s/","",$this->fax); + $this->fax = preg_replace("/\./","",$this->fax); + $this->note = trim($this->note); + + $result = $this->verify(); // Verifie que nom et label obligatoire + + if ($result >= 0) + { + dol_syslog(get_class($this)."::Update verify ok"); + + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."societe_address"; + $sql.= " SET label = '" . $this->db->escape($this->label) ."'"; // Champ obligatoire + $sql.= ", name = '" . $this->db->escape($this->name) ."'"; // Champ obligatoire + $sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null"); + $sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null"); + $sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null"); + $sql.= ", fk_pays = '" . ($this->country_id?$this->db->escape($this->country_id):'0') ."'"; + $sql.= ", note = ".($this->note?"'".$this->db->escape($this->note)."'":"null"); + $sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null"); + $sql.= ", fax = ".($this->fax?"'".$this->db->escape($this->fax)."'":"null"); + if ($user) $sql .= ",fk_user_modif = '".$user->id."'"; + $sql .= " WHERE fk_soc = '" . $socid ."' AND rowid = '" . $this->db->escape($id) ."'"; + + dol_syslog(get_class($this)."::Update sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + dol_syslog(get_class($this)."::Update success"); + $this->db->commit(); + return 1; + } + else + { + if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + + $this->error=$langs->trans("ErrorDuplicateField",$this->name); + $result=-1; + } + else + { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this)."::Update error sql=".$sql, LOG_ERR); + $result=-2; + } + $this->db->rollback(); + return $result; + } + } + + } + + /** + * Charge depuis la base toutes les adresses d'une societe + * + * @param int $socid Id de la societe a charger en memoire + * @param User $user Objet de l'utilisateur + * @return int >0 si ok, <0 si ko + */ + function fetch_lines($socid, $user=0) + { + global $langs, $conf; + + $sql = 'SELECT rowid, nom, client, fournisseur'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'societe'; + $sql .= ' WHERE rowid = '.$socid; + + $resqlsoc=$this->db->query($sql); + if ($resqlsoc) + { + if ($this->db->num_rows($resqlsoc)) + { + $obj = $this->db->fetch_object($resqlsoc); + + $this->socname = $obj->nom; + $this->socid = $obj->rowid; + $this->id = $obj->rowid; + $this->client = $obj->client; + $this->fournisseur = $obj->fournisseur; + } + + $this->db->free($resqlsoc); + + $this->lines = array(); + + // Adresses liees a la societe + if ($this->socid) + { + $sql = 'SELECT a.rowid as id, a.label, a.name, a.address, a.datec as dc'; + $sql .= ', a.tms as date_update, a.fk_soc'; + $sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax'; + $sql .= ', p.code as country_code, p.libelle as country'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid'; + $sql .= ' WHERE a.fk_soc = '.$this->socid; + + $resql=$this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $objp = $this->db->fetch_object($resql); + + $line = new AddressLine($this->db); + + $line->id = $objp->id; + $line->date_creation = $this->db->jdate($objp->dc); + $line->date_update = $this->db->jdate($objp->date_update); + $line->label = $objp->label; + $line->name = $objp->name; + $line->address = $objp->address; + $line->zip = $objp->zip; + $line->town = $objp->town; + $line->country_id = $objp->country_id; + $line->country_code = $objp->country_id?$objp->country_code:''; + $line->country = $objp->country_id?($langs->trans('Country'.$objp->country_code)!='Country'.$objp->country_code?$langs->trans('Country'.$objp->country_code):$objp->country):''; + $line->phone = $objp->phone; + $line->fax = $objp->fax; + $line->note = $objp->note; + + $this->lines[$i] = $line; + $i++; + } + $this->db->free($resql); + return $num; + } + else + { + dol_syslog(get_class($this).'::Fetch Erreur: aucune adresse', LOG_ERR); + return 0; + } + } + else + { + dol_syslog(get_class($this).'::Fetch Erreur: societe inconnue', LOG_ERR); + return -1; + } + } + else + { + dol_syslog(get_class($this).'::Fetch '.$this->db->error(), LOG_ERR); + $this->error=$this->db->error(); + } + } + + /** + * Charge depuis la base l'objet adresse + * + * @param int $id Id de l'adresse a charger en memoire + * @param User $user Objet de l'utilisateur + * @return int >0 si ok, <0 si ko + */ + function fetch_address($id, $user=0) + { + global $langs; + global $conf; + + $sql = 'SELECT a.rowid, a.fk_soc, a.label, a.name, a.address, a.datec as date_creation'; + $sql .= ', a.tms as date_update'; + $sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax'; + $sql .= ', p.code as country_code, p.libelle as country'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON a.fk_pays = p.rowid'; + $sql .= ' WHERE a.rowid = '.$id; + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + $this->socid = $obj->fk_soc; + + $this->date_update = $this->db->jdate($obj->date_update); + $this->date_creation = $this->db->jdate($obj->date_creation); + + $this->label = $obj->label; + $this->name = $obj->name; + $this->address = $obj->address; + $this->zip = $obj->zip; + $this->town = $obj->town; + + $this->country_id = $obj->country_id; + $this->country_code = $obj->country_id?$obj->country_code:''; + $this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):''; + + $this->phone = $obj->phone; + $this->fax = $obj->fax; + $this->note = $obj->note; + + $result = 1; + } + else + { + dol_syslog('Erreur Societe::Fetch aucune adresse avec id='.$this->id.' - '.$sql); + $this->error='Erreur Societe::Fetch aucune adresse avec id='.$this->id.' - '.$sql; + $result = -2; + } + + $this->db->free($resql); + } + else + { + dol_syslog('Erreur Societe::Fetch echec sql='.$sql); + dol_syslog('Erreur Societe::Fetch '.$this->db->error()); + $this->error=$this->db->error(); + $result = -3; + } + + return $result; + } + + + /** + * Suppression d'une adresse + * + * @param int $id id de la societe a supprimer + * @param int $socid id third party + * @return void + */ + function delete($id,$socid) + { + dol_syslog("Address::Delete"); + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_address"; + $sql.= " WHERE rowid = ".$id; + $sql.= " AND fk_soc = ".$socid; + + $result = $this->db->query($sql); + + if (!$result) + { + print $this->db->error() . '
' . $sql; + } + } + + /** + * Return name of address with link (and eventually picto) + * Use $this->id, $this->label, $this->socid + * + * @param int $withpicto Include picto with link + * @param string $option Where the link point to + * @return string String with URL + */ + function getNomUrl($withpicto=0,$option='') + { + global $langs; + + $result=''; + + $lien = ''; + $lienfin=''; + + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAddress").': '.$this->label,'address').$lienfin.' '); + $result.=$lien.$this->label.$lienfin; + return $result; + } + + + /** + * Charge les informations d'ordre info dans l'objet societe + * + * @param int $id id de la societe a charger + * @return void + */ + function info($id) + { + $sql = "SELECT s.rowid, s.nom, datec, datea,"; + $sql.= " fk_user_creat, fk_user_modif"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE s.rowid = ".$id; + + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + + $this->id = $obj->rowid; + + if ($obj->fk_user_creat) { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_creat); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_modif) { + $muser = new User($this->db); + $muser->fetch($obj->fk_user_modif); + $this->user_modification = $muser; + } + $this->ref = $obj->nom; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datea); + } + + $this->db->free($result); + + } + else + { + dol_print_error($this->db); + } + } + +} + + +/** + * \class AddressLine + * \brief Class to manage one address line + */ +class AddressLine +{ + + var $id; + var $date_creation; + var $date_update; + var $label; + var $name; + var $address; + var $zip; + var $town; + var $country_id; + var $country_code; + var $country; + var $phone; + var $fax; + var $note; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + } +} +?> \ No newline at end of file From 4c29bddfda4798611ed00a983239dff57a9c37ae Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 20 Nov 2013 09:40:56 +0100 Subject: [PATCH 45/45] Fix: wrong variable name Fix: restore address.class.php, this class is used --- 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 79e515b05e5..62a54437cd6 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -562,7 +562,7 @@ abstract class DolibarrModules if (! $resql) $err++; } - if (! $err && ! preg_match('/newboxdefonly/',$options)) + if (! $err && ! preg_match('/newboxdefonly/',$option)) { $lastid=$this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def","rowid");
'.$langs->trans("ThirdPartyName").''; - $object->next_prev_filter="te.client in (1,3)"; + $object->next_prev_filter="te.client in (1,2,3)"; print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','',''); print '