Merge remote-tracking branch 'upstream/develop' into new_branch_10_10_2018
This commit is contained in:
commit
9e494e65e0
@ -493,6 +493,7 @@ print '</table>';
|
||||
|
||||
</div> <!-- end div fichehalfleft -->
|
||||
|
||||
|
||||
<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">
|
||||
<div class="ficheaddleft">
|
||||
|
||||
@ -505,21 +506,94 @@ print '<br>';
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
<br>
|
||||
<!-- Dump of a server -->
|
||||
|
||||
<form method="post" action="export_files.php" name="dump">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||
<input type="hidden" name="export_type" value="server" />
|
||||
|
||||
<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>
|
||||
<div class="fichehalfleft">
|
||||
|
||||
<?php
|
||||
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
|
||||
print $langs->trans("BackupDescX").'<br><br>';
|
||||
|
||||
?>
|
||||
|
||||
<label for="zipfilename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br>
|
||||
<input type="text" name="zipfilename_template" style="width: 90%"
|
||||
id="zipfilename_template"
|
||||
value="<?php
|
||||
$prefix='documents';
|
||||
$ext='zip';
|
||||
|
||||
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
|
||||
echo $file;
|
||||
?>" /> <br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
// Show compression choices
|
||||
print '<div class="formelementrow">';
|
||||
print "\n";
|
||||
|
||||
print $langs->trans("Compression").': ';
|
||||
$filecompression = $compression;
|
||||
array_shift($filecompression);
|
||||
$filecompression['zip']= array('function' => 'dol_compress_dir', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip"));
|
||||
|
||||
foreach($filecompression as $key => $val)
|
||||
{
|
||||
if (! $val['function'] || function_exists($val['function'])) // Enabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
}
|
||||
else // Disabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' ('.$langs->trans("NotAvailable").')';
|
||||
}
|
||||
print ' ';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print "\n";
|
||||
|
||||
?>
|
||||
<br>
|
||||
<div align="center"><input type="submit" class="button"
|
||||
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">
|
||||
<div class="ficheaddleft">
|
||||
|
||||
<?php
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/documents','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
|
||||
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'documents/',1,0,$langs->trans("NoBackupFileAvailable"),0,$langs->trans("PreviousDumpFiles"));
|
||||
print '<br>';
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
// End of page
|
||||
|
||||
166
htdocs/admin/tools/export_files.php
Normal file
166
htdocs/admin/tools/export_files.php
Normal file
@ -0,0 +1,166 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/tools/export.php
|
||||
* \brief Page to export a database into a dump file
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$what=GETPOST('what','alpha');
|
||||
$export_type=GETPOST('export_type','alpha');
|
||||
$file=GETPOST('zipfilename_template','alpha');
|
||||
$compression = GETPOST('compression');
|
||||
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="date";
|
||||
if ($page < 0) { $page = 0; }
|
||||
elseif (empty($page)) $page = 0;
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$errormsg='';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/'.GETPOST('urlfile');
|
||||
$ret=dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
// Increase limit of time. Works only if we are not in safe mode
|
||||
$ExecTimeLimit=600;
|
||||
if (!empty($ExecTimeLimit))
|
||||
{
|
||||
$err=error_reporting();
|
||||
error_reporting(0); // Disable all errors
|
||||
//error_reporting(E_ALL);
|
||||
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
|
||||
error_reporting($err);
|
||||
}
|
||||
$MemoryLimit=0;
|
||||
if (!empty($MemoryLimit))
|
||||
{
|
||||
@ini_set('memory_limit', $MemoryLimit);
|
||||
}
|
||||
|
||||
$form=new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
||||
//llxHeader('','',$help_url);
|
||||
|
||||
//print load_fiche_titre($langs->trans("Backup"),'','title_setup');
|
||||
|
||||
|
||||
// Start with empty buffer
|
||||
$dump_buffer = '';
|
||||
$dump_buffer_len = 0;
|
||||
|
||||
// We will send fake headers to avoid browser timeout when buffering
|
||||
$time_start = time();
|
||||
|
||||
|
||||
$outputdir = $conf->admin->dir_output.'/documents';
|
||||
$result=dol_mkdir($outputdir);
|
||||
|
||||
$utils = new Utils($db);
|
||||
|
||||
if ($compression == 'zip')
|
||||
{
|
||||
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression);
|
||||
if ($ret < 0)
|
||||
{
|
||||
$errormsg = $langs->trans("ErrorFailedToWriteInDir",$outputfile);
|
||||
}
|
||||
}
|
||||
elseif (in_array($compression, array('gz', 'bz')))
|
||||
{
|
||||
$file = substr($file, 0, strrpos($file, '.'));
|
||||
$file .= '.tar';
|
||||
$cmd = 'tar -cf '.$outputdir."/".$file." --exclude=documents/admin/documents -C ".DOL_DATA_ROOT." ".DOL_DATA_ROOT."/../documents/";
|
||||
exec($cmd, $out, $retval);
|
||||
//var_dump($cmd, DOL_DATA_ROOT);exit;
|
||||
|
||||
if ($retval != 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
dol_syslog("Documents tar retval after exec=".$retval, LOG_ERR);
|
||||
$errormsg = 'Error tar generation return '.$retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($compression == 'gz')
|
||||
{
|
||||
$cmd = "gzip " . $outputdir."/".$file;
|
||||
}
|
||||
if ($compression == 'bz')
|
||||
{
|
||||
$cmd = "bzip2 " . $outputdir."/".$file;
|
||||
}
|
||||
|
||||
exec($cmd, $out, $retval);
|
||||
if ($retval != 0)
|
||||
{
|
||||
$errormsg = 'Error '.$compression.' generation return '.$retval;
|
||||
unlink($outputdir."/".$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($errormsg)
|
||||
{
|
||||
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Redirect t backup page
|
||||
header("Location: dolibarr_export.php");
|
||||
|
||||
$time_end = time();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -120,9 +121,9 @@ class PaymentVarious extends CommonObject
|
||||
$this->amount=trim($this->amount);
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_author=trim($this->fk_user_author);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
$this->fk_bank = (int) $this->fk_bank;
|
||||
$this->fk_user_author = (int) $this->fk_user_author;
|
||||
$this->fk_user_modif = (int) $this->fk_user_modif;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -320,9 +321,9 @@ class PaymentVarious extends CommonObject
|
||||
$this->amount=price2num(trim($this->amount));
|
||||
$this->label=trim($this->label);
|
||||
$this->note=trim($this->note);
|
||||
$this->fk_bank=trim($this->fk_bank);
|
||||
$this->fk_user_author=trim($this->fk_user_author);
|
||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||
$this->fk_bank = (int) $this->fk_bank;
|
||||
$this->fk_user_author = (int) $this->fk_user_author;
|
||||
$this->fk_user_modif = (int) $this->fk_user_modif;
|
||||
|
||||
// Check parameters
|
||||
if (! $this->label)
|
||||
@ -534,26 +535,26 @@ class PaymentVarious extends CommonObject
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ MassStockTransferShort=Mass stock transfer
|
||||
StockMovement=Stock movement
|
||||
StockMovements=Stock movements
|
||||
LabelMovement=Movement label
|
||||
TypeMovement=Movement type
|
||||
NumberOfUnit=Number of units
|
||||
UnitPurchaseValue=Unit purchase price
|
||||
StockTooLow=Stock too low
|
||||
|
||||
@ -391,7 +391,7 @@ class MyObject extends CommonObject
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
global $action;
|
||||
global $action,$hookmanager;
|
||||
$hookmanager->initHooks(array('myobjectdao'));
|
||||
$parameters=array('id'=>$this->id, 'getnomurl'=>$result);
|
||||
$reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
@ -104,7 +104,7 @@ $arrayfields=array(
|
||||
'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0),
|
||||
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1),
|
||||
'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1),
|
||||
'm.type_mouvement'=>array('label'=>$langs->trans("Type Mouvement"), 'checked'=>1),
|
||||
'm.type_mouvement'=>array('label'=>$langs->trans("TypeMovement"), 'checked'=>1),
|
||||
'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1),
|
||||
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
|
||||
'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user