phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r648 - trunk/invoicing/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r648 - trunk/invoicing/include
Date: Mon, 6 Jan 2014 01:23:12 +0100 (CET)

Author: danydb
Date: 2014-01-06 01:23:12 +0100 (Mon, 06 Jan 2014)
New Revision: 648

Modified:
   trunk/invoicing/include/invoice_send_mail.inc.php
   trunk/invoicing/include/invoicing.inc.php
Log:
Add security : subject and email from mandatory

Modified: trunk/invoicing/include/invoice_send_mail.inc.php
===================================================================
--- trunk/invoicing/include/invoice_send_mail.inc.php   2014-01-06 00:09:31 UTC 
(rev 647)
+++ trunk/invoicing/include/invoice_send_mail.inc.php   2014-01-06 00:23:12 UTC 
(rev 648)
@@ -21,25 +21,12 @@
 /**
  * @file
  * @brief 
- * @param type $name Descriptionara
-  @note
-  array
-  'gDossier' => string '27' (length=2)
-  'ac' => string 'EXT/INVOICING' (length=13)
-  'plugin_code' => string 'INVOICING' (length=9)
-  'sel_sale' =>
-  array
-  0 => string '2871' (length=4)
-  'document' => string '16' (length=2)
-  'action' => string '3' (length=1)
-  'pdf' => string 'on' (length=2)
-  'email_from' => string 'address@hidden' (length=15)
-  'email_subject' => string 'Facture' (length=7)
-  'email_message' => string 'Message test               ' (length=27)
-  'copy' => string 'on' (length=2)
-  'choice_sel' => string 'Exécuter' (length=9)
-
-  @endnote
+ * @param email_from send of emails
+ * @param email_subject subject of email
+ * @param email_message text 
+ * @param email_copy copy to sender
+ * @param pdf convert to pdf
+   @endnote
  */
 require_once 'class_sendmail.php';
 
@@ -48,8 +35,12 @@
 $message = HtmlInput::default_value_get('email_message', 'null');
 $copy = HtmlInput::default_value_get('email_copy', 'null');
 $pdf = HtmlInput::default_value_get('pdf', 'null');
-
-
+if ($email_from == "null") {
+    die (_("Désolé mais il faut donner l'email de celui qui envoie"));
+}
+if ($email_subject == "null") {
+    die (_("Le sujet est obligatoire"));
+}
 $feedback = array();
 $dirname = tempnam($_ENV['TMP'], 'invoice');
 unlink($dirname);

Modified: trunk/invoicing/include/invoicing.inc.php
===================================================================
--- trunk/invoicing/include/invoicing.inc.php   2014-01-06 00:09:31 UTC (rev 
647)
+++ trunk/invoicing/include/invoicing.inc.php   2014-01-06 00:23:12 UTC (rev 
648)
@@ -68,7 +68,7 @@
     array('value'=>'2','Envoi de la facture sans conversion en PDF')
 )
 ?>
-<form method="GET" id="sel_sale_frm">
+<form method="GET" id="sel_sale_frm" onsubmit="return verify_invoicing()">
     Ajouter dans le form les valeurs de la recherches
     <?php
     echo HtmlInput::request_to_hidden(array('gDossier', 'ac', 'plugin_code'));
@@ -97,7 +97,7 @@
         </li>
         <li>
             
-            <input type="radio" name="action" value="3" 
+            <input type="radio" name="action" id="invoice_radio" value="3" 
                    
onclick="$('invoice_div').hide();$('send_mail_div').show();">
             <?php echo _('Envoi des factures par email') ?>
             <div id="send_mail_div" style="display:none">
@@ -107,12 +107,14 @@
                 </p>
                 <p>
                     <?php echo _('Email envoyé par'); ?> :
-                     <input type="text" name="email_from" class="input_text">
+                     <input type="text" id="email_from" name="email_from" 
class="input_text">
+                     <span class="notice" id="email_from_span"></span>
                 </p>
                 
                 <p>
                     <?php echo _('Sujet')?> : 
-                    <input type="text" name="email_subject" class="input_text">
+                    <input type="text" id="email_subject" name="email_subject" 
class="input_text">
+                    <span class="notice" id="email_subject_span"></span>
                 </p>
                 <p>
                     <?php echo _('Message')?> : 
@@ -131,3 +133,28 @@
         ?>
     </p>
 </form>
+<script>
+    function verify_invoicing()
+    {
+        if ($('invoice_radio').checked) {
+            if ($('email_from').value.trim()=="") {
+                $('email_from').style.border="solid 2px red";
+                $('email_from_span').innerHTML=" Obligatoire";
+                return false;
+            } else {
+                $('email_from_span').hide();
+                $('email_from').style.border="";
+            }
+            if ($('email_subject').value.trim()=="") {
+                $('email_subject').style.border="solid 2px red";
+                $('email_subject_span').innerHTML=" Obligatoire";
+                return false;
+            }else {
+                $('email_subject_pan').hide();
+                $('email_subject').style.border="";
+            }
+        }
+    }
+</script>
+    
+    
\ No newline at end of file



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]