浏览代码

Merge remote-tracking branch 'origin/3.8' into develop

Conflicts:
	.travis.yml
	htdocs/core/modules/askpricesupplier/doc/pdf_aurore.modules.php
	htdocs/core/modules/commande/doc/pdf_proforma.modules.php
	htdocs/includes/adodbtime/adodb-time.inc.php
	htdocs/langs/en_US/accountancy.lang
Laurent Destailleur 9 年之前
父节点
当前提交
f25a9030eb

+ 16 - 16
.travis.yml

@@ -113,6 +113,7 @@ before_script:
   echo Start travis
   echo Current dir is `pwd`
   echo Home dir is `echo ~`
+  echo TRAVIS_BUILD_DIR is $TRAVIS_BUILD_DIR
 
 - |
   echo "Re-enabling Xdebug for PHP CodeSniffer and PHP Unit"
@@ -138,22 +139,20 @@ before_script:
   echo
 
 - |
-  if [ "$DEBUG" = true ]; then
-    echo "Debugging informations"
-    # Check PHP
-    php -i
-    # Check PHP CodeSniffer installation
-    which phpcs
-    phpcs --version
-    phpcs -i
-    # Check PHPUnit installation
-    which phpunit
-    phpunit --version
-    # Check MySQL
-    mysql --version
-    mysql -e "SELECT VERSION();"
-    echo
-  fi
+  echo "Debugging informations"
+  # Check PHP
+  php -i
+  # Check PHP CodeSniffer installation
+  which phpcs
+  phpcs --version
+  phpcs -i
+  # Check PHPUnit installation
+  which phpunit
+  phpunit --version
+  # Check MySQL
+  mysql --version
+  mysql -e "SELECT VERSION();"
+  echo
 
 - |
   echo "Setting up database"
@@ -311,3 +310,4 @@ after_failure:
   fi
 
 after_script:
+

+ 1 - 1
dev/codesniffer/ruleset.xml

@@ -124,7 +124,7 @@
     <!-- Tweaks to metrics -->
     <rule ref="Generic.Metrics.CyclomaticComplexity">
         <properties>
-            <property name="complexity" value="80" />
+            <property name="complexity" value="120" />
             <property name="absoluteComplexity" value="250" />
         </properties>
     </rule>

+ 7 - 7
htdocs/accountancy/admin/card.php

@@ -148,14 +148,14 @@ if ($action == 'create')
 	dol_fiche_head();
 
 	print '<table class="border" width="100%">';
-
-	print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
+	
+	print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
 	print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
-	print '<tr><td>' . $langs->trans("Label") . '</td>';
+	print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
 	print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
 	print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
 	print '<td>';
-	print $htmlacc->select_account($accounting->account_parent, 'account_parent');
+	print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
 	print '</td></tr>';
 	print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
 	print '<td>';
@@ -204,13 +204,13 @@ else if ($id)
 
 			print '<table class="border" width="100%">';
 
-			print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
+			print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
 			print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
-			print '<tr><td>' . $langs->trans("Label") . '</td>';
+			print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';
 			print '<td><input name="label" size="70" value="' . $accounting->label . '"</td></tr>';
 			print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
 			print '<td>';
-			print $htmlacc->select_account($accounting->account_parent, 'account_parent');
+			print $htmlacc->select_account($accounting->account_parent, 'account_parent', 1);
 			print '</td></tr>';
 			print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
 			print '<td>';

+ 1 - 1
htdocs/commande/card.php

@@ -325,7 +325,7 @@ if (empty($reshook))
 							for($i = 0; $i < $num; $i ++)
 							{
 								$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
-								$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle);
+								$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : '');
 								$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
 
 								// Dates

+ 8 - 0
htdocs/contrat/class/contrat.class.php

@@ -8,6 +8,7 @@
  * Copyright (C) 2013		Christophe Battarel		<christophe.battarel@altairis.fr>
  * Copyright (C) 2013		Florian Henry			<florian.henry@open-concept.pro>
  * Copyright (C) 2014-2015	Marcos García			<marcosgdf@gmail.com>
+ * Copyright (C) 2015		Ferran Marcet			<fmarcet@2byte.es>
  *
  * 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
@@ -989,6 +990,13 @@ class Contrat extends CommonObject
 			}
 		}
 
