Pārlūkot izejas kodu

NEW Add type "url" as possible extrafield.

Laurent Destailleur 8 gadi atpakaļ
vecāks
revīzija
6d70d39bbd

+ 1 - 1
htdocs/admin/supplier_order.php

@@ -497,7 +497,7 @@ $var=false;
 	print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'<br>';
 	print $langs->trans("IfSetToYesDontForgetPermission");
 	print '</td><td>';
-	print '<input type="text" size="3" name="SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED" value="'.$conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED.'">';
+	print '<input type="text" size="6" name="SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED" value="'.$conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED.'">';
 	print '</td><td align="right">';
 	print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
 	print "</td></tr>\n";

+ 1 - 1
htdocs/comm/propal/card.php

@@ -1808,7 +1808,7 @@ if ($action == 'create')
 			// Remise dispo de type non avoir
 			$filter = 'fk_facture_source IS NULL';
 			print '<br>';
-			$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter);
+			$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter, 0, '', 1);
 		}
 	}
 	if ($absolute_creditnote) {

+ 1 - 1
htdocs/commande/card.php

@@ -2019,7 +2019,7 @@ if ($action == 'create' && $user->rights->commande->creer)
 			} else {
 				// Remise dispo de type remise fixe (not credit note)
 				print '<br>';
-				$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount);
+				$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, 0, '', 1);
 			}
 		}
 		if ($absolute_creditnote) {

+ 2 - 2
htdocs/compta/facture/apercu.php

@@ -188,7 +188,7 @@ if ($id > 0 || ! empty($ref))
                 // Remise dispo de type remise fixe (not credit note)
                 $filter='fk_facture_source IS NULL';
                 print '<br>';
-                $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0,  'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount);
+                $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0,  'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount, 1);
             }
         }
         else
@@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref))
                 // Remise dispo de type avoir
                 $filter='fk_facture_source IS NOT NULL';
                 if (! $absolute_discount) print '<br>';
-                $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer);
+                $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer, '', 1);
             }
         }
         if (! $absolute_discount && ! $absolute_creditnote)

+ 2 - 2
htdocs/compta/facture/prelevement.php

@@ -263,7 +263,7 @@ if ($object->id > 0)
 			// Remise dispo de type non avoir
 			$filter='fk_facture_source IS NULL';
 			print '<br>';
-			$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer);
+			$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer,'',1);
 		}
 	}
 	if ($absolute_creditnote > 0)
@@ -283,7 +283,7 @@ if ($object->id > 0)
 			// Remise dispo de type avoir
 			$filter='fk_facture_source IS NOT NULL';
 			if (! $absolute_discount) print '<br>';
-			$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer);
+			$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer,'',1);
 		}
 	}
 	if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';

+ 20 - 9
htdocs/core/class/extrafields.class.php

@@ -76,14 +76,15 @@ class ExtraFields
 	'price'=>'ExtrafieldPrice',
 	'phone'=>'ExtrafieldPhone',
 	'mail'=>'ExtrafieldMail',
+	'url'=>'ExtrafieldUrl',
 	'select' => 'ExtrafieldSelect',
 	'sellist' => 'ExtrafieldSelectList',
 	'radio' => 'ExtrafieldRadio',
 	'checkbox' => 'ExtrafieldCheckBox',
 	'chkbxlst' => 'ExtrafieldCheckBoxFromList',
 	'link' => 'ExtrafieldLink',
-	'separate' => 'ExtrafieldSeparator',
 	'password' => 'ExtrafieldPassword',
+	'separate' => 'ExtrafieldSeparator',
 	);
 
 	/**
@@ -195,6 +196,9 @@ class ExtraFields
 			} elseif($type=='mail') {
 				$typedb='varchar';
 				$lengthdb='128';
+			} elseif($type=='url') {
+				$typedb='varchar';
+				$lengthdb='255';
 			} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){
 				$typedb='text';
 				$lengthdb='';
@@ -425,6 +429,9 @@ class ExtraFields
 			} elseif($type=='mail') {
 				$typedb='varchar';
 				$lengthdb='128';
+			} elseif($type=='url') {
+				$typedb='varchar';
+				$lengthdb='255';
 			} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') || ($type=='checkbox') || ($type=='chkbxlst')) {
 				$typedb='text';
 				$lengthdb='';
@@ -693,6 +700,10 @@ class ExtraFields
     			//$showsize=10;
     			$showsize = 'minwidth100imp';
     		}
+    		elseif ($type == 'url')
+    		{
+    		    $showsize='minwidth400imp';
+    		}
     		else
     		{
     			if (round($size) < 12)
@@ -738,6 +749,10 @@ class ExtraFields
 		{
 			$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
 		}
+		elseif (in_array($type, array('mail', 'phone', 'url')))
+		{
+			$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
+		}
 		elseif ($type == 'text')
 		{
 			require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@@ -754,14 +769,6 @@ class ExtraFields
 			}
 			$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
 		}
-		elseif ($type == 'mail')
-		{
-			$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
-		}
-		elseif ($type == 'phone')
-		{
-			$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
-		}
 		elseif ($type == 'price')
 		{
 			$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
@@ -1238,6 +1245,10 @@ class ExtraFields
 		{
 			$value=dol_print_email($value);
 		}
+		elseif ($type == 'url')
+		{
+			$value=dol_print_url($value,'_blank',32,1);
+		}
 		elseif ($type == 'phone')
 		{
 			$value=dol_print_phone($value);

+ 21 - 15
htdocs/core/class/html.form.class.php

@@ -3910,15 +3910,16 @@ class Form
      *
      *  @param  string	$page        	Page URL where form is shown
      *  @param  int		$selected    	Value pre-selected
-     *	@param  string	$htmlname    	Nom du formulaire select. Si 'none', non modifiable. Example 'remise_id'.
+     *	@param  string	$htmlname    	Name of SELECT component. If 'none', not changeable. Example 'remise_id'.
      *	@param	int		$socid			Third party id
      * 	@param	float	$amount			Total amount available
      * 	@param	string	$filter			SQL filter on discounts
      * 	@param	int		$maxvalue		Max value for lines that can be selected
      *  @param  string	$more           More string to add
+     *  @param  int     $hidelist       1=Hide list
      *  @return	void
      */
