fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17161] property: mandatory contract - if any


From: sigurdne
Subject: [Fmsystem-commits] [17161] property: mandatory contract - if any
Date: Wed, 18 Oct 2017 03:59:45 -0400 (EDT)

Revision: 17161
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17161
Author:   sigurdne
Date:     2017-10-18 03:59:44 -0400 (Wed, 18 Oct 2017)
Log Message:
-----------
property: mandatory contract - if any

Modified Paths:
--------------
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/js/portico/workorder.edit.js
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2017-10-17 14:14:04 UTC 
(rev 17160)
+++ trunk/property/inc/class.uiworkorder.inc.php        2017-10-18 07:59:44 UTC 
(rev 17161)
@@ -3219,8 +3219,10 @@
                public function get_vendor_contract($vendor_id = 0, $selected = 
0)
                {
                        $contract_list = 
$this->bocommon->get_vendor_contract($vendor_id, $selected);
-
-                       array_unshift($contract_list, array('id' => -1, 'name' 
=> lang('outside contract')));
+                       if($contract_list)
+                       {
+                               array_unshift($contract_list, array('id' => -1, 
'name' => lang('outside contract')));
+                       }
                        if($selected)
                        {
                                foreach ($contract_list as &$contract)

Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2017-10-17 14:14:04 UTC (rev 
17160)
+++ trunk/property/js/portico/workorder.edit.js 2017-10-18 07:59:44 UTC (rev 
17161)
@@ -213,8 +213,7 @@
 
                                        
$("#vendor_contract_id").attr("data-validation", "required");
 
-                                       htmlString = "<option value=''>" + 
data.length + " kontrakter funnet</option>";
-                                       htmlString += "<option 
value='-1'>Utenfor rammeavtale</option>";
+                                       htmlString = "<option value=''> 
kontrakter funnet</option>";
                                        var obj = data;
 
                                        $.each(obj, function (i)

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2017-10-17 14:14:04 UTC (rev 
17160)
+++ trunk/property/templates/base/workorder.xsl 2017-10-18 07:59:44 UTC (rev 
17161)
@@ -593,11 +593,21 @@
                                                        <xsl:value-of 
select="php:function('lang', 'contract')"/>
                                                </label>
                                                <select id="vendor_contract_id" 
name="values[contract_id]" class="pure-input-1-2">
-                                                       <xsl:if test="mode != 
'edit'">
-                                                               <xsl:attribute 
name="disabled">
-                                                                       
<xsl:text>disabled</xsl:text>
-                                                               </xsl:attribute>
-                                                       </xsl:if>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="mode='edit'">
+                                                                       <xsl:if 
test="count(contract_list/options) &gt; 0">
+                                                                               
<xsl:attribute name="data-validation">
+                                                                               
        <xsl:text>required</xsl:text>
+                                                                               
</xsl:attribute>
+                                                                       
</xsl:if>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                       
<xsl:attribute name="disabled">
+                                                                               
<xsl:text>disabled</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+
                                                        <option value="">
                                                                <xsl:value-of 
select="php:function('lang', 'select')"/>
                                                        </option>




reply via email to

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