Compare commits

..

35 Commits
3.1.1 ... 3.1.3

Author SHA1 Message Date
Regis Houssin
88a677d9ce Release 3.1.3 2012-07-26 21:04:06 +02:00
Regis Houssin
6bcf2be91b Fix: Bug #460 - Wrong entity assignment when creating a warehouse 2012-07-26 20:48:35 +02:00
Laurent Destailleur
501dccabc2 Fix: property must be set if success 2012-07-09 14:58:42 +02:00
Laurent Destailleur
c39dadea14 Provide a solution for backup when mysqldump is not available. 2012-06-14 22:32:40 +02:00
Laurent Destailleur
ee9ad80c55 Merge branch '3.1' of ssh://git@github.com/Dolibarr/dolibarr.git into 3.1 2012-05-21 00:09:33 +02:00
Laurent Destailleur
50b9295180 Fix: [ bug #405 ] Late icon always displayed on comm/propal.php 2012-05-21 00:09:09 +02:00
Regis Houssin
7b8672b3a8 Fix: wrong permission 2012-05-07 11:17:39 +02:00
Laurent Destailleur
ff88510042 Merge branch '3.1' of ssh://git@github.com/Dolibarr/dolibarr.git into
3.1

Conflicts:
	htdocs/install/inc.php
2012-05-05 03:22:04 +02:00
Laurent Destailleur
1dcb3efd80 Prepare 3.1.2 snapshot 2012-05-05 03:18:58 +02:00
Regis Houssin
dc5aa65a23 Fix: avoid warning 2012-05-03 12:44:08 +02:00
Regis Houssin
bb77762950 Release 3.1.2 2012-05-03 12:08:57 +02:00
Regis Houssin
6fec87e405 Fix: changelog 2012-05-03 11:23:40 +02:00
Laurent Destailleur
5bdde964ed Merge branch '3.1' of ssh://git@github.com/Dolibarr/dolibarr.git into 3.1 2012-04-20 14:08:48 +02:00
Laurent Destailleur
8b5f4bb29b Fix: Can clone a proposal 2012-04-20 14:07:59 +02:00
Regis Houssin
7b64c8ab0e Fix: Bug #369
Conflicts:
	htdocs/comm/propal/index.php
2012-04-18 12:45:45 +02:00
Regis Houssin
38eb071a1f Fix: best practice 2012-04-10 08:50:14 +02:00
Laurent Destailleur
d6cd54fda7 Revert code because it does not fix security hole completely. Also it
does work on origin but at a transition level.
Sanitizing for command line data must not appears inside a function used
for http data. I prefer fixing this at the source and also using a rule
that clean all attacks completely instead of a rule that clean "most
problem but not all".
2012-04-10 01:31:21 +02:00
Laurent Destailleur
e42353bc32 Revert "Fix: sql injection"
This reverts commit feeb542e80.
2012-04-10 01:29:03 +02:00
Regis Houssin
feeb542e80 Fix: sql injection 2012-04-09 22:57:15 +02:00
Laurent Destailleur
0e2de4f155 Fix: [ bug #318 ] Journal des achats 2012-04-08 01:58:46 +02:00
Regis Houssin
fcf45c978d Fix: add member ID in substitution method 2012-03-31 16:19:20 +08:00
Regis Houssin
a56e1a0e97 Fix: duplicate end tag and missing form parts 2012-03-29 01:43:47 +08:00
Laurent Destailleur
e8465b1d77 Merge branch '3.1' of ssh://git@github.com/Dolibarr/dolibarr.git into 3.1 2012-03-28 03:19:39 +02:00
Laurent Destailleur
2c632b8bf9 Fix: Support companies with no prof id. 2012-03-28 03:18:27 +02:00
Laurent Destailleur
e788e5d931 Merge branch '3.1' of https://github.com/Dolibarr/dolibarr into 3.1 2012-03-27 18:57:35 +02:00
Laurent Destailleur
c0ff1234de Fix: Sanitize data 2 2012-03-27 18:54:34 +02:00
Laurent Destailleur
dec83098ee Fix permission vision 2012-03-23 00:27:24 +01:00
Laurent Destailleur
daf4ef87f2 Merge branch '3.1' of ssh://git@github.com/Dolibarr/dolibarr.git into 3.1 2012-03-15 23:05:26 +01:00
Laurent Destailleur
0163862a42 Fix: Can add a credit not even if credit note is higher than amount. 2012-03-15 22:59:55 +01:00
Regis Houssin
4a041a6b0d Fix: missing tva rates of supplier 2012-03-15 16:23:07 +08:00
Regis Houssin
4aa3d6befd Fix: missing private and public note 2012-03-15 15:20:25 +08:00
Regis Houssin
b82add12e0 Fix: [ bug #335 ] 2012-03-12 21:30:24 +01:00
Regis Houssin
2909a80ae2 Fix: missing class inclusion and origin object id 2012-03-11 12:02:22 +01:00
Regis Houssin
19d4147fcd Fix: missing contacts with order to invoice 2012-03-11 11:34:20 +01:00
Laurent Destailleur
a5482c56ab Fix: Upgrade from maintenace version 2012-03-10 14:19:40 +01:00
40 changed files with 777 additions and 419 deletions

View File

@@ -2,6 +2,27 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 3.1.3 compared to 3.1.2 *****
Fix: PgSQL - property must be set if success
Fix: Provide a solution for backup when mysqldump is not available
Fix: Bug #460 - Wrong entity assignment when creating a warehouse
Fix: bug #405 - Late icon always displayed on comm/propal.php
***** ChangeLog for 3.1.2 compared to 3.1.1 *****
- Fix: Can clone a proposal
- Fix: Add member ID in substitution method
- Fix: Duplicate end tag and missing form parts
- Fix: Support companies with no prof id.
- Fix: Sanitize data
- Fix: Bug #318
- Fix: Bug #369
- Fix: More bugs
***** ChangeLog for 3.1.1 compared to 3.1.0 *****

View File

@@ -1,4 +1,4 @@
dolibarr (3.1.1-1.1) unstable; urgency=low
dolibarr (3.1.2-1.1) unstable; urgency=low
* Non-maintainer upload
* New upstream release.

View File

@@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 3.1.1
PROJECT_NUMBER = 3.1.3
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View File

@@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 3.1.1
PROJECT_NUMBER = 3.1.3
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View File

@@ -17,9 +17,9 @@
; ----- Change this -----
AppName=DoliWamp
; DoliWamp-x.x.x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta
AppVerName=DoliWamp-3.1.1
AppVerName=DoliWamp-3.1.2
; DoliWamp-x.x x or DoliWamp-x.x.x-dev or DoliWamp-x.x.x-beta
OutputBaseFilename=DoliWamp-3.1.1
OutputBaseFilename=DoliWamp-3.1.2
; Define full path from wich all relative path are defined
; You must modify this to put here your dolibarr root directory
SourceDir=c:\Documents and Settings\ldestail\git\dolibarr

View File

@@ -11,7 +11,7 @@ use Cwd;
$PROJECT="dolibarr";
$MAJOR="3";
$MINOR="1";
$BUILD="1"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
$BUILD="3"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
$RPMSUBVERSION="auto"; # auto use value found into BUILD
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages

View File

@@ -4,7 +4,7 @@
<CompanyName />
<Program_Info>
<Program_Name>DoliWamp</Program_Name>
<Program_Version>3.1.0</Program_Version>
<Program_Version>3.1.2</Program_Version>
<Program_Release_Month>10</Program_Release_Month>
<Program_Release_Day>13</Program_Release_Day>
<Program_Release_Year>2011</Program_Release_Year>

View File

@@ -4,7 +4,7 @@
<CompanyName />
<Program_Info>
<Program_Name>Dolibarr</Program_Name>
<Program_Version>3.1..0</Program_Version>
<Program_Version>3.1.2</Program_Version>
<Program_Release_Month>10</Program_Release_Month>
<Program_Release_Day>13</Program_Release_Day>
<Program_Release_Year>2011</Program_Release_Year>

View File

@@ -34,7 +34,7 @@
</Company_Info>
<Program_Info>
<Program_Name>Dolibarr</Program_Name>
<Program_Version>3.1..0</Program_Version>
<Program_Version>3.1.2</Program_Version>
<Program_Release_Month>10</Program_Release_Month>
<Program_Release_Day>13</Program_Release_Day>
<Program_Release_Year>2011</Program_Release_Year>

View File

@@ -34,7 +34,7 @@
</Company_Info>
<Program_Info>
<Program_Name>DoliWamp</Program_Name>
<Program_Version>3.1.0</Program_Version>
<Program_Version>3.1.2</Program_Version>
<Program_Release_Month>10</Program_Release_Month>
<Program_Release_Day>13</Program_Release_Day>
<Program_Release_Year>2011</Program_Release_Year>

View File

@@ -31,7 +31,7 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "3.1.1" );
return ( "3.1.2" );
}
sub script_dolibarr_category

View File

@@ -232,5 +232,5 @@ fi
%changelog
* Wed Jan 04 2012 Laurent Destailleur 3.1.1-0.0
* Wed Jan 04 2012 Laurent Destailleur 3.1.2-0.0
- Initial version (#723326)

View File

@@ -312,5 +312,5 @@ fi
%changelog
* Wed Jan 04 2012 Laurent Destailleur 3.1.1-0.0
* Wed Jan 04 2012 Laurent Destailleur 3.1.2-0.0
- Initial version (#723326)

View File

@@ -221,5 +221,5 @@ fi
%changelog
* Wed Jan 04 2012 Laurent Destailleur 3.1.1-0.0
* Wed Jan 04 2012 Laurent Destailleur 3.1.2-0.0
- Initial version (#723326)

View File

@@ -226,5 +226,5 @@ fi
%changelog
* Wed Jan 04 2012 Laurent Destailleur 3.1.1-0.0
* Wed Jan 04 2012 Laurent Destailleur 3.1.2-0.0
- Initial version (#723326)

View File

@@ -54,8 +54,7 @@ if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
}
$const=$_POST["constname"];
$value=$_POST["constvalue"];
if (in_array($const,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $value=$_POST["constvalue".$const];
$value=(! empty($_POST["constvalue_".$const]) ? $_POST["constvalue_".$const] : $_POST["constvalue"]);
$type=$_POST["consttype"];
$constnote=isset($_POST["constnote"])?$_POST["constnote"]:'';
$result=dolibarr_set_const($db,$const,$value,$typeconst[$type],0,$constnote,$conf->entity);
@@ -435,7 +434,7 @@ function form_constantes($tableau)
else if (in_array($const,array('ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL')))
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('constvalue'.$const,$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
$doleditor=new DolEditor('constvalue_'.$const,$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
$doleditor->Create();
print '</td><td>';

View File

@@ -116,7 +116,6 @@ print $langs->trans("EnablePublicSubscriptionForm");
print '</td><td width="60" align="right">';
print $form->selectyesno("MEMBER_ENABLE_PUBLIC",$conf->global->MEMBER_ENABLE_PUBLIC,1);
print "</td></tr>\n";
print '</form>';
// Type
/*$var=! $var;

View File

@@ -173,54 +173,56 @@ class Adherent extends CommonObject
* @param text Text to make substitution to
* @return string Value of input text string with substitutions done
*/
function makeSubstitution($text)
{
global $langs;
$birthday = dol_print_date($this->naiss,'day');
$msgishtml = 0;
if (dol_textishtml($text,1)) $msgishtml = 1;
$infos='';
if ($this->civilite_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel(1)."\n";
$infos.= $langs->transnoentities("Lastname").": ".$this->nom."\n";
$infos.= $langs->transnoentities("Firstname").": ".$this->prenom."\n";
$infos.= $langs->transnoentities("Company").": ".$this->societe."\n";
$infos.= $langs->transnoentities("Address").": ".$this->adresse."\n";
$infos.= $langs->transnoentities("Zip").": ".$this->cp."\n";
$infos.= $langs->transnoentities("Town").": ".$this->ville."\n";
$infos.= $langs->transnoentities("Country").": ".$this->pays."\n";
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
$infos.= $langs->transnoentities("Password").": ".$this->pass."\n";
$infos.= $langs->transnoentities("Birthday").": ".$birthday."\n";
$infos.= $langs->transnoentities("Photo").": ".$this->photo."\n";
$infos.= $langs->transnoentities("Public").": ".yn($this->public);
// Substitutions
$substitutionarray=array(
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
'%CIVILITE%'=>$this->getCivilityLabel($msgishtml?0:1),
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->prenom):$this->prenom,
'%NOM%'=>$msgishtml?dol_htmlentitiesbr($this->nom):$this->nom,
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
'%ADRESSE%'=>$msgishtml?dol_htmlentitiesbr($this->adresse):$this->adresse,
'%CP%'=>$msgishtml?dol_htmlentitiesbr($this->cp):$this->cp,
'%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->ville):$this->ville,
'%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->pays):$this->pays,
'%EMAIL%'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
'%NAISS%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass
);
complete_substitutions_array($substitutionarray, $langs);
return make_substitutions($text,$substitutionarray);
}
function makeSubstitution($text)
{
global $langs;
$birthday = dol_print_date($this->naiss,'day');
$msgishtml = 0;
if (dol_textishtml($text,1)) $msgishtml = 1;
$infos='';
if ($this->civilite_id) $infos.= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel(1)."\n";
$infos.= $langs->transnoentities("id").": ".$this->id."\n";
$infos.= $langs->transnoentities("Lastname").": ".$this->nom."\n";
$infos.= $langs->transnoentities("Firstname").": ".$this->prenom."\n";
$infos.= $langs->transnoentities("Company").": ".$this->societe."\n";
$infos.= $langs->transnoentities("Address").": ".$this->adresse."\n";
$infos.= $langs->transnoentities("Zip").": ".$this->cp."\n";
$infos.= $langs->transnoentities("Town").": ".$this->ville."\n";
$infos.= $langs->transnoentities("Country").": ".$this->pays."\n";
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
$infos.= $langs->transnoentities("Password").": ".$this->pass."\n";
$infos.= $langs->transnoentities("Birthday").": ".$birthday."\n";
$infos.= $langs->transnoentities("Photo").": ".$this->photo."\n";
$infos.= $langs->transnoentities("Public").": ".yn($this->public);
// Substitutions
$substitutionarray=array(
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%ID%'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id,
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
'%CIVILITE%'=>$this->getCivilityLabel($msgishtml?0:1),
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->prenom):$this->prenom,
'%NOM%'=>$msgishtml?dol_htmlentitiesbr($this->nom):$this->nom,
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
'%ADRESSE%'=>$msgishtml?dol_htmlentitiesbr($this->adresse):$this->adresse,
'%CP%'=>$msgishtml?dol_htmlentitiesbr($this->cp):$this->cp,
'%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->ville):$this->ville,
'%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->pays):$this->pays,
'%EMAIL%'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
'%NAISS%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass
);
complete_substitutions_array($substitutionarray, $langs);
return make_substitutions($text,$substitutionarray);
}
/**

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@@ -19,41 +19,87 @@
* \file htdocs/admin/tools/dolibarr_export.php
* \ingroup core
* \brief Page to export database
* \version $Id: dolibarr_export.php,v 1.40 2011/08/03 00:45:43 eldy Exp $
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
$langs->load("admin");
if (! $user->admin)
accessforbidden();
$action=GETPOST('action');
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="date";
if ($page < 0) { $page = 0; }
$limit = $conf->liste_limit;
$offset = $limit * $page;
if (! $user->admin) accessforbidden();
$html=new Form($db);
$formfile = new FormFile($db);
/*
* Actions
*/
if ($action == 'delete')
{
dol_delete_file($conf->admin->dir_output.'/backup/'.GETPOST('urlfile'),1);
$action='';
}
/*
* View
*/
llxHeader('','','EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad');
$form=new Form($db);
$formfile = new FormFile($db);
$label=$db->label;
$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
llxHeader('','',$help_url);
?>
<script type="text/javascript" language="javascript">
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#mysql_options").hide();
jQuery("#postgresql_options").hide();
function hideoptions () {
jQuery("#mysql_options").hide();
jQuery("#mysql_options_nobin").hide();
jQuery("#postgresql_options").hide();
}
hideoptions();
jQuery("#radio_dump_mysql").click(function() {
hideoptions();
jQuery("#mysql_options").show();
});
jQuery("#radio_dump_mysql_nobin").click(function() {
hideoptions();
jQuery("#mysql_options_nobin").show();
});
jQuery("#radio_dump_postgresql").click(function() {
hideoptions();
jQuery("#postgresql_options").show();
});
jQuery("#select_sql_compat").click(function() {
if (jQuery("#select_sql_compat").val() == 'POSTGRESQL')
{
jQuery("#checkbox_dump_disable-add-locks").attr('checked',true);
};
});
<?php
if ($label == 'MySQL') print 'jQuery("#radio_dump_mysql").click();';
if ($label == 'PostgreSQL') print 'jQuery("#radio_dump_postgresql").click();';
?>
});
</script>
<?php
@@ -81,7 +127,7 @@ if ($_GET["msg"])
name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input
type="hidden" name="export_type" value="server" />
<fieldset id="fieldsetexport"><!-- LDR -->
<fieldset id="fieldsetexport">
<?php print '<legend>'.$langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b></legend>'; ?>
<table>
<tr>
@@ -90,15 +136,19 @@ if ($_GET["msg"])
<div id="div_container_exportoptions">
<fieldset id="exportoptions"><legend><?php echo $langs->trans("ExportMethod"); ?></legend>
<?php
if ($db->label == 'MySQL')
if ($label == 'MySQL')
{
?>
<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />
<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>
</div>
<br>
<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />
<label for="radio_dump_mysql">MySQL Dump (php) <?php print img_warning('Backup can\'t be guaranted with this method. Prefer previous one'); ?></label>
</div>
<?php
}
else if ($db->label == 'PostgreSQL')
else if ($label == 'PostgreSQL')
{
?>
<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />
@@ -108,7 +158,7 @@ if ($_GET["msg"])
}
else
{
print 'No method available with database '.$db->label;
print 'No method available with database '.$label;
}
?>
</fieldset>
@@ -120,7 +170,7 @@ if ($_GET["msg"])
<div id="div_container_sub_exportoptions">
<?php
if ($db->label == 'MySQL')
if ($label == 'MySQL')
{
?> <!-- Fieldset mysqldump -->
<fieldset id="mysql_options"><legend><?php echo $langs->trans("MySqlExportParameters"); ?></legend>
@@ -181,13 +231,17 @@ if ($_GET["msg"])
id="checkbox_sql_data" checked="checked" /> <label for="checkbox_sql_data">
<?php echo $langs->trans("Datas"); ?></label> </legend> <input
type="checkbox" name="showcolumns" value="yes"
id="checkbox_dump_showcolumns" /> <label
id="checkbox_dump_showcolumns" checked="checked" /> <label
for="checkbox_dump_showcolumns"> <?php echo $langs->trans("NameColumn"); ?></label><br>
<input type="checkbox" name="extended_ins" value="yes"
id="checkbox_dump_extended_ins" /> <label
id="checkbox_dump_extended_ins" checked="checked" /> <label
for="checkbox_dump_extended_ins"> <?php echo $langs->trans("ExtendedInsert"); ?></label><br>
<input type="checkbox" name="disable-add-locks" value="no"
id="checkbox_dump_disable-add-locks" /> <label
for="checkbox_dump_disable-add-locks"> <?php echo $langs->trans("NoLockBeforeInsert"); ?></label><br>
<input type="checkbox" name="delayed" value="yes"
id="checkbox_dump_delayed" /> <label for="checkbox_dump_delayed"> <?php echo $langs->trans("DelayedInsert"); ?></label><br>
@@ -198,12 +252,16 @@ if ($_GET["msg"])
id="checkbox_hexforbinary" checked="checked" /> <label
for="checkbox_hexforbinary"> <?php echo $langs->trans("EncodeBinariesInHexa"); ?></label><br>
<input type="checkbox" name="charset_utf8" value="yes"
id="checkbox_charset_utf8" checked="checked" disabled="disabled" /> <label
for="checkbox_charset_utf8"> <?php echo $langs->trans("UTF8"); ?></label><br>
</fieldset>
</fieldset>
<?php
}
if ($db->label == 'PostgreSQL')
if ($label == 'PostgreSQL')
{
?> <!-- Fieldset pg_dump -->
<fieldset id="postgresql_options"><legend><?php echo $langs->trans("PostgreSqlExportParameters"); ?></legend>
@@ -244,7 +302,7 @@ if ($_GET["msg"])
id="checkbox_sql_data" checked="checked" /> <label for="checkbox_sql_data">
<?php echo $langs->trans("Datas"); ?></label> </legend> <input
type="checkbox" name="showcolumns" value="yes"
id="checkbox_dump_showcolumns" /> <label
id="checkbox_dump_showcolumns" checked="checked" /> <label
for="checkbox_dump_showcolumns"> <?php echo $langs->trans("NameColumn"); ?></label><br>
</fieldset>
@@ -267,8 +325,8 @@ if ($_GET["msg"])
id="filename_template"
value="<?php
$prefix='dump';
if ($db->label == 'MySQL') $prefix='mysqldump';
if ($db->label == 'PostgreSQL') $prefix='pg_dump';
if ($label == 'MySQL') $prefix='mysqldump';
if ($label == 'PostgreSQL') $prefix='pg_dump';
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.sql';
echo $file;
?>" /> <br>
@@ -278,13 +336,13 @@ echo $file;
// Define compressions array
$compression=array(
'none' => array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")),
// 'zip' => array('function' => 'zip_open', 'id' => 'radio_compression_zip', 'label' => $langs->trans("Zip")), Not open source
'gz' => array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")),
'none' => array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")),
'gz' => array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")),
);
if ($db->label == 'MySQL')
if ($label == 'MySQL')
{
$compression['bz']=array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2"));
// $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function
$compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2"));
}
@@ -298,12 +356,12 @@ foreach($compression 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="true">';
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked="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="true">';
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled="disabled">';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
print ' ('.$langs->trans("NotAvailable").')';
}
@@ -316,20 +374,22 @@ print "\n";
?></fieldset>
<center><input type="submit" class="button"
<div align="center"><input type="submit" class="button"
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
<br>
</center>
</div>
</form>
<?php
$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',1,0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
//if ($result) print '<br><br>';
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,$langs->trans("NoBackupFileAvailable"),0,$langs->trans("PreviousDumpFiles"));
print '<br>';
llxFooter();
$db->close();
llxFooter('$Date: 2011/08/03 00:45:43 $ - $Revision: 1.40 $');
?>

View File

@@ -1,285 +1,332 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@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
* the Free Software Foundation; either version 2 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/>.
*/
* 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 2 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
* \version $Id: export.php,v 1.45 2011/08/03 00:45:43 eldy Exp $
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
$what=$_REQUEST["what"];
$export_type=$_REQUEST["export_type"];
$file=isset($_POST['filename_template']) ? $_POST['filename_template'] : '';
$langs->load("admin");
if (! $user->admin)
accessforbidden();
$action=GETPOST('action','alpha');
$what=GETPOST('what','alpha');
$export_type=GETPOST('export_type','alpha');
$file=GETPOST('filename_template','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST("page");
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="date";
if ($page < 0) { $page = 0; }
$limit = $conf->liste_limit;
$offset = $limit * $page;
if (! $user->admin) accessforbidden();
if ($file && ! $what)
{
//print DOL_URL_ROOT.'/dolibarr_export.php';
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired",$langs->transnoentities("ExportMethod"))));
/*
print '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ExportMethod")).'</div>';
print '<br>';
*/
exit;
//print DOL_URL_ROOT.'/dolibarr_export.php';
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired",$langs->transnoentities("ExportMethod"))));
exit;
}
/*
* Actions
*/
if ($action == 'delete')
{
dol_delete_file($conf->admin->dir_output.'/backup/'.GETPOST('urlfile'),1);
$action='';
}
/*
* View
*/
llxHeader('','','EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad');
$html=new Form($db);
$formfile = new FormFile($db);
print_fiche_titre($langs->trans("Backup"),'','setup');
// Increase limit of time. Works only if we are not in safe mode
$ExecTimeLimit=600;
if (!empty($ExecTimeLimit)) {
// Cette page peut etre longue. On augmente le delai autorise.
// Ne fonctionne que si on est pas en safe_mode.
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);
}
if (!empty($MemoryLimit)) {
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_fiche_titre($langs->trans("Backup"),'','setup');
// Start with empty buffer
$dump_buffer = '';
$dump_buffer_len = 0;
// We send fake headers to avoid browser timeout when buffering
// We will send fake headers to avoid browser timeout when buffering
$time_start = time();
// MYSQL
if ($what == 'mysql')
{
$cmddump=$_POST["mysqldump"];
if ($cmddump)
{
dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
}
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
if ($cmddump)
{
dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
}
$outputdir = $conf->admin->dir_output.'/backup';
$outputfile = $outputdir.'/'.$file;
// for compression format, we add extension
$compression=isset($_POST['compression']) ? $_POST['compression'] : 'none';
if ($compression == 'gz') $outputfile.='.gz';
if ($compression == 'bz') $outputfile.='.bz2';
$outputerror = $outputfile.'.err';
dol_mkdir($conf->admin->dir_output.'/backup');
$outputdir = $conf->admin->dir_output.'/backup';
$outputfile = $outputdir.'/'.$file;
// for compression format, we add extension
$compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
if ($compression == 'gz') $outputfile.='.gz';
if ($compression == 'bz') $outputfile.='.bz2';
$outputerror = $outputfile.'.err';
dol_mkdir($conf->admin->dir_output.'/backup');
// Parameteres execution
$command=$cmddump;
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command
// Parameteres execution
$command=$cmddump;
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host;
$param.=" -u ".$dolibarr_main_db_user;
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
if (! $_POST["use_transaction"]) $param.=" -l --single-transaction";
if ($_POST["disable_fk"]) $param.=" -K";
if ($_POST["sql_compat"] && $_POST["sql_compat"] != 'NONE') $param.=" --compatible=".$_POST["sql_compat"];
if ($_POST["drop_database"]) $param.=" --add-drop-database";
if ($_POST["sql_structure"])
{
if ($_POST["drop"]) $param.=" --add-drop-table";
}
else
{
$param.=" -t";
}
if ($_POST["sql_data"])
{
$param.=" --tables";
if ($_POST["showcolumns"]) $param.=" -c";
if ($_POST["extended_ins"]) $param.=" -e";
if ($_POST["delayed"]) $param.=" --delayed-insert";
if ($_POST["sql_ignore"]) $param.=" --insert-ignore";
if ($_POST["hexforbinary"]) $param.=" --hex-blob";
}
else
{
$param.=" -d";
}
$paramcrypted=$param;
$paramclear=$param;
if (! empty($dolibarr_main_db_pass))
{
$paramcrypted.=" -p".preg_replace('/./i','*',$dolibarr_main_db_pass);
$paramclear.=" -p".$dolibarr_main_db_pass;
}
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
$param=$dolibarr_main_db_name." -h ".$dolibarr_main_db_host;
$param.=" -u ".$dolibarr_main_db_user;
if (! empty($dolibarr_main_db_port)) $param.=" -P ".$dolibarr_main_db_port;
if (! GETPOST("use_transaction")) $param.=" -l --single-transaction";
if (GETPOST("disable_fk")) $param.=" -K";
if (GETPOST("sql_compat") && GETPOST("sql_compat") != 'NONE') $param.=" --compatible=".escapeshellarg(GETPOST("sql_compat","alpha"));
if (GETPOST("drop_database")) $param.=" --add-drop-database";
if (GETPOST("sql_structure"))
{
if (GETPOST("drop")) $param.=" --add-drop-table";
}
else
{
$param.=" -t";
}
if (GETPOST("disable-add-locks")) $param.=" --add-locks=FALSE";
if (GETPOST("sql_data"))
{
$param.=" --tables";
if (GETPOST("showcolumns")) $param.=" -c";
if (GETPOST("extended_ins")) $param.=" -e";
else $param.=" --skip-extended-insert";
if (GETPOST("delayed")) $param.=" --delayed-insert";
if (GETPOST("sql_ignore")) $param.=" --insert-ignore";
if (GETPOST("hexforbinary")) $param.=" --hex-blob";
}
else
{
$param.=" -d"; // No row information (no data)
}
$param.=" --default-character-set=utf8"; // We always save output into utf8 charset
$paramcrypted=$param;
$paramclear=$param;
if (! empty($dolibarr_main_db_pass))
{
$paramcrypted.=' -p"'.preg_replace('/./i','*',$dolibarr_main_db_pass).'"';
$paramclear.=' -p"'.str_replace('"','\"',$dolibarr_main_db_pass).'"';
}
print '<b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
print '<textarea rows="'.ROWS_2.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
print '<b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
print '<textarea rows="'.ROWS_2.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
print '<br>';
//print $paramclear;
print '<br>';
// Now run command and show result
print '<b>'.$langs->trans("BackupResult").':</b> ';
$errormsg='';
// Now run command and show result
print '<b>'.$langs->trans("BackupResult").':</b> ';
$result=dol_mkdir($outputdir);
$errormsg='';
// Debut appel methode execution
$fullcommandcrypted=$command." ".$paramcrypted." 2>&1";
$fullcommandclear=$command." ".$paramclear." 2>&1";
if ($compression == 'none') $handle = fopen($outputfile, 'w');
if ($compression == 'gz') $handle = gzopen($outputfile, 'w');
if ($compression == 'bz') $handle = bzopen($outputfile, 'w');
$result=dol_mkdir($outputdir);
// Debut appel methode execution
$fullcommandcrypted=$command." ".$paramcrypted." 2>&1";
$fullcommandclear=$command." ".$paramclear." 2>&1";
if ($compression == 'none') $handle = fopen($outputfile, 'w');
if ($compression == 'gz') $handle = gzopen($outputfile, 'w');
if ($compression == 'bz') $handle = bzopen($outputfile, 'w');
if ($handle)
{
$ok=0;
dol_syslog("Run command ".$fullcommandcrypted);
$handlein = popen($fullcommandclear, 'r');
while (!feof($handlein))
{
$read = fgets($handlein);
fwrite($handle,$read);
if ($handle)
{
$ok=0;
dol_syslog("Run command ".$fullcommandcrypted);
$handlein = popen($fullcommandclear, 'r');
while (!feof($handlein))
{
$read = fgets($handlein);
fwrite($handle,$read);
if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1;
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1;
}
pclose($handlein);
}
pclose($handlein);
if ($compression == 'none') fclose($handle);
if ($compression == 'gz') gzclose($handle);
if ($compression == 'bz') bzclose($handle);
if ($compression == 'none') fclose($handle);
if ($compression == 'gz') gzclose($handle);
if ($compression == 'bz') bzclose($handle);
if (! empty($conf->global->MAIN_UMASK))
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
else
{
$langs->load("errors");
dol_syslog("Failed to open file ".$outputfile,LOG_ERR);
$errormsg=$langs->trans("ErrorFailedToWriteInDir");
}
// Get errorstring
if ($compression == 'none') $handle = fopen($outputfile, 'r');
if ($compression == 'gz') $handle = gzopen($outputfile, 'r');
if ($compression == 'bz') $handle = bzopen($outputfile, 'r');
if ($handle)
{
// Get 2048 first chars of error message.
$errormsg = fgets($handle,2048);
// Close file
if ($compression == 'none') fclose($handle);
if ($compression == 'gz') gzclose($handle);
if ($compression == 'bz') bzclose($handle);
if ($ok && preg_match('/^-- MySql/i',$errormsg)) $errormsg=''; // Pas erreur
else
{
// Renommer fichier sortie en fichier erreur
//print "$outputfile -> $outputerror";
@dol_delete_file($outputerror,1);
@rename($outputfile,$outputerror);
// Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide
if (! $errormsg) $errormsg=$langs->trans("ErrorFailedToRunExternalCommand");
}
}
// Fin execution commande
if (! empty($conf->global->MAIN_UMASK))
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
else
{
$langs->load("errors");
dol_syslog("Failed to open file ".$outputfile,LOG_ERR);
$errormsg=$langs->trans("ErrorFailedToWriteInDir");
}
// Get errorstring
if ($compression == 'none') $handle = fopen($outputfile, 'r');
if ($compression == 'gz') $handle = gzopen($outputfile, 'r');
if ($compression == 'bz') $handle = bzopen($outputfile, 'r');
if ($handle)
{
// Get 2048 first chars of error message.
$errormsg = fgets($handle,2048);
// Close file
if ($compression == 'none') fclose($handle);
if ($compression == 'gz') gzclose($handle);
if ($compression == 'bz') bzclose($handle);
if ($ok && preg_match('/^-- MySql/i',$errormsg)) $errormsg=''; // Pas erreur
else
{
// Renommer fichier sortie en fichier erreur
//print "$outputfile -> $outputerror";
@dol_delete_file($outputerror,1);
@rename($outputfile,$outputerror);
// Si safe_mode on et command hors du parametre exec, on a un fichier out vide donc errormsg vide
if (! $errormsg)
{
$langs->load("errors");
$errormsg=$langs->trans("ErrorFailedToRunExternalCommand");
}
}
}
// Fin execution commande
}
if ($what == 'mysqlnobin')
{
$outputdir = $conf->admin->dir_output.'/backup';
$outputfile = $outputdir.'/'.$file;
$outputfiletemp = $outputfile.'-TMP.sql';
// for compression format, we add extension
$compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
if ($compression == 'gz') $outputfile.='.gz';
if ($compression == 'bz') $outputfile.='.bz2';
$outputerror = $outputfile.'.err';
dol_mkdir($conf->admin->dir_output.'/backup');
if ($compression == 'gz' or $compression == 'bz')
{
backup_tables($outputfiletemp);
dol_compress_file($outputfiletemp, $outputfile, $compression);
unlink($outputfiletemp);
}
else
{
backup_tables($outputfile);
}
}
// POSTGRESQL
if ($what == 'postgresql')
{
$cmddump=$_POST["postgresqldump"];
if ($cmddump)
{
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
}
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by escapeshellarg
if ($cmddump)
{
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
}
$outputdir = $conf->admin->dir_output.'/backup';
$outputfile = $outputdir.'/'.$file;
// for compression format, we add extension
$compression=isset($_POST['compression']) ? $_POST['compression'] : 'none';
if ($compression == 'gz') $outputfile.='.gz';
if ($compression == 'bz') $outputfile.='.bz2';
$outputerror = $outputfile.'.err';
dol_mkdir($conf->admin->dir_output.'/backup');
$outputdir = $conf->admin->dir_output.'/backup';
$outputfile = $outputdir.'/'.$file;
// for compression format, we add extension
$compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
if ($compression == 'gz') $outputfile.='.gz';
if ($compression == 'bz') $outputfile.='.bz2';
$outputerror = $outputfile.'.err';
dol_mkdir($conf->admin->dir_output.'/backup');
// Parameteres execution
$command=$cmddump;
if (preg_match("/\s/",$command)) $command=$command=escapeshellarg($command); // Use quotes on command
// Parameteres execution
$command=$cmddump;
if (preg_match("/\s/",$command)) $command=$command=escapeshellarg($command); // Use quotes on command
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
$param=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host;
$param.=" -U ".$dolibarr_main_db_user;
if (! empty($dolibarr_main_db_port)) $param.=" -p ".$dolibarr_main_db_port;
if ($_POST["sql_compat"] && $_POST["sql_compat"] == 'ANSI') $param.=" --disable-dollar-quoting";
if ($_POST["drop_database"]) $param.=" -c -C";
if ($_POST["sql_structure"])
{
if ($_POST["drop"]) $param.=" --add-drop-table";
if (empty($_POST["sql_data"])) $param.=" -s";
}
if ($_POST["sql_data"])
{
if (empty($_POST["sql_structure"])) $param.=" -a";
if ($_POST["showcolumns"]) $param.=" -c";
}
$param.=' -f "'.$outputfile.'"';
//if ($compression == 'none')
if ($compression == 'gz') $param.=' -Z 9';
//if ($compression == 'bz')
$paramcrypted=$param;
$paramclear=$param;
if (! empty($dolibarr_main_db_pass))
{
//$paramcrypted.=" -W".preg_replace('/./i','*',$dolibarr_main_db_pass);
//$paramclear.=" -W".$dolibarr_main_db_pass;
}
$paramcrypted.=" -w ".$dolibarr_main_db_name;
$paramclear.=" -w ".$dolibarr_main_db_name;
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
$param=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host;
$param.=" -U ".$dolibarr_main_db_user;
if (! empty($dolibarr_main_db_port)) $param.=" -p ".$dolibarr_main_db_port;
if (GETPOST("sql_compat") && GETPOST("sql_compat") == 'ANSI') $param.=" --disable-dollar-quoting";
if (GETPOST("drop_database")) $param.=" -c -C";
if (GETPOST("sql_structure"))
{
if (GETPOST("drop")) $param.=" --add-drop-table";
if (! GETPOST("sql_data")) $param.=" -s";
}
if (GETPOST("sql_data"))
{
if (! GETPOST("sql_structure")) $param.=" -a";
if (GETPOST("showcolumns")) $param.=" -c";
}
$param.=' -f "'.$outputfile.'"';
//if ($compression == 'none')
if ($compression == 'gz') $param.=' -Z 9';
//if ($compression == 'bz')
$paramcrypted=$param;
$paramclear=$param;
/*if (! empty($dolibarr_main_db_pass))
{
$paramcrypted.=" -W".preg_replace('/./i','*',$dolibarr_main_db_pass);
$paramclear.=" -W".$dolibarr_main_db_pass;
}*/
$paramcrypted.=" -w ".$dolibarr_main_db_name;
$paramclear.=" -w ".$dolibarr_main_db_name;
print $langs->trans("RunCommandSummaryToLaunch").':<br>'."\n";
print '<textarea rows="'.ROWS_3.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
print $langs->trans("RunCommandSummaryToLaunch").':<br>'."\n";
print '<textarea rows="'.ROWS_3.'" cols="120">'.$command." ".$paramcrypted.'</textarea><br>'."\n";
print '<br>';
print '<br>';
// Now show to ask to run command
print $langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user);
// Now show to ask to run command
print $langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user);
print '<br>';
print '<br>';
print '<br>';
print '<br>';
$what='';
$what='';
}
@@ -288,34 +335,189 @@ if ($what == 'postgresql')
// Si on a demande une generation
if ($what)
{
if ($errormsg)
{
print '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
// print '<a href="'.DOL_URL_ROOT.$relativepatherr.'">'.$langs->trans("DownloadErrorFile").'</a><br>';
print '<br>';
print '<br>';
}
else
{
print '<div class="ok">';
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
print $langs->trans("YouCanDownloadBackupFile");
print '</div>';
print '<br>';
}
if ($errormsg)
{
print '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
// print '<a href="'.DOL_URL_ROOT.$relativepatherr.'">'.$langs->trans("DownloadErrorFile").'</a><br>';
print '<br>';
print '<br>';
}
else
{
print '<div class="ok">';
print $langs->trans("BackupFileSuccessfullyCreated").'.<br>';
print $langs->trans("YouCanDownloadBackupFile");
print '</div>';
print '<br>';
}
}
$result=$formfile->show_documents('systemtools','backup',$conf->admin->dir_output.'/backup',$_SERVER['PHP_SELF'],0,1,'',1,0,0,54,0,'',$langs->trans("PreviousDumpFiles"));
if ($result == 0)
{
print $langs->trans("NoBackupFileAvailable").'<br>';
print $langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php').'<br>';
}
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,($langs->trans("NoBackupFileAvailable").'<br>'.$langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php')),0,$langs->trans("PreviousDumpFiles"));
print '<br>';
$time_end = time();
llxFooter('$Date: 2011/08/03 00:45:43 $ - $Revision: 1.45 $');
llxFooter();
$db->close();
// MYSQL NO BINARIES (only php)
/** Backup the db OR just a table without mysqldump binary (does not require any exec permission)
* Author: David Walsh (http://davidwalsh.name/backup-mysql-database-php)
* Updated and enhanced by Stephen Larroque (lrq3000) and by the many commentators from the blog
*
* @param string $outputfile Output file name
* @param string $tables Table name or '*' for all
* @return int <0 if KO, >0 if OK
*/
function backup_tables($outputfile, $tables='*')
{
global $db, $langs;
global $errormsg;
// Set to UTF-8
$db->query('SET NAMES utf8');
$db->query('SET CHARACTER SET utf8');
//get all of the tables
if ($tables == '*')
{
$tables = array();
$result = $db->query('SHOW FULL TABLES WHERE Table_type = \'BASE TABLE\'');
while($row = $db->fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
//cycle through
$handle = fopen($outputfile, 'w+');
if (fwrite($handle, '') === FALSE)
{
$langs->load("errors");
dol_syslog("Failed to open file ".$outputfile,LOG_ERR);
$errormsg=$langs->trans("ErrorFailedToWriteInDir");
return -1;
}
// Print headers and global mysql config vars
$sqlhead = '';
$sqlhead .= "-- ".$db->label." dump via php
--
-- Host: ".$db->db->host_info." Database: ".$db->database_name."
-- ------------------------------------------------------
-- Server version ".$db->db->server_info."
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
";
fwrite($handle, $sqlhead);
// Process each table and print their definition + their datas
foreach($tables as $table)
{
// Saving the table structure
fwrite($handle, "--\n-- Table structure for table `".$table."`\n--\n\n");
fwrite($handle,"DROP TABLE IF EXISTS `".$table."`;\n");
fwrite($handle,"/*!40101 SET @saved_cs_client = @@character_set_client */;\n");
fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n");
$resqldrop=$db->query('SHOW CREATE TABLE '.$table);
$row2 = $db->fetch_row($resqldrop);
fwrite($handle,$row2[1].";\n");
fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n");
// Dumping the data (locking the table and disabling the keys check while doing the process)
fwrite($handle, "--\n-- Dumping data for table `".$table."`\n--\n\n");
fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n");
fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n");
$sql='SELECT * FROM '.$table;
$result = $db->query($sql);
$num_fields = $db->num_rows($result);
while($row = $db->fetch_row($result)) {
// For each row of data we print a line of INSERT
fwrite($handle,'INSERT INTO `'.$table.'` VALUES (');
$columns = count($row);
$rowsarr = array();
for($j=0; $j<$columns; $j++) {
// Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier)
if ($row[$j] == null and !is_string($row[$j])) {
// IMPORTANT: if the field is NULL we set it NULL
$row[$j] = 'NULL';
} elseif(is_string($row[$j]) and $row[$j] == '') {
// if it's an empty string, we set it as an empty string
$row[$j] = "''";
} elseif(is_numeric($row[$j])) {
// if it's a number, we return it as-is
$row[$j] = $row[$j];
} else { // else for all other cases we escape the value and put quotes around
$row[$j] = addslashes($row[$j]);
$row[$j] = preg_replace("#\n#", "\\n", $row[$j]);
$row[$j] = "'".$row[$j]."'";
}
}
fwrite($handle,implode(',', $row).");\n");
}
fwrite($handle, "/*!40000 ALTER TABLE `".$table."` ENABLE KEYS */;\n"); // Enabling back the keys/index checking
fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the tables
fwrite($handle,"\n\n\n");
}
/* Backup Procedure structure*/
/*
$result = $db->query('SHOW PROCEDURE STATUS');
if ($db->num_rows($result) > 0)
{
while ($row = $db->fetch_row($result)) { $procedures[] = $row[1]; }
foreach($procedures as $proc)
{
fwrite($handle,"DELIMITER $$\n\n");
fwrite($handle,"DROP PROCEDURE IF EXISTS '$name'.'$proc'$$\n");
$resqlcreateproc=$db->query("SHOW CREATE PROCEDURE '$proc'");
$row2 = $db->fetch_row($resqlcreateproc);
fwrite($handle,"\n".$row2[2]."$$\n\n");
fwrite($handle,"DELIMITER ;\n\n");
}
}
*/
/* Backup Procedure structure*/
// Write the footer (restore the previous database settings)
$sqlfooter='';
$sqlfooter.="
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on ".date('Y-m-d G-i-s');
fwrite($handle, $sqlfooter);
fclose($handle);
return 1;
}
?>

View File

@@ -1051,7 +1051,7 @@ if ($id > 0 || ! empty($ref))
//'text' => $langs->trans("ConfirmClone"),
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $html->select_company(GETPOST('socid'),'socid','(s.client=1 OR s.client=3)'))
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $html->select_company(GETPOST('socid'),'socid','(s.client=1 OR s.client=2 OR s.client=3)'))
);
// Paiement incomplet. On demande si motif = escompte ou autre
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$object->ref),'confirm_clone',$formquestion,'yes',1);
@@ -1905,7 +1905,7 @@ else
print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
if ($objp->fk_statut == 1 && $objp->dfv < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
if ($objp->fk_statut == 1 && $db->jdate($objp->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td width="16" align="right" class="nobordernopadding">';

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.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
@@ -48,7 +48,8 @@ if ($user->societe_id > 0)
*/
$propalstatic=new Propal($db);
$html = new Form($db);
$companystatic=new Societe($db);
$form = new Form($db);
$formfile = new FormFile($db);
$help_url="EN:Module_Commercial_Proposals|FR:Module_Propositions_commerciales|ES:Módulo Presupuestos";
@@ -155,7 +156,7 @@ else
*/
if ($conf->propal->enabled)
{
$sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid";
$sql = "SELECT c.rowid, c.ref, s.nom as socname, s.rowid as socid, s.canvas, s.client";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -182,9 +183,18 @@ if ($conf->propal->enabled)
$var=!$var;
$obj = $db->fetch_object($resql);
print "<tr $bc[$var]>";
print '<td nowrap="nowrap">';
print "<a href=".DOL_URL_ROOT."/comm/propal.php?id=".$obj->rowid.">".img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref."</a></td>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'</a></td></tr>';
$propalstatic->id=$obj->rowid;
$propalstatic->ref=$obj->ref;
print '<td nowrap="nowrap">'.$propalstatic->getNomUrl(1).'</td>';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->socname;
$companystatic->client=$obj->client;
$companystatic->canvas=$obj->canvas;
print '<td>'.$companystatic->getNomUrl(1,'customer',24).'</td>';
print '</tr>';
$i++;
}
}
@@ -201,7 +211,7 @@ $max=5;
* Last modified proposals
*/
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom, s.rowid as socid,";
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,";
$sql.= " date_cloture as datec";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
@@ -255,7 +265,12 @@ if ($resql)
print '</td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->socname;
$companystatic->client=$obj->client;
$companystatic->canvas=$obj->canvas;
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,5).'</td>';
print '</tr>';
@@ -274,7 +289,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
{
$langs->load("propal");
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp";
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@@ -324,8 +339,13 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
print '</td></tr></table>';
print "</td>";
$companystatic->id=$obj->socid;
$companystatic->name=$obj->socname;
$companystatic->client=$obj->client;
$companystatic->canvas=$obj->canvas;
print '<td align="left">'.$companystatic->getNomUrl(1,'customer',44).'</td>'."\n";
print '<td align="left"><a href="fiche.php?socid='.$obj->rowid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,44).'</a></td>'."\n";
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
print '<td align="right">'.price($obj->total_ttc).'</td>';

View File

@@ -700,35 +700,35 @@ class Commande extends CommonObject
{
$this->ref="(PROV".$this->id.")";
// Add linked object
// Add linked object and contacts
if ($this->origin && $this->origin_id)
{
$ret = $this->add_object_linked();
if (! $ret) dol_print_error($this->db);
}
// TODO mutualiser
if ($this->origin == 'propal' && $this->origin_id)
{
// On recupere les differents contact interne et externe
$prop = new Propal($this->db, $this->socid, $this->origin_id);
// On recupere le commercial suivi propale
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid)
{
//On passe le commercial suivi propale en commercial suivi commande
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}
// On recupere le contact client suivi propale
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');
if ($this->contactid)
{
//On passe le contact client suivi propale en contact client suivi commande
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
// TODO mutualiser
if ($this->origin == 'propal')
{
// On recupere les differents contact interne et externe
$prop = new Propal($this->db, $this->socid, $this->origin_id);
// On recupere le commercial suivi propale
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid)
{
//On passe le commercial suivi propale en commercial suivi commande
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}
// On recupere le contact client suivi propale
$this->contactid = $prop->getIdcontact('external', 'CUSTOMER');
if ($this->contactid)
{
//On passe le contact client suivi propale en contact client suivi commande
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
}
}
}
}

View File

@@ -1190,6 +1190,9 @@ if ($action == 'create' && $user->rights->commande->creer)
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : '');
// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1,'external',1);
@@ -1327,8 +1330,8 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top" colspan="2">';
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">';
print '</textarea></td></tr>';
print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>';
// Note privee
if (! $user->societe_id)
@@ -1336,8 +1339,8 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
print '<td valign="top" colspan="2">';
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">';
print '</textarea></td></tr>';
print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
print '</td></tr>';
}
if (is_object($objectsrc))

View File

@@ -38,8 +38,12 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php');
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php');
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
if ($conf->projet->enabled)
{
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php');
}
$langs->load('bills');
//print 'ee'.$langs->trans('BillsCustomer');exit;
@@ -2286,7 +2290,8 @@ else
{
// Remise dispo de type avoir
if (! $absolute_discount) print '<br>';
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
//$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
$html->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We must allow credit not even if amount is higher
}
}
if (! $absolute_discount && ! $absolute_creditnote)

View File

@@ -275,6 +275,32 @@ class Facture extends CommonObject
dol_print_error($this->db);
$error++;
}
// TODO mutualiser
if ($this->origin == 'commande')
{
// On recupere les differents contact interne et externe
$order = new Commande($this->db);
$order->id = $this->origin_id;
// On recupere le commercial suivi propale
$this->userid = $order->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid)
{
//On passe le commercial suivi commande en commercial suivi paiement
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}
// On recupere le contact client facturation commande
$this->contactid = $order->getIdcontact('external', 'BILLING');
if ($this->contactid)
{
//On passe le contact client facturation commande en contact client facturation
$this->add_contact($this->contactid[0], 'BILLING', 'external');
}
}
}
/*

View File

@@ -54,8 +54,8 @@ $html=new Form($db);
$year_current = strftime("%Y",dol_now());
$pastmonth = strftime("%m",dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0)
$pastmonthyear = $year_current;
if ($pastmonth == 0)
{
$pastmonth = 12;
$pastmonthyear--;
@@ -156,17 +156,6 @@ foreach ($tabfac as $key => $val)
$invoicestatic->ref=$val["ref"];
$invoicestatic->type=$val["type"];
print "<tr ".$bc[$var]." >";
// third party
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
print "<td>".$val["date"]."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
foreach ($tabttc[$key] as $k => $mt)
{
print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td><td align='right'>".($mt>=0?price($mt):'')."</td><td align='right'>".($mt<0?-price(-$mt):'')."</td>";
}
print "</tr>";
// product
foreach ($tabht[$key] as $k => $mt)
{
@@ -176,7 +165,10 @@ foreach ($tabfac as $key => $val)
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
print "<td>".$val["date"]."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
print "<td>".$k."</td><td>".$langs->trans("Products")."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
print "<td>".$k."</td><td>".$langs->trans("Products")."</td>";
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
print "</tr>";
}
}
// vat
@@ -189,9 +181,24 @@ foreach ($tabfac as $key => $val)
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
print "<td>".$val["date"]."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
print "<td>".$k."</td><td>".$langs->trans("VAT")." ".$key."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
print "<td>".$k."</td><td>".$langs->trans("VAT")." ".$key."</td>";
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
print "</tr>";
}
}
print "<tr ".$bc[$var]." >";
// third party
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
print "<td>".$val["date"]."</td>";
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
foreach ($tabttc[$key] as $k => $mt)
{
print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td>";
print '<td align="right">'.($mt<0?-price(-$mt):'')."</td>";
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
}
print "</tr>";
$var = !$var;
}

View File

@@ -30,7 +30,7 @@
* \version $Id: filefunc.inc.php,v 1.22 2011/08/04 12:07:29 eldy Exp $
*/
define('DOL_VERSION','3.1.1'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z)
define('DOL_VERSION','3.1.3'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z)
define('EURO',chr(128));
// Definition des constantes syslog