+		if (! $error)
+		{
+			// Delete linked object
+			$res = $this->deleteObjectLinked();
+			if ($res < 0) $error++;
+		}
+
 		if (! $error)
 		{
 			// Delete contratdet_log

+ 3 - 2
htdocs/core/ajax/row.php

@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2010-2012 Regis Houssin  <regis.houssin@capnetworks.com>
+/* Copyright (C) 2010-2015 Regis Houssin  <regis.houssin@capnetworks.com>
  *
  * 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
@@ -21,12 +21,13 @@
  *                   This ajax page is called when doing an up or down drag and drop. 
  */
 
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disable token renewal
 if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
 if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
 if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
 if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
 if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
+if (! defined('NOREQUIREHOOK'))  define('NOREQUIREHOOK','1');  // Disable "main.inc.php" hooks
 
 require '../../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';

+ 4 - 4
htdocs/core/class/html.form.class.php

@@ -4243,7 +4243,7 @@ class Form
             else
 			{
                 // Day
-                $retstring.='<select'.($disabled?' disabled':'').' class="flat" name="'.$prefix.'day">';
+                $retstring.='<select'.($disabled?' disabled':'').' class="flat" id="'.$prefix.'day" name="'.$prefix.'day">';
 
                 if ($emptydate || $set_time == -1)
                 {
@@ -4257,7 +4257,7 @@ class Form
 
                 $retstring.="</select>";
 
-                $retstring.='<select'.($disabled?' disabled':'').' class="flat" name="'.$prefix.'month">';
+                $retstring.='<select'.($disabled?' disabled':'').' class="flat" id="'.$prefix.'month" name="'.$prefix.'month">';
                 if ($emptydate || $set_time == -1)
                 {
                     $retstring.='<option value="0" selected>&nbsp;</option>';
@@ -4275,11 +4275,11 @@ class Form
                 // Year
                 if ($emptydate || $set_time == -1)
                 {
-                    $retstring.='<input'.($disabled?' disabled':'').' placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" class="flat" type="text" size="3" maxlength="4" name="'.$prefix.'year" value="'.$syear.'">';
+                    $retstring.='<input'.($disabled?' disabled':'').' placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" class="flat" type="text" size="3" maxlength="4" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">';
                 }
                 else
                 {
-                    $retstring.='<select'.($disabled?' disabled':'').' class="flat" name="'.$prefix.'year">';
+                    $retstring.='<select'.($disabled?' disabled':'').' class="flat" id="'.$prefix.'year" name="'.$prefix.'year">';
 
                     for ($year = $syear - 5; $year < $syear + 10 ; $year++)
                     {

+ 1 - 1
htdocs/core/modules/commande/doc/pdf_einstein.modules.php

@@ -484,7 +484,7 @@ class pdf_einstein extends ModelePDFCommandes
 					$this->tva[$vatrate] += $tvaligne;
 
 					// Add line
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
+					if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
 					{
 						$pdf->setPage($pageposafter);
 						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

+ 1 - 1
htdocs/core/modules/expedition/doc/pdf_merou.modules.php

@@ -279,7 +279,7 @@ class pdf_merou extends ModelePdfExpedition
 					$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);
 
 					// Add line
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
+					if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
 					{
 						$pdf->setPage($pageposafter);
 						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

+ 1 - 1
htdocs/core/modules/expedition/doc/pdf_rouget.modules.php

@@ -452,7 +452,7 @@ class pdf_rouget extends ModelePdfExpedition
 					$pdf->MultiCell(($this->page_largeur - $this->marge_droite - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C');
 
 					// Add line
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
+					if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
 					{
 						$pdf->setPage($pageposafter);
 						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

+ 1 - 1
htdocs/core/modules/facture/doc/pdf_crabe.modules.php

@@ -579,7 +579,7 @@ class pdf_crabe extends ModelePDFFactures
 					if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
 
 					// Add line
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
+					if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
 					{
 						$pdf->setPage($pageposafter);
 						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

+ 1 - 1
htdocs/core/modules/propale/doc/pdf_azur.modules.php

@@ -572,7 +572,7 @@ class pdf_azur extends ModelePDFPropales
 					if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
 
 					// Add line
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
+					if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
 					{
 						$pdf->setPage($pageposafter);
 						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

+ 1 - 1
htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php

@@ -448,7 +448,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
 					$this->localtax2[$localtax2rate]+=$localtax2ligne;
 
 					// Add line
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
+					if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
 					{
 						$pdf->setPage($pageposafter);
 						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

+ 1 - 1
htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php

@@ -470,7 +470,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
 
 
 					// Add line
-					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
+					if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
 					{
 						$pdf->setPage($pageposafter);
 						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

+ 1 - 1
htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php

@@ -494,7 +494,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
 					if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
 
 					// Add line
-					if ($conf->global->MAIN_PDF_DASH_BETWEEN_LINES && $i < ($nblignes - 1))
+					if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
 					{
 						$pdf->setPage($pageposafter);
 						$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80)));

+ 9 - 3
htdocs/fourn/class/fournisseur.commande.class.php

@@ -732,7 +732,8 @@ class CommandeFournisseur extends CommonOrder
 
             // Do we have to change status now ? (If double approval is required and first approval, we keep status to 1 = validated)
 			$movetoapprovestatus=true;
-
+			$comment='';
+			
             $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
 			$sql.= " SET ref='".$this->db->escape($num)."',";
 			if (empty($secondlevel))	// standard or first level approval
@@ -741,7 +742,11 @@ class CommandeFournisseur extends CommonOrder
     	        $sql.= " fk_user_approve = ".$user->id;
     	        if (! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) && $conf->global->MAIN_FEATURES_LEVEL > 0 && $this->total_ht >= $conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL)
     	        {
-    	        	if (empty($this->user_approve_id2)) $movetoapprovestatus=false;		// second level approval not done
+    	        	if (empty($this->user_approve_id2)) 
+    	        	{
+    	        	    $movetoapprovestatus=false;		// second level approval not done
+    	        	    $comment=' (first level)';
+    	        	}
     	        }
 			}
 			else	// request a second level approval
@@ -749,6 +754,7 @@ class CommandeFournisseur extends CommonOrder
             	$sql.= " date_approve2='".$this->db->idate($now)."',";
             	$sql.= " fk_user_approve2 = ".$user->id;
     	        if (empty($this->user_approve_id)) $movetoapprovestatus=false;		// first level approval not done
+    	        $comment=' (second level)';
 			}
 			// If double approval is required and first approval, we keep status to 1 = validated
 			if ($movetoapprovestatus) $sql.= ", fk_statut = 2";
@@ -758,7 +764,7 @@ class CommandeFournisseur extends CommonOrder
 
             if ($this->db->query($sql))
             {
-                $this->log($user, 2, time());	// Statut 2
+                $this->log($user, 2, time(), $comment);	// Statut 2
 
             	if (! empty($conf->global->SUPPLIER_ORDER_AUTOADD_USER_CONTACT))
 	            {

+ 18 - 4
htdocs/fourn/commande/card.php

@@ -2733,10 +2733,24 @@ elseif (! empty($object->id))
 				// Reopen
 				if (in_array($object->statut, array(2)))
 				{
-					if ($user->rights->fournisseur->commande->commander)
-					{
-						print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
-					}
+				    $buttonshown=0;
+				    if (! $buttonshown && $user->rights->fournisseur->commande->approuver)
+				    {
+				        if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
+				            || (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id))
+				        {
+				            print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
+				            $buttonshown++;
+				        }
+				    }
+				    if (! $buttonshown && $user->rights->fournisseur->commande->approve2 && ! empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL))
+				    {
+				        if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
+				            || (! empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2))
+				        {
+				            print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans("Disapprove").'</a>';
+				        }
+				    }
 				}
 				if (in_array($object->statut, array(3, 5, 6, 7, 9)) || ($object->statut == 4 && $object->billed))
 				{

+ 14 - 0
htdocs/langs/en_US/accountancy.lang

@@ -155,3 +155,17 @@ ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting accoun
 
 FicheVentilation=Breakdown card
 GeneralLedgerIsWritten=Operations are written in the general ledger
+
+##Export Journal Feature
+ExportFormat=Format of Export
+Prefixname=Prefix of export File
+Separate=Export separator
+Textframe=Frame of text value
+Headercol=Colname in header of file
+Fieldname=Name of Field
+Headername=Name in header
+Type=Type of fields
+Param=Additionnal parameters
+EnabledProduct=In Product
+EnabledTiers=In Tiers
+EnabledVat=In Vat

+ 1 - 1
htdocs/langs/en_US/trips.lang

@@ -31,7 +31,7 @@ TripNDF=Informations expense report
 PDFStandardExpenseReports=Standard template to generate a PDF document for expense report
 ExpenseReportLine=Expense report line
 TF_OTHER=Other
-TF_TRANSPORTATION=Transportation
+TF_TRIP=Transportation
 TF_LUNCH=Lunch
 TF_METRO=Metro
 TF_TRAIN=Train