-    function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='')
+    function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0)
     {
         global $conf,$langs;
         if ($htmlname != "none")
@@ -3929,25 +3930,30 @@ class Form
             print '<div class="inline-block">';
             if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
             {
-                if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';    // If we want deposit to be substracted to payments only and not to total of final invoice
-                else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
+                if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency));    // If we want deposit to be substracted to payments only and not to total of final invoice
+                else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency));
             }
             else
             {
-                if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
-                else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': ';
+                if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency));
+                else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency));
             }
-            print '</div><div class="inline-block" style="padding-right: 10px">';
-            $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL';	// Remises disponibles
-            if ($filter) $newfilter.=' AND ('.$filter.')';
-            $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue);
-            if ($nbqualifiedlines > 0)
+            if (empty($hidelist)) print ': ';
+            print '</div>';
+            if (empty($hidelist))
             {
-                print ' &nbsp; <input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
-                if ($filter && $filter != "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
-                print '>';
+                print '<div class="inline-block" style="padding-right: 10px">';
+                $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL';	// Remises disponibles
+                if ($filter) $newfilter.=' AND ('.$filter.')';
+                $nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue);
+                if ($nbqualifiedlines > 0)
+                {
+                    print ' &nbsp; <input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
+                    if ($filter && $filter != "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
+                    print '>';
+                }
+                print '</div>';
             }
-            print '</div>';
             if ($more) 
             {
                 print '<div class="inline-block">';

+ 4 - 4
htdocs/core/tpl/admin_extrafields_edit.tpl.php

@@ -129,10 +129,10 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') )
 <?php
 // Define list of possible type transition
 $typewecanchangeinto=array(
-    'varchar'=>array('varchar', 'phone', 'mail', 'select'),
-    'mail'=>array('varchar', 'phone', 'mail', 'select'),
-    'phone'=>array('varchar', 'phone', 'mail', 'select'),
-    'select'=>array('varchar', 'phone', 'mail', 'select')
+    'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select'),
+    'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'),
+    'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'),
+    'select'=>array('varchar', 'phone', 'mail', 'url', 'select')
 );
 if (in_array($type, array_keys($typewecanchangeinto)))
 {

+ 1 - 1
htdocs/expedition/shipment.php

@@ -254,7 +254,7 @@ if ($id > 0 || ! empty($ref))
 				// Remise dispo de type non avoir
 				$filter='fk_facture_source IS NULL';
 				print '<br>';
-				$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter);
+				$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1);
 			}
 		}
 		if ($absolute_creditnote)

+ 2 - 1
htdocs/langs/en_US/admin.lang

@@ -354,6 +354,7 @@ Boolean=Boolean (Checkbox)
 ExtrafieldPhone = Phone
 ExtrafieldPrice = Price
 ExtrafieldMail = Email
+ExtrafieldUrl = Url
 ExtrafieldSelect = Select list
 ExtrafieldSelectList = Select from table
 ExtrafieldSeparator=Separator
@@ -398,7 +399,7 @@ EnableAndSetupModuleCron=If you want to have this recurring invoice beeing gener
 ModuleCompanyCodeAquarium=Return an accountancy code built by:<br>%s followed by third party supplier code for a supplier accountancy code,<br>%s followed by third party customer code for a customer accountancy code.
 ModuleCompanyCodePanicum=Return an empty accountancy code.
 ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code.  
-Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1 validation, 2=first approval and 3=second approval if amount is enough).<br>Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval is always required.  
+Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).<br>Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required.  
 UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than...
 
 # Modules

+ 0 - 1
htdocs/public/test/test_arrays.php

@@ -88,7 +88,6 @@ This page is a sample of page using tables. It is designed to make test with<br>
 - jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=4&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=4&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 1000 to enable view with jmobile)<br>
 - jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 570 to enable with emulated jmobile)<br>
 - no javascript / usage for bind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
-- dataTables<br>
 - tablednd<br>
 </h2>
 

+ 2 - 1
htdocs/public/test/test_forms.php

@@ -17,7 +17,8 @@ llxHeader();
 <h1>
 This page is a sample of page using Dolibarr HTML widget methods. It is designed to make test with<br>
 - css (add parameter &amp;theme=newtheme to test another theme or edit css of current theme)<br>
-- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&amp;dol_optimize_smallscreen=1</a> to enable view with jmobile)<br>
+- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=4&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=4&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 1000 to enable view with jmobile)<br>
+- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 570 to enable with emulated jmobile)<br>
 - no javascript / usage for bind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
 </h1>
 <br>