View File

@@ -1194,7 +1194,7 @@ if ($id > 0 || ! empty($ref))
print '</td>';
print '<td>';
print $html->load_tva('tva_tx',$line->tva_tx);
print $form->load_tva('tva_tx',$line->tva_tx,$soc,$mysoc);
print '</td>';
print '<td align="right"><input size="5" type="text" name="pu" value="'.price($line->subprice).'"></td>';
print '<td align="right"><input size="2" type="text" name="qty" value="'.$line->qty.'"></td>';

View File

@@ -161,9 +161,9 @@ class Import
}
}
}
closedir($handle);
}
}
closedir($handle);
}

View File

@@ -82,7 +82,7 @@ class mailing_contacts3 extends MailingTargets
$sql.= " AND sp.entity = ".$conf->entity;
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_societe = sp.fk_soc";
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db>escape($filtersarray[0])."'";
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'";
$sql.= " ORDER BY sp.name, sp.firstname";
$resql = $this->db->query($sql);

View File

@@ -394,8 +394,8 @@ else
$dolibarrversiontoarray=preg_split('/[\.-]/',$versionto);
$version=preg_split('/[\.-]/',DOL_VERSION);
$newversionfrombis='';
if (versioncompare($dolibarrversiontoarray,$version) < -2) $newversionfrombis='/'.$versionto;
print '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.' -> '.$newversionto.'</b></td>';
if (versioncompare($dolibarrversiontoarray,$version) < -2) $newversionfrombis=' '.$langs->trans("or").' '.$versionto;
print '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.$newversionfrombis.' -> '.$newversionto.'</b></td>';
print '<td>';
print $langs->trans("UpgradeDesc");
if ($ok)

