From 5396184755d03ab77073255597bae2688a2b7445 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sat, 5 Aug 2006 17:24:44 +0000
Subject: [PATCH] =?UTF-8?q?Possibilit=E9=20de=20choisir=20si=20changment?=
 =?UTF-8?q?=20statu=20propal=20cr=E9e=20=E9venment=20ou=20non=20dans=20Web?=
 =?UTF-8?q?calendar?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/admin/webcalendar.php  | 15 ++++++++++++++-
 htdocs/facture.class.php      |  4 ++--
 htdocs/langs/en_US/admin.lang |  3 ++-
 htdocs/langs/fr_FR/admin.lang |  7 ++++---
 htdocs/propal.class.php       |  5 +++++
 5 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/htdocs/admin/webcalendar.php b/htdocs/admin/webcalendar.php
index c51cfdfe512..7e50d5791c1 100644
--- a/htdocs/admin/webcalendar.php
+++ b/htdocs/admin/webcalendar.php
@@ -65,6 +65,7 @@ elseif ($actionsave)
 
     $i+=dolibarr_set_const($db,'PHPWEBCALENDAR_SYNCRO',trim($_POST["phpwebcalendar_syncro"]),'chaine',0);
     $i+=dolibarr_set_const($db,'PHPWEBCALENDAR_COMPANYCREATE',trim($_POST["phpwebcalendar_companycreate"]),'chaine',0);
+    $i+=dolibarr_set_const($db,'PHPWEBCALENDAR_PROPALSTATUS',trim($_POST["phpwebcalendar_propalstatus"]),'chaine',0);
     $i+=dolibarr_set_const($db,'PHPWEBCALENDAR_CONTRACTSTATUS',trim($_POST["phpwebcalendar_contractstatus"]),'chaine',0);
     $i+=dolibarr_set_const($db,'PHPWEBCALENDAR_BILLSTATUS',trim($_POST["phpwebcalendar_billstatus"]),'chaine',0);
 
@@ -225,6 +226,18 @@ if ($conf->societe->enabled)
     print '</select>';
     print '</td></tr>';
 }
+if ($conf->propal->enabled)
+{
+    $var=!$var;
+    print '<tr '.$bc[$var].'>';
+    print '<td>'.$langs->trans("WebCalAddEventOnStatusPropal").'</td>';
+    print '<td>';
+    print '<select name="phpwebcalendar_propalstatus" class="flat">';
+    print '<option value="always"'.($conf->global->PHPWEBCALENDAR_PROPALSTATUS=='always'?' selected="true"':'').'>'.$langs->trans("WebCalAllways").'</option>';
+    print '<option value="never"'.(! $conf->global->PHPWEBCALENDAR_PROPALSTATUS || $conf->global->PHPWEBCALENDAR_PROPALSTATUS=='never'?' selected="true"':'').'>'.$langs->trans("WebCalNever").'</option>';
+    print '</select>';
+    print '</td></tr>';
+}
 if ($conf->contrat->enabled)
 {
     $var=!$var;
@@ -248,8 +261,8 @@ if ($conf->facture->enabled)
     print '<option value="never"'.(! $conf->global->PHPWEBCALENDAR_BILLSTATUS || $conf->global->PHPWEBCALENDAR_BILLSTATUS=='never'?' selected="true"':'').'>'.$langs->trans("WebCalNever").'</option>';
     print '</select>';
     print '</td></tr>';
-    print '</table>';
 }
+print '</table>';
 
 
 print '<br><center>';
diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 3c5516d84fc..d5f1172a1df 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -977,10 +977,10 @@ class Facture extends CommonObject
 
             if ($error == 0)
             {
-                $this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0);
-
                 $this->ref = $numfa;
 
