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
This commit is contained in:
Laurent Destailleur 2018-03-06 09:20:45 +01:00
commit a086bd0137
11 changed files with 73 additions and 41 deletions

View File

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

View File

@ -75,7 +75,7 @@ else
} }
} }
if ($base == 1) if ($base == 1) // mysql
{ {
$link=array(); $link=array();
$cons = explode(";", $row[14]); $cons = explode(";", $row[14]);
@ -97,11 +97,19 @@ else
// var_dump($link); // var_dump($link);
print '<table>'; print '<table class="noborder">';
print '<tr class="liste_titre"><td>'.$langs->trans("Fields").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Index").'</td>'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("FieldsLinked").'</td></tr>'; 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);
$sql = "DESCRIBE ".$table;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@ -111,12 +119,18 @@ else
{ {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>$row[0]</td>"; print "<td>".$row[0]."</td>";
print "<td>$row[1]</td>"; print "<td>".$row[1]."</td>";
print "<td>$row[3]</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 "<td>".(isset($link[$row[0]][0])?$link[$row[0]][0]:'').".";
print (isset($link[$row[0]][1])?$link[$row[0]][1]:'')."</td>"; 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>'; print '</tr>';
$i++; $i++;
} }

View File

@ -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'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$langs->load('admin'); $langs->load('admin');
$langs->load("products");
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -205,7 +205,7 @@ if ($result)
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder); 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("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("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("StatusDebitCredit",$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
print "</tr>\n"; print "</tr>\n";

View File

@ -197,6 +197,14 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
$srcpath = $upload_dir.'/'.$filenamefrom; $srcpath = $upload_dir.'/'.$filenamefrom;
$destpath = $upload_dir.'/'.$filenameto; $destpath = $upload_dir.'/'.$filenameto;
$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 (! file_exists($destpath))
{
$result = dol_move($srcpath, $destpath); $result = dol_move($srcpath, $destpath);
if ($result) if ($result)
{ {
@ -216,6 +224,13 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); 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');
}
}
}
} }
} }

View File

@ -67,7 +67,7 @@ class Utils
// Delete temporary files // Delete temporary files
if ($dolibarr_main_data_root) 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') if ($choice == 'tempfilesold')
{ {
$now = dol_now(); $now = dol_now();
@ -81,10 +81,10 @@ class Utils
if ($choice=='allfiles') 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) 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 // Define files log
if ($dolibarr_main_data_root) 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=''; $filelog='';

View File

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

View File

@ -437,7 +437,7 @@ CREATE TABLE llx_expensereport_rules (
fk_usergroup integer DEFAULT NULL, fk_usergroup integer DEFAULT NULL,
fk_c_type_fees integer NOT NULL, fk_c_type_fees integer NOT NULL,
code_expense_rules_type varchar(50) 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 entity integer DEFAULT 1
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -29,6 +29,6 @@ CREATE TABLE llx_expensereport_rules (
fk_usergroup integer DEFAULT NULL, fk_usergroup integer DEFAULT NULL,
fk_c_type_fees integer NOT NULL, fk_c_type_fees integer NOT NULL,
code_expense_rules_type varchar(50) 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 entity integer DEFAULT 1
) ENGINE=InnoDB; ) ENGINE=InnoDB;

View File

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

View File

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