View File

@@ -24,7 +24,7 @@
* \version $Id: inc.php,v 1.139 2011/08/05 23:47:34 eldy Exp $
*/
define('DOL_VERSION','3.1.1'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z)
define('DOL_VERSION','3.1.3'); // Also defined in htdocs/filefunc.inc.php (Ex: x.y.z-alpha, x.y.z)
require_once('../core/class/translate.class.php');
require_once('../lib/functions.lib.php');
@@ -408,4 +408,4 @@ function dolibarr_install_syslog($message, $level=LOG_DEBUG)
dol_syslog($message,$level);
}
?>
?>

View File

@@ -347,40 +347,46 @@ class DoliDb
{
// use pg_connect() instead of pg_pconnect():
// To us persistent connection because this one cost 1ms, non persistent cost 30ms
$this->db = false;
// connections parameters must be protected (only \ and ' according to pg_connect() manual)
$host = str_replace(array("\\", "'"), array("\\\\", "\\'"), $host);
$login = str_replace(array("\\", "'"), array("\\\\", "\\'"), $login);
$passwd = str_replace(array("\\", "'"), array("\\\\", "\\'"), $passwd);
$name = str_replace(array("\\", "'"), array("\\\\", "\\'"), $name);
$port = str_replace(array("\\", "'"), array("\\\\", "\\'"), $port);
//if (! $name) $name="postgres";
// try first Unix domain socket (local)
if (! $host || $host == "" || $host == "localhost")
{
$con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'";
$this->db = pg_connect($con_string);
}
// if local connection failed or not requested, use TCP/IP
if (! $this->db)
{
if (! $host) $host = "localhost";
if (! $port) $port = 5432;
$con_string = "host='".$host."' port='".$port."' dbname='".$name."' user='".$login."' password='".$passwd."'";
$this->db = pg_connect($con_string);
if ($this->db)
{
$this->database_name = $name;
pg_set_error_verbosity($this->db, PGSQL_ERRORS_VERBOSE); // Set verbosity to max
}
}
else
{
$this->database_name = $name;
pg_set_error_verbosity($this->db, PGSQL_ERRORS_VERBOSE); // Set verbosity to max
}
return $this->db;
}

