Browse Source

Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/actions_linkedfiles.inc.php
	htdocs/core/class/utils.class.php
Laurent Destailleur 7 years ago
parent
commit
a086bd0137

+ 1 - 0
htdocs/adherents/subscription.php

@@ -293,6 +293,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
                 {
                 	$error++;
         			setEventMessages($errmsg, null, 'errors');
+        			$error++;
                 	$action='addsubscription';
                 }
             }

+ 24 - 10
htdocs/admin/system/dbtable.php

@@ -75,7 +75,7 @@ else
 		}
 	}
 
-	if ($base == 1)
+	if ($base == 1)	// mysql
 	{
 		$link=array();
 		$cons = explode(";", $row[14]);
@@ -97,11 +97,19 @@ else
 
 		//  var_dump($link);
 
-		print '<table>';
-		print '<tr class="liste_titre"><td>'.$langs->trans("Fields").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Index").'</td>';
-		print '<td>'.$langs->trans("FieldsLinked").'</td></tr>';
-
-		$sql = "DESCRIBE ".$table;
+		print '<table class="noborder">';
+		print '<tr class="liste_titre">';
+		print '<td>'.$langs->trans("Fields").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Index").'</td>';
+		print '<td></td>';
+		print '<td></td>';
+		print '<td></td>';
+		print '<td></td>';
+		print '<td>'.$langs->trans("FieldsLinked").'</td>';
+		print '</tr>';
+
+		//$sql = "DESCRIBE ".$table;
+		$sql = "SHOW FULL COLUMNS IN ".$db->escape($table);
+		
 		$resql = $db->query($sql);
 		if ($resql)
 		{
@@ -111,12 +119,18 @@ else
 			{
 				$row = $db->fetch_row($resql);
 				print '<tr class="oddeven">';
-				print "<td>$row[0]</td>";
-				print "<td>$row[1]</td>";
-				print "<td>$row[3]</td>";
+				print "<td>".$row[0]."</td>";
+				print "<td>".$row[1]."</td>";
+				print "<td>".$row[3]."</td>";
+				print "<td>".(empty($row[4])?'':$row[4])."</td>";
+				print "<td>".(empty($row[5])?'':$row[5])."</td>";
+				print "<td>".(empty($row[6])?'':$row[6])."</td>";
+				print "<td>".(empty($row[7])?'':$row[7])."</td>";
+
 				print "<td>".(isset($link[$row[0]][0])?$link[$row[0]][0]:'').".";
 				print (isset($link[$row[0]][1])?$link[$row[0]][1]:'')."</td>";
-
+				
+				print '<!-- ALTER ALTER TABLE '.$table.' MODIFY '.$row[0].' '.$row[1].' COLLATE utf8_unicode_ci; -->';
 				print '</tr>';
 				$i++;
 			}

+ 1 - 0
htdocs/admin/taxes.php

@@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
 if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
 
 $langs->load('admin');
+$langs->load("products");
 
 if (!$user->admin) accessforbidden();
 

+ 1 - 1
htdocs/compta/prelevement/factures.php

@@ -205,7 +205,7 @@ if ($result)
   	print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder);
   	print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$param,'',$sortfield,$sortorder);
   	print_liste_field_titre("AmountInvoice",$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder);