+                $this->use_webcal=($conf->global->PHPWEBCALENDAR_BILLSTATUS=='always'?1:0);
+
                 // Appel des triggers
                 include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
                 $interface=new Interfaces($this->db);
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 6823bc34846..43f2745135e 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -137,7 +137,7 @@ Module410Name=Webcalendar
 Module410Desc=Webcalendar integration
 Module500Name=Taxes and social contributions
 Module500Desc=Taxes and social contributions' management
-Module600Name=Notification
+Module600Name=Notifications
 Module600Desc=Send notifications (by email) on Dolibarr business events
 Module700Name=Donations
 Module700Desc=Donations' management
@@ -397,6 +397,7 @@ WebCalTestKo1=Connection to server '%s' succeed but database '%s' could not be r
 WebCalTestKo2=Connection to server '%s' with user '%s' failed.
 WebCalAddEventOnCreateActions=Add calendar event on actions create
 WebCalAddEventOnCreateCompany=Add calendar event on companies create
+WebCalAddEventOnStatusPropal=Add calendar event on commercial proposal status change
 WebCalAddEventOnStatusContract=Add calendar event on contract status change
 WebCalAddEventOnStatusBill=Add calendar event on bill status change
 ErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be a Webcalendar database.
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 8962a018244..a14a70d0596 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -137,7 +137,7 @@ Module410Name=Webcalendar
 Module410Desc=Interface avec le calendrier Webcalendar
 Module500Name=Taxes et charges sociales
 Module500Desc=Gestion des taxes et charges sociales
-Module600Name=Notification
+Module600Name=Notifications
 Module600Desc=Envoi de notifications (par mail) sur les �v�nements m�tiers Dolibarr
 Module700Name=Dons
 Module700Desc=Gestion des dons
@@ -397,8 +397,9 @@ WebCalTestKo1=La connexion au serveur '%s' a r
 WebCalTestKo2=La connexion au serveur '%s' par l'utilisateur '%s' � �chou�.
 WebCalAddEventOnCreateActions=Ajouter �v�nement dans calendrier sur cr�ation d'actions
 WebCalAddEventOnCreateCompany=Ajouter �v�nement dans calendrier sur cr�ation de soci�t�s
-WebCalAddEventOnStatusContract=Ajouter �v�nement dans calendrier sur changement statut contrats
-WebCalAddEventOnStatusBill=Ajouter �v�nement dans calendrier sur changement statut factures
+WebCalAddEventOnStatusPropal=Ajouter �v�nement dans calendrier sur changement de statut des propositions commerciales
+WebCalAddEventOnStatusContract=Ajouter �v�nement dans calendrier sur changement de statut des contrats
+WebCalAddEventOnStatusBill=Ajouter �v�nement dans calendrier sur changement de statut des factures
 ErrorConnectOkButWrongDatabase=La connexion a r�ussie mais la base ne semble pas etre une base webcalendar.
 ##### Invoices #####
 BillsSetup=Configuration du module Factures
diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php
index af3b1cb592b..16e8f16c38c 100644
--- a/htdocs/propal.class.php
+++ b/htdocs/propal.class.php
@@ -928,6 +928,7 @@ class Propal extends CommonObject
 
             if ($this->db->query($sql))
             {
+	            $this->use_webcal=($conf->global->PHPWEBCALENDAR_PROPALSTATUS=='always'?1:0);
 
                 // Appel des triggers
                 include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
@@ -1226,6 +1227,8 @@ class Propal extends CommonObject
                     return -2;
                 }
 
+	            $this->use_webcal=($conf->global->PHPWEBCALENDAR_PROPALSTATUS=='always'?1:0);
+
                 // Appel des triggers
                 include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
                 $interface=new Interfaces($this->db);
@@ -1234,6 +1237,8 @@ class Propal extends CommonObject
             }
             else
             {
+	            $this->use_webcal=($conf->global->PHPWEBCALENDAR_PROPALSTATUS=='always'?1:0);
+
                 // Appel des triggers
                 include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
                 $interface=new Interfaces($this->db);
-- 
GitLab