View File

@@ -208,25 +208,25 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($targetcompany->tva_intra) $stringaddress.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
// Professionnal Ids
if ($conf->global->MAIN_PROFID1_IN_ADDRESS)
if (! empty($conf->global->MAIN_PROFID1_IN_ADDRESS) && ! empty($targetcompany->idprof1))
{
$tmp=$outputlangs->transcountrynoentities("ProfId1",$targetcompany->pays_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof1);
}
if ($conf->global->MAIN_PROFID2_IN_ADDRESS)
if (! empty($conf->global->MAIN_PROFID2_IN_ADDRESS) && ! empty($targetcompany->idprof2))
{
$tmp=$outputlangs->transcountrynoentities("ProfId2",$targetcompany->pays_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof2);
}
if ($conf->global->MAIN_PROFID3_IN_ADDRESS)
if (! empty($conf->global->MAIN_PROFID3_IN_ADDRESS) && ! empty($targetcompany->idprof3))
{
$tmp=$outputlangs->transcountrynoentities("ProfId3",$targetcompany->pays_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof3);
}
if ($conf->global->MAIN_PROFID4_IN_ADDRESS)
if (! empty($conf->global->MAIN_PROFID4_IN_ADDRESS) && ! empty($targetcompany->idprof4))
{
$tmp=$outputlangs->transcountrynoentities("ProfId4",$targetcompany->pays_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];

View File

@@ -2330,11 +2330,16 @@ class Product extends CommonObject
*/
function load_stock()
{
global $conf;
$this->stock_reel = 0;
$sql = "SELECT reel, fk_entrepot, pmp";
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock";
$sql.= " WHERE fk_product = '".$this->id."'";
$sql = "SELECT ps.reel, ps.fk_entrepot, ps.pmp";
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps";
$sql.= ", ".MAIN_DB_PREFIX."entrepot as w";
$sql.= " WHERE w.entity = ".$conf->entity;
$sql.= " AND w.rowid = ps.fk_entrepot";
$sql.= " AND ps.fk_product = ".$this->id;
dol_syslog("Product::load_stock sql=".$sql);
$result = $this->db->query($sql) ;

View File

@@ -70,6 +70,8 @@ class Entrepot extends CommonObject
*/
function create($user)
{
global $conf;
// Si libelle non defini, erreur
if ($this->libelle == '')
{
@@ -79,8 +81,8 @@ class Entrepot extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (datec, fk_user_author, label)";
$sql .= " VALUES (".$this->db->idate(mktime()).",".$user->id.",'".$this->db->escape($this->libelle)."')";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (entity, datec, fk_user_author, label)";
$sql .= " VALUES (".$conf->entity.",'".$this->db->idate(mktime())."',".$user->id.",'".$this->db->escape($this->libelle)."')";
dol_syslog("Entrepot::create sql=".$sql);
$result=$this->db->query($sql);

View File

@@ -209,6 +209,7 @@ if ($_GET["id"] || $_GET["ref"])
print '</tr>';
// Real stock
$product->load_stock();
print '<tr><td>'.$langs->trans("PhysicalStock").'</td>';
print '<td>'.$product->stock_reel;
if ($product->seuil_stock_alerte && ($product->stock_reel < $product->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockTooLow"));

View File

@@ -24,7 +24,7 @@
* \version $Id: inc.php,v 1.32 2011/08/07 13:10:26 eldy Exp $
*/
define('DOL_VERSION','3.1.1'); // Also defined in htdocs/master.inc.php
define('DOL_VERSION','3.1.2'); // Also defined in htdocs/master.inc.php
require_once('../core/class/translate.class.php');
require_once('../lib/functions.lib.php');

View File

@@ -45,14 +45,14 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$canreaduser=($user->admin || ($user->rights->user->user->lire && $user->rights->user->user_advance->readperms));
$caneditselfperms=($user->id == $id && $user->rights->user->self_advance->writeperms);
$caneditperms = '('.$caneditperms.' || '.$caneditselfperms.')';
$caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
}
// Security check
$socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id;
$feature2 = (($socid && $user->rights->user->self->creer)?'':'user');
if ($user->id == $id) // A user can always read its own card
if ($user->id == $id && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->user->self_advance->readperms)) // A user can always read its own card if not advanced perms enabled, or if he has advanced perms
{
$feature2='';
$canreaduser=1;