-  	print_liste_field_titre("AmountRequested",$_SERVER["PHP_SELF"],"pl.amount_requested","",$param,'align="right"',$sortfield,$sortorder);
+  	print_liste_field_titre("AmountRequested",$_SERVER["PHP_SELF"],"pl.amount","",$param,'align="right"',$sortfield,$sortorder);
   	print_liste_field_titre("StatusDebitCredit",$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
 	print_liste_field_titre('');
 	print "</tr>\n";

+ 33 - 18
htdocs/core/actions_linkedfiles.inc.php

@@ -176,11 +176,11 @@ elseif ($action == 'confirm_updateline' && GETPOST('save','alpha') && GETPOST('l
 }
 elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
 {
-    // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
-    if (! empty($upload_dir))
-    {
-        $filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'), '_', 0);	// Do not remove accents
-        $filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'), '_', 0);		// Do not remove accents
+	// For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
+	if (! empty($upload_dir))
+	{
+		$filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'), '_', 0);	// Do not remove accents
+		$filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'), '_', 0);		// Do not remove accents
 
         if ($filenamefrom != $filenameto)
         {
@@ -197,23 +197,38 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
 	            $srcpath = $upload_dir.'/'.$filenamefrom;
 	            $destpath = $upload_dir.'/'.$filenameto;
 
-	            $result = dol_move($srcpath, $destpath);
-	            if ($result)
+	            $reshook=$hookmanager->initHooks(array('actionlinkedfiles'));
+	            $parameters=array('filenamefrom' => $filenamefrom, 'filenameto' => $filenameto, 'upload_dir' => $upload_dir);
+	            $reshook=$hookmanager->executeHooks('renameUploadedFile', $parameters, $object);
+
+	            if (empty($reshook))
 	            {
-	            	if ($object->id)
+	            	if (! file_exists($destpath))
 	            	{
-	                	$object->addThumbs($destpath);
-	            	}
+	            		$result = dol_move($srcpath, $destpath);
+			            if ($result)
+			            {
+			            	if ($object->id)
+			            	{
+			                	$object->addThumbs($destpath);
+			            	}
 
-	                // TODO Add revert function of addThumbs to remove for old name
-	                //$object->delThumbs($srcpath);
+			                // TODO Add revert function of addThumbs to remove for old name
+			                //$object->delThumbs($srcpath);
 
-	                setEventMessages($langs->trans("FileRenamed"), null);
-	            }
-	            else
-	            {
-	                $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
-	                setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors');
+			                setEventMessages($langs->trans("FileRenamed"), null);
+			            }
+			            else
+			            {
+			                $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
+			                setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors');
+			            }
+	            	}
+	            	else
+	            	{
+	            		$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
+	            		setEventMessages($langs->trans("ErrorDestinationAlreadyExists", $filenameto), null, 'errors');
+	            	}
 	            }
 	        }
         }

+ 4 - 4
htdocs/core/class/utils.class.php

@@ -67,7 +67,7 @@ class Utils
 			// Delete temporary files
 			if ($dolibarr_main_data_root)
 			{
-				$filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', '', '', 2, 0, '', 1);	// Do not follow symlinks
+				$filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', 'name', SORT_ASC, 2, 0, '', 1);	// Do not follow symlinks
 				if ($choice == 'tempfilesold')
 				{
 					$now = dol_now();
@@ -81,10 +81,10 @@ class Utils
 
 		if ($choice=='allfiles')
 		{
-			// Delete all files (except install.lock)
+			// Delete all files (except install.lock, do not follow symbolic links)
 			if ($dolibarr_main_data_root)
 			{
-				$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$');
+				$filesarray=dol_dir_list($dolibarr_main_data_root, "all", 0, '', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1);
 			}
 		}
 
@@ -93,7 +93,7 @@ class Utils
 			// Define files log
 			if ($dolibarr_main_data_root)
 			{
-				$filesarray=dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*$', 'install\.lock$');
+				$filesarray=dol_dir_list($dolibarr_main_data_root, "files", 0, '.*\.log[\.0-9]*$', 'install\.lock$', 'name', SORT_ASC, 0, 0, '', 1);
 			}
 
 			$filelog='';

+ 4 - 4
htdocs/expedition/class/expedition.class.php

@@ -398,7 +398,7 @@ class Expedition extends CommonObject
 
 		if (($lineId = $expeditionline->insert()) < 0)
 		{
-			$this->error[]=$expeditionline->error;
+			$this->errors[]=$expeditionline->error;
 		}
 		return $lineId;
 	}
@@ -2383,9 +2383,9 @@ class ExpeditionLigne extends CommonObjectLine
 		$error=0;
 
 		// Check parameters
-		if (empty($this->fk_expedition) || empty($this->fk_origin_line) || empty($this->qty))
+		if (empty($this->fk_expedition) || empty($this->fk_origin_line) || ! is_numeric($this->qty))
 		{
-			$this->errors[] = 'ErrorMandatoryParametersNotProvided';
+			$this->error = 'ErrorMandatoryParametersNotProvided';
 			return -1;
 		}
 		// Clean parameters
@@ -2425,7 +2425,6 @@ class ExpeditionLigne extends CommonObjectLine
 				$result=$this->call_trigger('LINESHIPPING_INSERT',$user);
 				if ($result < 0)
 				{
-					$this->errors[]=$this->error;
 					$error++;
 				}
 				// End call triggers
@@ -2441,6 +2440,7 @@ class ExpeditionLigne extends CommonObjectLine
 				dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
 				$this->error.=($this->error?', '.$errmsg:$errmsg);
 			}
+			
 			$this->db->rollback();
 			return -1*$error;
 		}

+ 1 - 1
htdocs/install/mysql/migration/6.0.0-7.0.0.sql

@@ -437,7 +437,7 @@ CREATE TABLE llx_expensereport_rules (
     fk_usergroup integer DEFAULT NULL,
     fk_c_type_fees integer NOT NULL,
     code_expense_rules_type varchar(50) NOT NULL,
-    is_for_all tinyint DEFAULT '0',
+    is_for_all tinyint DEFAULT 0,
     entity integer DEFAULT 1
 )ENGINE=innodb;
 

+ 1 - 1
htdocs/install/mysql/tables/llx_expensereport_rules.sql

@@ -29,6 +29,6 @@ CREATE TABLE llx_expensereport_rules (
   fk_usergroup				integer DEFAULT NULL,
   fk_c_type_fees			integer NOT NULL,
   code_expense_rules_type	varchar(50) NOT NULL,
-  is_for_all				tinyint DEFAULT '0',
+  is_for_all				tinyint DEFAULT 0,
   entity					integer DEFAULT 1
 ) ENGINE=InnoDB;

+ 2 - 2
htdocs/langs/fr_FR/accountancy.lang

@@ -224,8 +224,8 @@ GeneralLedgerSomeRecordWasNotRecorded=Certaines des opérations n'ont pu être e
 NoNewRecordSaved=Plus d'enregistrements à journaliser
 ListOfProductsWithoutAccountingAccount=Liste des produits non liés à un compte comptable
 ChangeBinding=Changer les liens
-Accounted=Comptabilisé dans le grand livre
-NotYetAccounted=Pas encore comptabilisé dans le grand livre
+Accounted=Comptabilisé
+NotYetAccounted=Pas encore comptabilisé
 
 ## Admin
 ApplyMassCategories=Application en masse des catégories

+ 1 - 0
htdocs/supplier_proposal/class/supplier_proposal.class.php

@@ -384,6 +384,7 @@ class SupplierProposal extends CommonObject
         if (empty($info_bits)) $info_bits=0;
         if (empty($rang)) $rang=0;
         if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
+        if (empty($pu_ht)) $pu_ht=0;
 
         $remise_percent=price2num($remise_percent);
         $qty=price2num($qty);