This commit is contained in:
Laurent Destailleur 2012-08-03 10:29:00 +02:00
commit 18944a3d9b
37 changed files with 414 additions and 363 deletions

View File

@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -27,10 +28,13 @@ require("../../main.inc.php");
$langs->load("admin"); $langs->load("admin");
if (!$user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
$action=GETPOST('action','alpha');
if ($_GET["action"] == 'convert') if ($action == 'convert')
{ {
$db->query("alter table ".$_GET["table"]." ENGINE=INNODB"); $db->query("alter table ".$_GET["table"]." ENGINE=INNODB");
} }
@ -103,7 +107,7 @@ else
print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>'; print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>';
print '<td>'.$obj->Engine.'</td>'; print '<td>'.$obj->Engine.'</td>';
if ($row[1] == "MyISAM") if (isset($row[1]) && $row[1] == "MyISAM")
{ {
print '<td><a href="database-tables.php?action=convert&amp;table='.$row[0].'">'.$langs->trans("Convert").'</a></td>'; print '<td><a href="database-tables.php?action=convert&amp;table='.$row[0].'">'.$langs->trans("Convert").'</a></td>';
} }
@ -138,7 +142,9 @@ else
print '<td>Nb tuples modify</td>'; print '<td>Nb tuples modify</td>';
print '<td>Nb tuples delete</td>'; print '<td>Nb tuples delete</td>';
print "</tr>\n"; print "</tr>\n";
$sql = "select relname,seq_tup_read,idx_tup_fetch,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;";
$sql = "SELECT relname, seq_tup_read, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del";
$sql.= " FROM pg_stat_user_tables";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -166,4 +172,5 @@ else
} }
llxFooter(); llxFooter();
?> $db->close();
?>

View File

@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -27,8 +28,10 @@ require("../../main.inc.php");
$langs->load("admin"); $langs->load("admin");
if (! $user->admin)
accessforbidden();
if (!$user->admin) accessforbidden(); $table=GETPOST('table','alpha');
/* /*
@ -38,31 +41,29 @@ if (!$user->admin) accessforbidden();
llxHeader(); llxHeader();
print_fiche_titre($langs->trans("Table") . " ".$_GET["table"],'','setup'); print_fiche_titre($langs->trans("Table") . " ".$table,'','setup');
// Define request to get table description // Define request to get table description
$base=0; $base=0;
if (preg_match('/mysql/i',$conf->db->type)) if (preg_match('/mysql/i',$conf->db->type))
{ {
$sql = "SHOW TABLE STATUS LIKE '".$_GET["table"]."'"; $sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'";
$base=1; $base=1;
} }
else if ($conf->db->type == 'pgsql')
if ($conf->db->type == 'pgsql')
{ {
$sql = "SELECT conname,contype FROM pg_constraint"; $sql = "SELECT conname,contype FROM pg_constraint";
$base=2; $base=2;
} }
if (! $base) if (! $base)
{ {
print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver"); print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
} }
else else
{ {
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$var=True; $var=True;
@ -74,24 +75,24 @@ else
} }
} }
if ($base == 1)
if ($base==1)
{ {
$link=array();
$cons = explode(";",$row[14]); $cons = explode(";", $row[14]);
if (! empty($cons))
foreach ($cons as $cc)
{ {
$cx = preg_replace("/\)\sREFER/", "", $cc); foreach($cons as $cc)
$cx = preg_replace("/\(`/", "", $cx); {
$cx = preg_replace("/`\)/", "", $cx); $cx = preg_replace("/\)\sREFER/", "", $cc);
$cx = preg_replace("/`\s/", "", $cx); $cx = preg_replace("/\(`/", "", $cx);
$cx = preg_replace("/`\)/", "", $cx);
$cx = preg_replace("/`\s/", "", $cx);
$val = explode("`",$cx); $val = explode("`",$cx);
$link[trim($val[0])][0] = $val[1];
$link[trim($val[0])][1] = $val[2];
$link[trim($val[0])][0] = (isset($val[1])?$val[1]:'');
$link[trim($val[0])][1] = (isset($val[2])?$val[2]:'');
}
} }
// var_dump($link); // var_dump($link);
@ -100,26 +101,24 @@ else
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"><td>'.$langs->trans("Fields").'</td><td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Index").'</td>';
print '<td>'.$langs->trans("FieldsLinked").'</td></tr>'; print '<td>'.$langs->trans("FieldsLinked").'</td></tr>';
$sql = "DESCRIBE ".$_GET["table"]; $sql = "DESCRIBE ".$table;
$result = $db->query($sql); $resql = $db->query($sql);
if ($result) if ($resql)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($resql);
$var=True; $var=True;
$i=0; $i=0;
while ($i < $num) while ($i < $num)
{ {
$row = $db->fetch_row($result); $row = $db->fetch_row($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
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>".$link[$row[0]][0]."."; print "<td>".(isset($link[$row[0]][0])?$link[$row[0]][0]:'').".";
print $link[$row[0]][1]."</td>"; print (isset($link[$row[0]][1])?$link[$row[0]][1]:'')."</td>";
print '</tr>'; print '</tr>';
$i++; $i++;
@ -130,4 +129,5 @@ else
} }
llxFooter(); llxFooter();
?> $db->close();
?>

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -29,8 +30,8 @@ $langs->load("admin");
$langs->load("install"); $langs->load("install");
$langs->load("other"); $langs->load("other");
if (!$user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
/* /*
@ -153,7 +154,7 @@ if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="300">&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td>'; print '<tr '.$bc[$var].'><td width="300">&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td>';
// Timezone // Timezone
$txt =$langs->trans("OSTZ").' (variable system TZ): '.($_ENV["TZ"]?$_ENV["TZ"]:$langs->trans("NotDefined")).'<br>'."\n"; $txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'<br>'."\n";
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
@ -212,4 +213,4 @@ print '<br>';
llxFooter(); llxFooter();
$db->close(); $db->close();
?> ?>

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -29,7 +29,8 @@ $langs->load("admin");
$langs->load("install"); $langs->load("install");
$langs->load("other"); $langs->load("other");
if (!$user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
/* /*
@ -123,12 +124,14 @@ foreach($sortorder as $numero=>$name)
print '</table>'; print '</table>';
print '<br>'; print '<br>';
sort($rights_ids); sort($rights_ids);
$old='';
foreach($rights_ids as $right_id) foreach($rights_ids as $right_id)
{ {
if ($old == $right_id) if ($old == $right_id)
print "Warning duplicate id on permission : ".$right_id."<br>"; print "Warning duplicate id on permission : ".$right_id."<br>";
$old = $right_id; $old = $right_id;
} }
llxFooter(); llxFooter();
?> $db->close();
?>

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -25,8 +26,10 @@ require("../../main.inc.php");
$langs->load("admin"); $langs->load("admin");
if (!$user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
$what=GETPOST('what','alpha');
/* /*
@ -61,17 +64,17 @@ llxHeader();
ob_start(); ob_start();
if ($_GET["what"] == 'conf') if ($what == 'conf')
{ {
$title = 'Setup'; $title = 'Setup';
phpinfo(INFO_CONFIGURATION); phpinfo(INFO_CONFIGURATION);
} }
elseif ($_GET["what"] == 'env') elseif ($what == 'env')
{ {
$title = 'OSEnv'; $title = 'OSEnv';
phpinfo(INFO_ENVIRONMENT); phpinfo(INFO_ENVIRONMENT);
} }
elseif ($_GET["what"] == 'modules') elseif ($what == 'modules')
{ {
$title = 'Modules'; $title = 'Modules';
phpinfo(INFO_MODULES); phpinfo(INFO_MODULES);
@ -115,4 +118,5 @@ print "$chaine\n"; // Ne pas centrer la reponse php car certains tableau du bas
print "<br>\n"; print "<br>\n";
llxFooter(); llxFooter();
?> $db->close();
?>

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -28,19 +29,19 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
$langs->load("admin"); $langs->load("admin");
$action=GETPOST('action'); $action=GETPOST('action','alpha');
$sortfield = GETPOST("sortfield"); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST("sortorder"); $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST("page"); $page = GETPOST('page','int');
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="date"; if (! $sortfield) $sortfield="date";
if ($page < 0) { $page = 0; } if ($page < 0) { $page = 0; }
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$offset = $limit * $page; $offset = $limit * $page;
if (! $user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
/* /*
@ -115,13 +116,6 @@ print $langs->trans("BackupDescX").'<br><br>';
print $langs->trans("BackupDesc3",DOL_DATA_ROOT).'<br>'; print $langs->trans("BackupDesc3",DOL_DATA_ROOT).'<br>';
print $langs->trans("BackupDescY").'<br><br>'; print $langs->trans("BackupDescY").'<br><br>';
if ($_GET["msg"])
{
print '<div class="error">'.$_GET["msg"].'</div>';
print '<br>';
print "\n";
}
?> ?>

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,7 +27,11 @@ require("../../main.inc.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("other"); $langs->load("other");
if (! $user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
$radio_dump=GETPOST('radio_dump');
$showpass=GETPOST('showpass');
/* /*
@ -41,8 +46,8 @@ llxHeader('','',$help_url);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#mysql_options").<?php echo GETPOST('radio_dump')=='mysql_options'?'show()':'hide()'; ?>; jQuery("#mysql_options").<?php echo $radio_dump=='mysql_options'?'show()':'hide()'; ?>;
jQuery("#postgresql_options").<?php echo GETPOST('radio_dump')=='postgresql_options'?'show()':'hide()'; ?>; jQuery("#postgresql_options").<?php echo $radio_dump=='postgresql_options'?'show()':'hide()'; ?>;
jQuery("#radio_dump_mysql").click(function() { jQuery("#radio_dump_mysql").click(function() {
jQuery("#mysql_options").show(); jQuery("#mysql_options").show();
@ -79,7 +84,7 @@ print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';
{ {
?> ?>
<div class="formelementrow"> <div class="formelementrow">
<input type="radio" name="what" value="mysql" id="radio_dump_mysql"<?php echo ($_GET["radio_dump"]=='mysql_options'?' checked':''); ?> /> <input type="radio" name="what" value="mysql" id="radio_dump_mysql"<?php echo ($radio_dump=='mysql_options'?' checked':''); ?> />
<label for="radio_dump_mysql">MySQL (mysql)</label> <label for="radio_dump_mysql">MySQL (mysql)</label>
</div> </div>
<?php <?php
@ -88,7 +93,7 @@ print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'<br><br>';
{ {
?> ?>
<div class="formelementrow"> <div class="formelementrow">
<input type="radio" name="what" value="mysql" id="radio_dump_postgresql"<?php echo ($_GET["radio_dump"]=='postgresql_options'?' checked':''); ?> /> <input type="radio" name="what" value="mysql" id="radio_dump_postgresql"<?php echo ($radio_dump=='postgresql_options'?' checked':''); ?> />
<label for="radio_dump_postgresql">PostgreSQL Restore (pg_restore)</label> <label for="radio_dump_postgresql">PostgreSQL Restore (pg_restore)</label>
</div> </div>
<?php <?php
@ -132,7 +137,7 @@ if ($label == 'MySQL')
echo $langs->trans("ImportMySqlDesc"); echo $langs->trans("ImportMySqlDesc");
print '<br>'; print '<br>';
print '<textarea rows="1" cols="120">'.$langs->trans("ImportMySqlCommand",$command,$_GET["showpass"]?$paramclear:$paramcrypted).'</textarea><br>'; print '<textarea rows="1" cols="120">'.$langs->trans("ImportMySqlCommand",$command,($showpass?$paramclear:$paramcrypted)).'</textarea><br>';
if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>'; if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>';
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>'; //else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
@ -168,7 +173,7 @@ else if ($label == 'PostgreSQL')
echo $langs->trans("ImportPostgreSqlDesc"); echo $langs->trans("ImportPostgreSqlDesc");
print '<br>'; print '<br>';
print '<textarea rows="1" cols="120">'.$langs->trans("ImportPostgreSqlCommand",$command,$_GET["showpass"]?$paramclear:$paramcrypted).'</textarea><br>'; print '<textarea rows="1" cols="120">'.$langs->trans("ImportPostgreSqlCommand",$command,($showpass?$paramclear:$paramcrypted)).'</textarea><br>';
//if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>'; //if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>';
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>'; //else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,8 +27,8 @@ require("../../main.inc.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("companies"); $langs->load("companies");
if (!$user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
/* /*
@ -38,21 +39,14 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
print_fiche_titre($langs->trans("SystemToolsArea"),'','setup'); print_fiche_titre($langs->trans("SystemToolsArea"),'','setup');
print $langs->trans("SystemToolsAreaDesc").'<br>'; print $langs->trans("SystemToolsAreaDesc").'<br>';
print "<br>"; print "<br>";
if ($message) print $message.'<br>';
print info_admin($langs->trans("SystemAreaForAdminOnly")).'<br>'; print info_admin($langs->trans("SystemAreaForAdminOnly")).'<br>';
$db->close();
llxFooter(); llxFooter();
?> $db->close();
?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2012 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 * 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 * it under the terms of the GNU General Public License as published by
@ -25,9 +25,11 @@
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/core/class/events.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/class/events.class.php');
$action=GETPOST('action'); if (! $user->admin)
accessforbidden();
if (! $user->admin) accessforbidden(); $action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm','alpha');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
@ -65,7 +67,7 @@ $search_ua = GETPOST("search_ua");
$now=dol_now(); $now=dol_now();
// Purge audit events // Purge audit events
if ($action == 'confirm_purge' && $_REQUEST['confirm'] == 'yes' && $user->admin) if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
{ {
$error=0; $error=0;
@ -81,7 +83,7 @@ if ($action == 'confirm_purge' && $_REQUEST['confirm'] == 'yes' && $user->admin)
if (! $resql) if (! $resql)
{ {
$error++; $error++;
$mesg='<div class="error">'.$db->lasterror().'</div>'; setEventMessage($db->lasterror(), 'errors');
} }
// Add event purge // Add event purge
@ -122,11 +124,11 @@ $sql.= " u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."events as e"; $sql.= " FROM ".MAIN_DB_PREFIX."events as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
$sql.= " WHERE e.entity = ".$conf->entity; $sql.= " WHERE e.entity = ".$conf->entity;
if ($search_code) { $usefilter++; $sql.=" AND e.type like '%".$search_code."%'"; } if ($search_code) { $usefilter++; $sql.=" AND e.type LIKE '%".$search_code."%'"; }
if ($search_ip) { $usefilter++; $sql.=" AND e.ip like '%".$search_ip."%'"; } if ($search_ip) { $usefilter++; $sql.=" AND e.ip LIKE '%".$search_ip."%'"; }
if ($search_user) { $usefilter++; $sql.=" AND u.login like '%".$search_user."%'"; } if ($search_user) { $usefilter++; $sql.=" AND u.login LIKE '%".$search_user."%'"; }
if ($search_desc) { $usefilter++; $sql.=" AND e.description like '%".$search_desc."%'"; } if ($search_desc) { $usefilter++; $sql.=" AND e.description LIKE '%".$search_desc."%'"; }
if ($search_ua) { $usefilter++; $sql.=" AND e.user_agent like '%".$search_ua."%'"; } if ($search_ua) { $usefilter++; $sql.=" AND e.user_agent LIKE '%".$search_ua."%'"; }
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($conf->liste_limit+1, $offset);
//print $sql; //print $sql;
@ -138,7 +140,7 @@ if ($result)
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup'); print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup');
if ($_GET["action"] == 'purge') if ($action == 'purge')
{ {
$formquestion=array(); $formquestion=array();
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1);
@ -188,7 +190,7 @@ if ($result)
$var=True; $var=True;
while ($i < min($num,$conf->liste_limit)) while ($i < min($num, $conf->liste_limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
@ -259,7 +261,7 @@ else
dol_print_error($db); dol_print_error($db);
} }
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2012 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 * 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 * it under the terms of the GNU General Public License as published by
@ -27,7 +27,11 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php');
$langs->load("install"); $langs->load("install");
if (! $user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
$action=GETPOST('action', 'alpha');
$confirm=GETPOST('confirm', 'alpha');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
@ -56,13 +60,13 @@ if (! $sortfield) $sortfield="dateevent";
*/ */
// Purge sessions // Purge sessions
if ($_REQUEST['action'] == 'confirm_purge' && $_REQUEST['confirm'] == 'yes' && $user->admin) if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
{ {
$res=purgeSessions(session_id()); $res=purgeSessions(session_id());
} }
// Lock new sessions // Lock new sessions
if ($_REQUEST['action'] == 'confirm_lock' && $_REQUEST['confirm'] == 'yes' && $user->admin) if ($action == 'confirm_lock' && $confirm == 'yes' && $user->admin)
{ {
if (dolibarr_set_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', $user->login, 'text',1,'Logon is restricted to a particular user', 0) < 0) if (dolibarr_set_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', $user->login, 'text',1,'Logon is restricted to a particular user', 0) < 0)
{ {
@ -71,7 +75,7 @@ if ($_REQUEST['action'] == 'confirm_lock' && $_REQUEST['confirm'] == 'yes' && $u
} }
// Unlock new sessions // Unlock new sessions
if ($_REQUEST['action'] == 'confirm_unlock' && $user->admin) if ($action == 'confirm_unlock' && $user->admin)
{ {
if (dolibarr_del_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', -1) < 0) if (dolibarr_del_const($db, 'MAIN_ONLY_LOGIN_ALLOWED', -1) < 0)
{ {
@ -93,6 +97,7 @@ $userstatic=new User($db);
$usefilter=0; $usefilter=0;
$listofsessions=listOfSessions(); $listofsessions=listOfSessions();
$num=count($listofsessions);
print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup'); print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup');
@ -105,13 +110,13 @@ print '<b>'.$langs->trans("SessionSavePath").'</b>: '.$savepath.'<br>';
if ($openbasedir) print '<b>'.$langs->trans("OpenBaseDir").'</b>: '.$openbasedir.'<br>'; if ($openbasedir) print '<b>'.$langs->trans("OpenBaseDir").'</b>: '.$openbasedir.'<br>';
print '<br>'; print '<br>';
if ($_GET["action"] == 'purge') if ($action == 'purge')
{ {
$formquestion=array(); $formquestion=array();
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeSessions'), $langs->trans('ConfirmPurgeSessions'),'confirm_purge',$formquestion,'no',2); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeSessions'), $langs->trans('ConfirmPurgeSessions'),'confirm_purge',$formquestion,'no',2);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
if ($_GET["action"] == 'lock') else if ($action == 'lock')
{ {
$formquestion=array(); $formquestion=array();
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('LockNewSessions'), $langs->trans('ConfirmLockNewSessions',$user->login),'confirm_lock',$formquestion,'no',1); $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('LockNewSessions'), $langs->trans('ConfirmLockNewSessions',$user->login),'confirm_lock',$formquestion,'no',1);
@ -206,7 +211,6 @@ print '</div>';
print '<br>'; print '<br>';
$db->close();
llxFooter(); llxFooter();
?> $db->close();
?>

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -25,13 +26,13 @@ include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
$langs->load("admin"); $langs->load("admin");
$action=GETPOST('action'); if (! $user->admin)
$confirm=GETPOST('confirm'); accessforbidden();
$action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha');
$choice=GETPOST('choice'); $choice=GETPOST('choice');
if (! $user->admin) accessforbidden();
if ($_GET["msg"]) $message='<div class="error">'.$_GET["msg"].'</div>';
// Define filelog to discard it from purge // Define filelog to discard it from purge
$filelog=''; $filelog='';
@ -94,7 +95,7 @@ if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allf
} }
// Update cachenbofdoc // Update cachenbofdoc
if ($conf->ecm->enabled && $choice=='allfiles') if (! empty($conf->ecm->enabled) && $choice=='allfiles')
{ {
require_once(DOL_DOCUMENT_ROOT."/ecm/class/ecmdirectory.class.php"); require_once(DOL_DOCUMENT_ROOT."/ecm/class/ecmdirectory.class.php");
$ecmdirstatic = new EcmDirectory($db); $ecmdirstatic = new EcmDirectory($db);
@ -102,9 +103,9 @@ if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allf
} }
} }
if ($count) $message=$langs->trans("PurgeNDirectoriesDeleted",$count); if ($count) $mesg=$langs->trans("PurgeNDirectoriesDeleted", $count);
else $message=$langs->trans("PurgeNothingToDelete"); else $mesg=$langs->trans("PurgeNothingToDelete");
$message='<div class="ok">'.$message.'</div>'; setEventMessage($mesg);
} }
@ -123,9 +124,8 @@ print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="purge" />';
print '<input type="hidden" name="action" value="purge">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -156,13 +156,6 @@ if ($choice != 'confirm_allfiles')
print '</form>'; print '</form>';
if ($message)
{
print '<br>'.$message.'<br>';
print "\n";
}
if (preg_match('/^confirm/i',$choice)) if (preg_match('/^confirm/i',$choice))
{ {
print '<br>'; print '<br>';
@ -172,6 +165,5 @@ if (preg_match('/^confirm/i',$choice))
llxFooter(); llxFooter();
$db->close(); $db->close();
?> ?>

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -40,7 +40,7 @@ $socid=0;
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref = GETPOST("ref"); $ref = GETPOST("ref");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'propale', $id, 'propal'); $result = restrictedArea($user, 'propal', $id);
/* /*

View File

@ -309,7 +309,7 @@ class Propal extends CommonObject
* *
* @see add_product * @see add_product
*/ */
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht = 0) function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht = 0)
{ {
global $conf; global $conf;
@ -399,9 +399,9 @@ class Propal extends CommonObject
$this->line->special_code=$special_code; $this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line; $this->line->fk_parent_line=$fk_parent_line;
// infos marge // infos marge
$this->line->fk_fournprice = $fk_fournprice; $this->line->fk_fournprice = $fk_fournprice;
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
// Mise en option de la ligne // Mise en option de la ligne
//if ($conf->global->PROPALE_USE_OPTION_LINE && !$qty) $ligne->special_code=3; //if ($conf->global->PROPALE_USE_OPTION_LINE && !$qty) $ligne->special_code=3;
@ -1072,9 +1072,9 @@ class Propal extends CommonObject
/* /*
* Lignes propales liees a un produit ou non * Lignes propales liees a un produit ou non
*/ */
$sql = "SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,"; $sql = "SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,";
$sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,"; $sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,";
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label'; $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label';
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d"; $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
@ -1113,11 +1113,11 @@ class Propal extends CommonObject
$line->total_localtax1 = $objp->total_localtax1; $line->total_localtax1 = $objp->total_localtax1;
$line->total_localtax2 = $objp->total_localtax2; $line->total_localtax2 = $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc; $line->total_ttc = $objp->total_ttc;
$line->fk_fournprice = $objp->fk_fournprice; $line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
$line->pa_ht = $marginInfos[0]; $line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1]; $line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2]; $line->marque_tx = $marginInfos[2];
$line->special_code = $objp->special_code; $line->special_code = $objp->special_code;
$line->rang = $objp->rang; $line->rang = $objp->rang;
@ -2381,7 +2381,7 @@ class Propal extends CommonObject
$sql = 'SELECT pt.rowid, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql = 'SELECT pt.rowid, pt.description, pt.fk_product, pt.fk_remise_except,';
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
$sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang,'; $sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,';
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
$sql.= ' p.description as product_desc'; $sql.= ' p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt'; $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
@ -2400,7 +2400,8 @@ class Propal extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->lines[$i] = (object) array(); $this->lines[$i] = (object) array();
$this->lines[$i]->id = $obj->rowid; $this->lines[$i]->id = $obj->rowid; // for backward compatibility
$this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->description = $obj->description; $this->lines[$i]->description = $obj->description;
$this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->ref = $obj->ref; $this->lines[$i]->ref = $obj->ref;
@ -2417,11 +2418,12 @@ class Propal extends CommonObject
$this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_ttc = $obj->total_ttc; $this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice; $this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht);
$this->lines[$i]->pa_ht = $marginInfos[0]; $this->lines[$i]->pa_ht = $marginInfos[0];
$this->lines[$i]->marge_tx = $marginInfos[1]; $this->lines[$i]->marge_tx = $marginInfos[1];
$this->lines[$i]->marque_tx = $marginInfos[2]; $this->lines[$i]->marque_tx = $marginInfos[2];
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->special_code = $obj->special_code;
$this->lines[$i]->rang = $obj->rang; $this->lines[$i]->rang = $obj->rang;
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start); $this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
@ -2436,7 +2438,7 @@ class Propal extends CommonObject
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("Error sql=$sql, error=".$this->error,LOG_ERR); dol_syslog(get_class($this)."::getLinesArray Error sql=$sql, error=".$this->error,LOG_ERR);
return -1; return -1;
} }
} }
@ -2471,10 +2473,10 @@ class PropaleLigne
var $rang = 0; var $rang = 0;
var $fk_fournprice; var $fk_fournprice;
var $pa_ht; var $pa_ht;
var $marge_tx; var $marge_tx;
var $marque_tx; var $marque_tx;
var $special_code; // Liste d'options non cumulabels: var $special_code; // Liste d'options non cumulabels:
// 1: frais de port // 1: frais de port
@ -2556,7 +2558,8 @@ class PropaleLigne
$this->total_ttc = $objp->total_ttc; $this->total_ttc = $objp->total_ttc;
$this->fk_fournprice = $objp->fk_fournprice; $this->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
$this->pa_ht = $marginInfos[0]; $this->pa_ht = $marginInfos[0];
$this->marge_tx = $marginInfos[1]; $this->marge_tx = $marginInfos[1];
$this->marque_tx = $marginInfos[2]; $this->marque_tx = $marginInfos[2];
@ -2623,7 +2626,7 @@ class PropaleLigne
$sql.= ' (fk_propal, fk_parent_line, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,'; $sql.= ' (fk_propal, fk_parent_line, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
$sql.= ' subprice, remise_percent, '; $sql.= ' subprice, remise_percent, ';
$sql.= ' info_bits, '; $sql.= ' info_bits, ';
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, special_code, rang, fk_product_fournisseur_price, buy_price_ht)'; $sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang)';
$sql.= " VALUES (".$this->fk_propal.","; $sql.= " VALUES (".$this->fk_propal.",";
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
$sql.= " '".$this->db->escape($this->desc)."',"; $sql.= " '".$this->db->escape($this->desc)."',";
@ -2648,7 +2651,7 @@ class PropaleLigne
$sql.= ' '.$this->rang; $sql.= ' '.$this->rang;
$sql.= ')'; $sql.= ')';
dol_syslog("PropaleLigne::insert sql=$sql"); dol_syslog(get_class($this).'::insert sql='.$sql, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -2671,7 +2674,7 @@ class PropaleLigne
else else
{ {
$this->error=$this->db->error()." sql=".$sql; $this->error=$this->db->error()." sql=".$sql;
dol_syslog("PropaleLigne::insert Error ".$this->error, LOG_ERR); dol_syslog(get_class($this).'::insert Error '.$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -2741,13 +2744,13 @@ class PropaleLigne
if (empty($this->special_code)) $this->special_code=0; if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->pa_ht)) $this->pa_ht=0; if (empty($this->pa_ht)) $this->pa_ht=0;
// si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises) // si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises)
if ($this->pa_ht == 0) { if ($this->pa_ht == 0) {
if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
} }
$this->db->begin(); $this->db->begin();
@ -2769,8 +2772,8 @@ class PropaleLigne
$sql.= " , total_tva=".price2num($this->total_tva).""; $sql.= " , total_tva=".price2num($this->total_tva)."";
$sql.= " , total_ttc=".price2num($this->total_ttc).""; $sql.= " , total_ttc=".price2num($this->total_ttc)."";
} }
$sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; $sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'";
$sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'";
$sql.= " , info_bits=".$this->info_bits; $sql.= " , info_bits=".$this->info_bits;
if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code; if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code;
$sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); $sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");

View File

@ -43,7 +43,7 @@ $action=GETPOST('action','alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'propale', $id, 'propal'); $result = restrictedArea($user, 'propal', $id);
$object = new Propal($db); $object = new Propal($db);

View File

@ -27,8 +27,6 @@ require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT ."/comm/propal/class/propal.class.php"); require_once(DOL_DOCUMENT_ROOT ."/comm/propal/class/propal.class.php");
if (!$user->rights->propale->lire) accessforbidden();
$langs->load("propal"); $langs->load("propal");
$langs->load("companies"); $langs->load("companies");
@ -39,7 +37,7 @@ if (isset($user->societe_id) && $user->societe_id > 0)
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result = restrictedArea($user, 'propal');
/* /*
@ -65,7 +63,7 @@ print '<tr><td valign="top" width="30%" class="notopnoleft">';
*/ */
$var=false; $var=false;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">'; print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchPropal").'</td></tr>'; print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchPropal").'</td></tr>';
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 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 * 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 * it under the terms of the GNU General Public License as published by
@ -31,11 +31,12 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/propal.lib.php");
$langs->load('propal'); $langs->load('propal');
$langs->load('compta'); $langs->load('compta');
$id = isset($_GET["id"])?$_GET["id"]:''; $id=GETPOST('id','int');
$socid=GETPOST('socid','int');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'propale', $id, 'propal'); $result = restrictedArea($user, 'propal', $id);
/* /*
@ -44,25 +45,22 @@ $result = restrictedArea($user, 'propale', $id, 'propal');
llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
$propal = new Propal($db); $object = new Propal($db);
$propal->fetch($_GET["id"]); $object->fetch($id);
$object->fetch_thirdparty();
$societe = new Societe($db); $head = propal_prepare_head($object);
$societe->fetch($propal->socid);
$head = propal_prepare_head($propal);
dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal'); dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal');
$propal->info($propal->id); $object->info($object->id);
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($propal); dol_print_object_info($object);
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>'; print '</div>';
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -67,7 +67,8 @@ $month=GETPOST("month");
$NBLINES=4; $NBLINES=4;
// Security check // Security check
$module='propale'; $module='propal';
$dbtable='';
if (isset($socid)) if (isset($socid))
{ {
$objectid=$socid; $objectid=$socid;
@ -77,8 +78,6 @@ if (isset($socid))
else if (isset($id) && $id > 0) else if (isset($id) && $id > 0)
{ {
$objectid=$id; $objectid=$id;
$module='propale';
$dbtable='propal';
} }
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, $module, $objectid, $dbtable); $result = restrictedArea($user, $module, $objectid, $dbtable);

View File

@ -2743,10 +2743,9 @@ class Commande extends CommonOrder
$lines = array(); $lines = array();
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.description, l.price, l.qty, l.tva_tx, '; $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.description, l.price, l.qty, l.tva_tx, ';
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits,l.rang,l.special_code,'; $sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,'; $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,';
$sql.= ' l.date_start,'; $sql.= ' l.date_start, l.date_end,';
$sql.= ' l.date_end,';
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, '; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, ';
$sql.= ' p.description as product_desc'; $sql.= ' p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
@ -2781,15 +2780,16 @@ class Commande extends CommonOrder
$this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_ttc = $obj->total_ttc; $this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->special_code = $obj->special_code;
$this->lines[$i]->rang = $obj->rang; $this->lines[$i]->rang = $obj->rang;
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start); $this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
$this->lines[$i]->date_end = $this->db->jdate($obj->date_end); $this->lines[$i]->date_end = $this->db->jdate($obj->date_end);
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice; $this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht);
$this->lines[$i]->pa_ht = $marginInfos[0]; $this->lines[$i]->pa_ht = $marginInfos[0];
$this->lines[$i]->marge_tx = $marginInfos[1]; $this->lines[$i]->marge_tx = $marginInfos[1];
$this->lines[$i]->marque_tx = $marginInfos[2]; $this->lines[$i]->marque_tx = $marginInfos[2];
$i++; $i++;
} }
@ -3001,13 +3001,13 @@ class OrderLine
if (empty($this->special_code)) $this->special_code=0; if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->pa_ht)) $this->pa_ht=0; if (empty($this->pa_ht)) $this->pa_ht=0;
// si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises) // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente (idem pour remises)
if ($this->pa_ht == 0) { if ($this->pa_ht == 0) {
if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
} }
// Check parameters // Check parameters
if ($this->product_type < 0) return -1; if ($this->product_type < 0) return -1;
@ -3027,34 +3027,28 @@ class OrderLine
$sql.= " '".price2num($this->tva_tx)."',"; $sql.= " '".price2num($this->tva_tx)."',";
$sql.= " '".price2num($this->localtax1_tx)."',"; $sql.= " '".price2num($this->localtax1_tx)."',";
$sql.= " '".price2num($this->localtax2_tx)."',"; $sql.= " '".price2num($this->localtax2_tx)."',";
if ($this->fk_product) { $sql.= "'".$this->fk_product."',"; } $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
else { $sql.='null,'; }
$sql.= " '".$this->product_type."',"; $sql.= " '".$this->product_type."',";
$sql.= " '".price2num($this->remise_percent)."',"; $sql.= " '".price2num($this->remise_percent)."',";
$sql.= " ".($this->subprice!=''?"'".price2num($this->subprice)."'":"null").","; $sql.= " ".($this->subprice!=''?"'".price2num($this->subprice)."'":"null").",";
$sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").","; $sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").",";
$sql.= " '".price2num($this->remise)."',"; $sql.= " '".price2num($this->remise)."',";
if ($this->fk_remise_except) $sql.= $this->fk_remise_except.","; $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").',';
else $sql.= 'null,';
$sql.= ' '.$this->special_code.','; $sql.= ' '.$this->special_code.',';
$sql.= ' '.$this->rang.','; $sql.= ' '.$this->rang.',';
if (isset($this->fk_fournprice)) $sql.= ' '.$this->fk_fournprice.','; $sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';
else $sql.= ' null,'; $sql.= ' '.price2num($this->pa_ht).',';
if (isset($this->pa_ht)) $sql.= ' '.price2num($this->pa_ht).',';
else $sql.= ' null,';
$sql.= " '".$this->info_bits."',"; $sql.= " '".$this->info_bits."',";
$sql.= " '".price2num($this->total_ht)."',"; $sql.= " '".price2num($this->total_ht)."',";
$sql.= " '".price2num($this->total_tva)."',"; $sql.= " '".price2num($this->total_tva)."',";
$sql.= " '".price2num($this->total_localtax1)."',"; $sql.= " '".price2num($this->total_localtax1)."',";
$sql.= " '".price2num($this->total_localtax2)."',"; $sql.= " '".price2num($this->total_localtax2)."',";
$sql.= " '".price2num($this->total_ttc)."',"; $sql.= " '".price2num($this->total_ttc)."',";
if ($this->date_start) { $sql.= "'".$this->db->idate($this->date_start)."',"; } $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").',';
else { $sql.='null,'; } $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null");
if ($this->date_end) { $sql.= "'".$this->db->idate($this->date_end)."'"; }
else { $sql.='null'; }
$sql.= ')'; $sql.= ')';
dol_syslog("OrderLine::insert sql=".$sql); dol_syslog(get_class($this)."::insert sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -3076,7 +3070,7 @@ class OrderLine
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog("OrderLine::insert Error ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@ -3140,9 +3134,8 @@ class OrderLine
$sql.= " , total_localtax1=".price2num($this->total_localtax1); $sql.= " , total_localtax1=".price2num($this->total_localtax1);
$sql.= " , total_localtax2=".price2num($this->total_localtax2); $sql.= " , total_localtax2=".price2num($this->total_localtax2);
$sql.= " , info_bits=".$this->info_bits; $sql.= " , info_bits=".$this->info_bits;
if ($this->date_start) { $sql.= " , date_start='".$this->db->idate($this->date_start)."'"; } $sql.= " , date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null");
else { $sql.=' , date_start=null'; } $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null");
if ($this->date_end) { $sql.= " , date_end='".$this->db->idate($this->date_end)."'"; }
$sql.= " , product_type=".$this->product_type; $sql.= " , product_type=".$this->product_type;
$sql.= " , fk_parent_line=".(! empty($this->fk_parent_line)?$this->fk_parent_line:"null"); $sql.= " , fk_parent_line=".(! empty($this->fk_parent_line)?$this->fk_parent_line:"null");
if (! empty($this->rang)) $sql.= ", rang=".$this->rang; if (! empty($this->rang)) $sql.= ", rang=".$this->rang;

View File

@ -148,7 +148,7 @@ print '</tr>';
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td align="center" colspan="3">'; print '<td align="center" colspan="3">';
print '<input type="submit" />'; print '<input type="submit" class="button" />';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -3010,7 +3010,7 @@ class Facture extends CommonInvoice
{ {
$sql = 'SELECT l.rowid, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,'; $sql = 'SELECT l.rowid, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,';
$sql.= ' l.fk_remise_except,'; $sql.= ' l.fk_remise_except,';
$sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code,'; $sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' l.date_start,'; $sql.= ' l.date_start,';
$sql.= ' l.date_end,'; $sql.= ' l.date_end,';
@ -3049,15 +3049,16 @@ class Facture extends CommonInvoice
$this->lines[$i]->total_ht = $obj->total_ht; $this->lines[$i]->total_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_ttc = $obj->total_ttc; $this->lines[$i]->total_ttc = $obj->total_ttc;
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->special_code = $obj->special_code;
$this->lines[$i]->rang = $obj->rang; $this->lines[$i]->rang = $obj->rang;
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start); $this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
$this->lines[$i]->date_end = $this->db->jdate($obj->date_end); $this->lines[$i]->date_end = $this->db->jdate($obj->date_end);
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice; $this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht);
$this->lines[$i]->pa_ht = $marginInfos[0]; $this->lines[$i]->pa_ht = $marginInfos[0];
$this->lines[$i]->marge_tx = $marginInfos[1]; $this->lines[$i]->marge_tx = $marginInfos[1];
$this->lines[$i]->marque_tx = $marginInfos[2]; $this->lines[$i]->marque_tx = $marginInfos[2];
$i++; $i++;
} }
@ -3266,14 +3267,13 @@ class FactureLigne
if (empty($this->special_code)) $this->special_code=0; if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->pa_ht)) $this->pa_ht=0;
if (empty($this->pa_ht)) $this->pa_ht=0; // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente (idem pour remises)
if ($this->pa_ht == 0) {
// si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises) if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
if ($this->pa_ht == 0) { $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) }
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
}
// Check parameters // Check parameters
if ($this->product_type < 0) return -1; if ($this->product_type < 0) return -1;
@ -3294,27 +3294,19 @@ class FactureLigne
$sql.= " ".price2num($this->tva_tx).","; $sql.= " ".price2num($this->tva_tx).",";
$sql.= " ".price2num($this->localtax1_tx).","; $sql.= " ".price2num($this->localtax1_tx).",";
$sql.= " ".price2num($this->localtax2_tx).","; $sql.= " ".price2num($this->localtax2_tx).",";
if ($this->fk_product) { $sql.= "'".$this->fk_product."',"; } $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
else { $sql.='null,'; }
$sql.= " ".$this->product_type.","; $sql.= " ".$this->product_type.",";
$sql.= " ".price2num($this->remise_percent).","; $sql.= " ".price2num($this->remise_percent).",";
$sql.= " ".price2num($this->subprice).","; $sql.= " ".price2num($this->subprice).",";
//$sql.= " ".price2num($this->price).","; $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").',';
//$sql.= " ".($this->remise?price2num($this->remise):'0').","; // Deprecated $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").",";
if ($this->fk_remise_except) $sql.= $this->fk_remise_except.","; $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").",";
else $sql.= 'null,';
if ($this->date_start) { $sql.= "'".$this->db->idate($this->date_start)."',"; }
else { $sql.='null,'; }
if ($this->date_end) { $sql.= "'".$this->db->idate($this->date_end)."',"; }
else { $sql.='null,'; }
$sql.= ' '.$this->fk_code_ventilation.','; $sql.= ' '.$this->fk_code_ventilation.',';
$sql.= ' '.$this->fk_export_compta.','; $sql.= ' '.$this->fk_export_compta.',';
$sql.= ' '.$this->rang.','; $sql.= ' '.$this->rang.',';
$sql.= ' '.$this->special_code.','; $sql.= ' '.$this->special_code.',';
if (isset($this->fk_fournprice)) $sql.= ' '.$this->fk_fournprice.','; $sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';
else $sql.= ' null,'; $sql.= ' '.price2num($this->pa_ht).',';
if (isset($this->pa_ht)) $sql.= ' '.price2num($this->pa_ht).',';
else $sql.= ' null,';
$sql.= " '".$this->info_bits."',"; $sql.= " '".$this->info_bits."',";
$sql.= " ".price2num($this->total_ht).","; $sql.= " ".price2num($this->total_ht).",";
$sql.= " ".price2num($this->total_tva).","; $sql.= " ".price2num($this->total_tva).",";
@ -3429,13 +3421,13 @@ class FactureLigne
// Check parameters // Check parameters
if ($this->product_type < 0) return -1; if ($this->product_type < 0) return -1;
if (empty($this->pa_ht)) $this->pa_ht=0; if (empty($this->pa_ht)) $this->pa_ht=0;
// si prix d'achat non renseign<67> et utilis<69> pour calcul des marges alors prix achat = prix vente (idem pour remises) // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente (idem pour remises)
if ($this->pa_ht == 0) { if ($this->pa_ht == 0) {
if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1)) if ($this->subprice < 0 || ($conf->global->CalculateMarginsOnLinesWithoutBuyingPrice == 1))
$this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100); $this->pa_ht = $this->subprice * (1 - $this->remise_percent / 100);
} }
$this->db->begin(); $this->db->begin();
@ -3452,10 +3444,8 @@ class FactureLigne
$sql.= ",localtax1_tx=".price2num($this->localtax1_tx).""; $sql.= ",localtax1_tx=".price2num($this->localtax1_tx)."";
$sql.= ",localtax2_tx=".price2num($this->localtax2_tx).""; $sql.= ",localtax2_tx=".price2num($this->localtax2_tx)."";
$sql.= ",qty=".price2num($this->qty).""; $sql.= ",qty=".price2num($this->qty)."";
if ($this->date_start) { $sql.= ",date_start='".$this->db->idate($this->date_start)."'"; } $sql.= ",date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null");
else { $sql.=',date_start=null'; } $sql.= ",date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null");
if ($this->date_end) { $sql.= ",date_end='".$this->db->idate($this->date_end)."'"; }
else { $sql.=',date_end=null'; }
$sql.= ",product_type=".$this->product_type; $sql.= ",product_type=".$this->product_type;
$sql.= ",info_bits='".$this->info_bits."'"; $sql.= ",info_bits='".$this->info_bits."'";
if (empty($this->skip_update_total)) if (empty($this->skip_update_total))
@ -3464,8 +3454,8 @@ class FactureLigne
$sql.= ",total_tva=".price2num($this->total_tva).""; $sql.= ",total_tva=".price2num($this->total_tva)."";
$sql.= ",total_ttc=".price2num($this->total_ttc).""; $sql.= ",total_ttc=".price2num($this->total_ttc)."";
} }
$sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'"; $sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'";
$sql.= " , buy_price_ht='".price2num($this->pa_ht)."'"; $sql.= " , buy_price_ht='".price2num($this->pa_ht)."'";
$sql.= ",total_localtax1=".price2num($this->total_localtax1).""; $sql.= ",total_localtax1=".price2num($this->total_localtax1)."";
$sql.= ",total_localtax2=".price2num($this->total_localtax2).""; $sql.= ",total_localtax2=".price2num($this->total_localtax2)."";
$sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); $sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");

View File

@ -2521,7 +2521,7 @@ abstract class CommonObject
* @param HookManager $hookmanager Hookmanager * @param HookManager $hookmanager Hookmanager
* @return void * @return void
*/ */
function printObjectLines($action,$seller,$buyer,$selected=0,$dateSelector=0,$hookmanager=false) function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $hookmanager=false)
{ {
global $conf,$langs; global $conf,$langs;
@ -2535,16 +2535,16 @@ abstract class CommonObject
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>'; print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>'; print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>'; print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled)) {
if ($conf->global->MARGIN_TYPE == "1") if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>'; print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else else
print '<td align="right" width="80">'.$langs->trans('BuyingCost').'</td>'; print '<td align="right" width="80">'.$langs->trans('BuyingCost').'</td>';
if($conf->global->DISPLAY_MARGIN_RATES) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>'; print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if($conf->global->DISPLAY_MARK_RATES) if (! empty($conf->global->DISPLAY_MARK_RATES))
print '<td align="right" width="50">'.$langs->trans('MarkRate').'</td>'; print '<td align="right" width="50">'.$langs->trans('MarkRate').'</td>';
} }
print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>'; print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td width="10">&nbsp;</td>'; print '<td width="10">&nbsp;</td>';
print '<td width="10">&nbsp;</td>'; print '<td width="10">&nbsp;</td>';
@ -2564,7 +2564,7 @@ abstract class CommonObject
if (empty($line->fk_parent_line)) if (empty($line->fk_parent_line))
{ {
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected); $parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected);
$reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
} }
} }
else else

View File

@ -281,8 +281,8 @@ class Conf
$this->user->dir_temp=$rootforuser."/users/temp"; $this->user->dir_temp=$rootforuser."/users/temp";
// For propal storage // For propal storage
$this->propal->dir_output=$rootforuser."/propale"; $this->propal->dir_output=$rootfordata."/propale";
$this->propal->dir_temp=$rootforuser."/propale/temp"; $this->propal->dir_temp=$rootfordata."/propale/temp";
// Exception: Some dir are not the name of module. So we keep exception here // Exception: Some dir are not the name of module. So we keep exception here
// for backward compatibility. // for backward compatibility.

View File

@ -804,11 +804,12 @@ class Form
* @param string $limitto Disable answers that are not id in this array list * @param string $limitto Disable answers that are not id in this array list
* @param string $showfunction Add function into label * @param string $showfunction Add function into label
* @param string $moreclass Add more class to class style * @param string $moreclass Add more class to class style
* @param string $showsoc Add company into label
* @return int <0 if KO, Nb of contact in list if OK * @return int <0 if KO, Nb of contact in list if OK
*/ */
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='') function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0)
{ {
print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass); print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $showsoc);
return $this->num; return $this->num;
} }
@ -824,9 +825,10 @@ class Form
* @param string $showfunction Add function into label * @param string $showfunction Add function into label
* @param string $moreclass Add more class to class style * @param string $moreclass Add more class to class style
* @param bool $options_only Return options only (for ajax treatment) * @param bool $options_only Return options only (for ajax treatment)
* @return int <0 if KO, Nb of contact in list if OK * @param string $showsoc Add company into label
* @return int <0 if KO, Nb of contact in list if OK
*/ */
function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false) function selectcontacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $options_only=false, $showsoc=0)
{ {
global $conf,$langs; global $conf,$langs;
@ -836,7 +838,13 @@ class Form
// On recherche les societes // On recherche les societes
$sql = "SELECT sp.rowid, sp.name as name, sp.firstname, sp.poste"; $sql = "SELECT sp.rowid, sp.name as name, sp.firstname, sp.poste";
if ($showsoc > 0) {
$sql.= " , s.nom as company";
}
$sql.= " FROM ".MAIN_DB_PREFIX ."socpeople as sp"; $sql.= " FROM ".MAIN_DB_PREFIX ."socpeople as sp";
if ($showsoc > 0) {
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX ."societe as s ON s.rowid=sp.fk_soc ";
}
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")"; $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
if ($socid > 0) $sql.= " AND sp.fk_soc=".$socid; if ($socid > 0) $sql.= " AND sp.fk_soc=".$socid;
$sql.= " ORDER BY sp.name ASC"; $sql.= " ORDER BY sp.name ASC";
@ -877,6 +885,7 @@ class Form
$out.= ' selected="selected">'; $out.= ' selected="selected">';
$out.= $contactstatic->getFullName($langs); $out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')'; if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
$out.= '</option>'; $out.= '</option>';
} }
else else
@ -886,6 +895,7 @@ class Form
$out.= '>'; $out.= '>';
$out.= $contactstatic->getFullName($langs); $out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')'; if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
$out.= '</option>'; $out.= '</option>';
} }
} }
@ -895,6 +905,7 @@ class Form
{ {
$out.= $contactstatic->getFullName($langs); $out.= $contactstatic->getFullName($langs);
if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')'; if ($showfunction && $obj->poste) $out.= ' ('.$obj->poste.')';
if (($showsoc > 0) && $obj->company) $out.= ' - ('.$obj->company.')';
} }
} }
$i++; $i++;
@ -3755,7 +3766,7 @@ class Form
* @param int $force_entity Possibility to force entity * @param int $force_entity Possibility to force entity
* @return void * @return void
*/ */
function select_dolgroups($selected='',$htmlname='groupid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity='') function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='')
{ {
global $conf,$user,$langs; global $conf,$user,$langs;

View File

@ -506,7 +506,7 @@ class FormFile
{ {
$out.= '<td align="right">'; $out.= '<td align="right">';
//$out.= '<a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath); //$out.= '<a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath);
$out.= '<a href="'.$urlsource.'&action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath); $out.= '<a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=remove_file&modulepart='.$modulepart.'&file='.urlencode($relativepath);
$out.= ($param?'&'.$param:''); $out.= ($param?'&'.$param:'');
$out.= '&urlsource='.urlencode($urlsource); $out.= '&urlsource='.urlencode($urlsource);
$out.= '">'.img_delete().'</a></td>'; $out.= '">'.img_delete().'</a></td>';
@ -611,7 +611,7 @@ class FormFile
// Delete or view link // Delete or view link
print '<td align="right">'; print '<td align="right">';
if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; '; if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; ';
if ($permtodelete) print '<a href="'.(($useinecm && !empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':$url.'?id='.$object->id.'&action=delete&urlfile='.urlencode($file['name']).$param).'" class="deletefilelink" rel="'.urlencode($file['name']).'">'.img_delete().'</a>'; if ($permtodelete) print '<a href="'.(($useinecm && ! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':$url.'?action=delete'.(isset($object->id)?'&id='.$object->id:'').'&urlfile='.urlencode($file['name']).$param).'" class="deletefilelink" rel="'.urlencode($file['name']).'">'.img_delete().'</a>';
else print '&nbsp;'; else print '&nbsp;';
print "</td>"; print "</td>";
print "</tr>\n"; print "</tr>\n";

View File

@ -226,12 +226,17 @@ function dol_getprefix()
* To link to a module file from a core file, then this function can be used * To link to a module file from a core file, then this function can be used
* *
* @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...) * @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...)
* @param string $classname Class name
* @return int false if include fails. * @return int false if include fails.
*/ */
function dol_include_once($relpath) function dol_include_once($relpath, $classname='')
{ {
global $conf,$langs,$user,$mysoc; // Other global var must be retreived with $GLOBALS['var'] global $conf,$langs,$user,$mysoc; // Other global var must be retreived with $GLOBALS['var']
return @include_once(dol_buildpath($relpath)); if (! empty($classname) && ! class_exists($classname)) {
return @include dol_buildpath($relpath);
} else {
return @include_once dol_buildpath($relpath);
}
} }
@ -242,7 +247,7 @@ function dol_include_once($relpath)
* @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path) * @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path)
* @return string Full filsystem path (if mode=0), Full url path (if mode=1) * @return string Full filsystem path (if mode=0), Full url path (if mode=1)
*/ */
function dol_buildpath($path,$type=0) function dol_buildpath($path, $type=0)
{ {
if (empty($type)) // For a filesystem path if (empty($type)) // For a filesystem path
{ {
@ -270,7 +275,7 @@ function dol_buildpath($path,$type=0)
} }
} }
} }
if ($type == 2) else if ($type == 2)
{ {
$res = DOL_MAIN_URL_ROOT.$path; // Standard value $res = DOL_MAIN_URL_ROOT.$path; // Standard value
if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT) // We check only if alternate feature is used

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -201,22 +201,27 @@ class modCommande extends DolibarrModules
$this->remove($options); $this->remove($options);
//ODT template //ODT template
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/orders'; $dirodt=DOL_DATA_ROOT.'/doctemplates/orders';
dol_mkdir($dirodt); $dest=$dirodt.'/template_order.odt';
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt'; $dest=$dirodt.'/template_order.odt';
$result=dol_copy($src,$dest,0,0); if (file_exists($src) && ! file_exists($dest))
if ($result < 0)
{ {
$langs->load("errors"); require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); dol_mkdir($dirodt);
return 0; $result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
return 0;
}
} }
$sql = array( $sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','order',".$conf->entity.")" "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','order',".$conf->entity.")"
); );
return $this->_init($sql,$options); return $this->_init($sql,$options);
} }

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 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 * 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 * it under the terms of the GNU General Public License as published by
@ -223,21 +223,27 @@ class modFacture extends DolibarrModules
// Remove permissions and default values // Remove permissions and default values
$this->remove($options); $this->remove($options);
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); //ODT template
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/invoices/template_invoice.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/invoices'; $dirodt=DOL_DATA_ROOT.'/doctemplates/invoices';
dol_mkdir($dirodt); $dest=$dirodt.'/template_invoice.odt';
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/invoices/template_invoice.odt'; $dest=$dirodt.'/template_invoice.odt';
$result=dol_copy($src,$dest,0,0); if (file_exists($src) && ! file_exists($dest))
if ($result < 0)
{ {
$langs->load("errors"); require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); dol_mkdir($dirodt);
return 0; $result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
return 0;
}
} }
$sql = array( $sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")" "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")"
); );
return $this->_init($sql,$options); return $this->_init($sql,$options);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Juanjo Menentr <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menentr <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -199,21 +199,26 @@ class modPropale extends DolibarrModules
$this->remove($options); $this->remove($options);
//ODT template //ODT template
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/proposals'; $dirodt=DOL_DATA_ROOT.'/doctemplates/proposals';
dol_mkdir($dirodt); $dest=$dirodt.'/template_proposal.odt';
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt'; $dest=$dirodt.'/template_proposal.odt';
$result=dol_copy($src,$dest,0,0); if (file_exists($src) && ! file_exists($dest))
if ($result < 0)
{ {
$langs->load("errors"); require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); dol_mkdir($dirodt);
return 0; $result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
return 0;
}
} }
$sql = array( $sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','propal',".$conf->entity.")", "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','propal',".$conf->entity.")",
); );
return $this->_init($sql,$options); return $this->_init($sql,$options);

View File

@ -368,16 +368,22 @@ class modSociete extends DolibarrModules
// We disable this to prevent pb of modules not correctly disabled // We disable this to prevent pb of modules not correctly disabled
//$this->remove($options); //$this->remove($options);
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); //ODT template
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/thirdparties'; $dirodt=DOL_DATA_ROOT.'/doctemplates/thirdparties';
dol_mkdir($dirodt); $dest=$dirodt.'/template_thirdparty.odt';
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt'; $dest=$dirodt.'/template_thirdparty.odt';
$result=dol_copy($src,$dest,0,0); if (file_exists($src) && ! file_exists($dest))
if ($result < 0)
{ {
$langs->load("errors"); require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); dol_mkdir($dirodt);
return 0; $result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
return 0;
}
} }
$sql = array(); $sql = array();

View File

@ -337,6 +337,7 @@ if (! $error && $db->connected && $action == "set")
$dir[4] = $main_data_dir."/propale"; $dir[4] = $main_data_dir."/propale";
$dir[5] = $main_data_dir."/ficheinter"; $dir[5] = $main_data_dir."/ficheinter";
$dir[6] = $main_data_dir."/produit"; $dir[6] = $main_data_dir."/produit";
$dir[7] = $main_data_dir."/doctemplates";
// Boucle sur chaque repertoire de dir[] pour les creer s'ils nexistent pas // Boucle sur chaque repertoire de dir[] pour les creer s'ils nexistent pas
$num=count($dir); $num=count($dir);
@ -372,6 +373,27 @@ if (! $error && $db->connected && $action == "set")
print "</td></tr>"; print "</td></tr>";
print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage",$_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>'; print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage",$_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
} }
else
{
//ODT templates
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
$srcroot='./doctemplates';
$destroot=$main_data_dir.'/doctemplates';
$docs=array('thirdparties' => 'thirdparty', 'proposals' => 'proposal', 'orders' => 'order', 'invoices' => 'invoice');
foreach($docs as $dir => $file)
{
$src=$srcroot.'/thirdparties/template_'.$file.'.odt';
$dirodt=$destroot.'/'.$dir;
$dest=$dirodt.'/template_'.$file.'.odt';
dol_mkdir($dirodt);
$result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
print '<tr><td colspan="2"><br>'.$langs->trans('ErrorFailToCopyFile',$src,$dest).'</td></tr>';
}
}
}
} }
} }

View File

@ -52,6 +52,7 @@ BoxTitleLastActionsToDo=Les %s últims esdeveniments a realitzar
BoxTitleLastContracts=Els %s últims contractes BoxTitleLastContracts=Els %s últims contractes
BoxTitleLastModifiedDonations=Les %s últimes subvencions modificades BoxTitleLastModifiedDonations=Les %s últimes subvencions modificades
BoxTitleLastModifiedExpenses=Els %s últims honoraris modificats BoxTitleLastModifiedExpenses=Els %s últims honoraris modificats
BoxTitleLatestSupplierOrders=Les %s últimes comandes a proveïdors
FailedToRefreshDataInfoNotUpToDate=Error en el refresc del flux RSS. Data de l'últim refresc :%s FailedToRefreshDataInfoNotUpToDate=Error en el refresc del flux RSS. Data de l'últim refresc :%s
LastRefreshDate=Data darrera actualització LastRefreshDate=Data darrera actualització
NoRecordedBookmarks=No hi ha marcadors personals. NoRecordedBookmarks=No hi ha marcadors personals.
@ -69,4 +70,5 @@ NoModifiedSupplierBills=Sense factures de proveïdors modificades
NoRecordedProducts=Sense productes/serveis registrats NoRecordedProducts=Sense productes/serveis registrats
NoRecordedProspects=Sense clients potencials registrats NoRecordedProspects=Sense clients potencials registrats
NoContractedProducts=Sense productes/serveis contractats NoContractedProducts=Sense productes/serveis contractats
NoRecordedContracts=Sense contractes registrats NoRecordedContracts=Sense contractes registrats
NoSupplierOrder=Sense comandes a proveïdors

View File

@ -52,7 +52,7 @@ BoxTitleLastActionsToDo=Los %s últimos eventos a realizar
BoxTitleLastContracts=Los %s últimos contratos BoxTitleLastContracts=Los %s últimos contratos
BoxTitleLastModifiedDonations=Las %s últimas donaciones modificadas BoxTitleLastModifiedDonations=Las %s últimas donaciones modificadas
BoxTitleLastModifiedExpenses=Los %s últimos honorarios modificados BoxTitleLastModifiedExpenses=Los %s últimos honorarios modificados
BoxTitleLatestSupplierOrders=Las %s últimas órdenes de pedido de proveedores BoxTitleLatestSupplierOrders=Los %s últimos pedidos a proveedores
FailedToRefreshDataInfoNotUpToDate=Error en el refresco del flujo RSS. Fecha del último refresco: %s FailedToRefreshDataInfoNotUpToDate=Error en el refresco del flujo RSS. Fecha del último refresco: %s
LastRefreshDate=Fecha última actualización LastRefreshDate=Fecha última actualización
NoRecordedBookmarks=No hay marcadores personales. NoRecordedBookmarks=No hay marcadores personales.
@ -71,4 +71,4 @@ NoRecordedProducts=Sin productos/servicios registrados
NoRecordedProspects=Sin clientes potenciales registrados NoRecordedProspects=Sin clientes potenciales registrados
NoContractedProducts=Sin productos/servicios contratados NoContractedProducts=Sin productos/servicios contratados
NoRecordedContracts=Sin contratos registrados NoRecordedContracts=Sin contratos registrados
NoSupplierOrder=Sin órdenes de pedido de proveedores NoSupplierOrder=Sin pedidos a proveedores

View File

@ -9,7 +9,7 @@ ServiceCommissionRate=Taux de commissionnement sur les services
ProductCommissionRateDetails=Taux utilisé pour calculer les commissions sur les ventes de produits ProductCommissionRateDetails=Taux utilisé pour calculer les commissions sur les ventes de produits
ServiceCommissionRateDetails=Taux utilisé pour calculer les commissions sur les ventes de services ServiceCommissionRateDetails=Taux utilisé pour calculer les commissions sur les ventes de services
Commissions=Comissions Commissions=Commissions
CommissionDetails=Détail des commissions CommissionDetails=Détail des commissions
IncludeUnpayedInvoices=Inclure les factures non réglées IncludeUnpayedInvoices=Inclure les factures non réglées

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -29,7 +30,8 @@ include_once("./inc.php");
$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); $uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root);
$pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine $pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine
if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a '' if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a ''
define('DOL_URL_ROOT', $pos); // URL racine relative if (! defined('DOL_URL_ROOT'))
define('DOL_URL_ROOT', $pos); // URL racine relative
$langs->load("other"); $langs->load("other");
$langs->load("help"); $langs->load("help");

View File

@ -255,8 +255,8 @@ class User extends CommonObject
while ($i < $num) while ($i < $num)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$p=$obj->param; $p=(! empty($obj->param)?$obj->param:'');
if ($p) $this->conf->$p = $obj->value; if (! empty($p)) $this->conf->$p = $obj->value;
$i++; $i++;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -1313,15 +1313,15 @@ else
$usergroup=new UserGroup($db); $usergroup=new UserGroup($db);
$groupslist = $usergroup->listGroupsForUser($fuser->id); $groupslist = $usergroup->listGroupsForUser($fuser->id);
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) if (! empty($groupslist))
{ {
if (! empty($groupslist)) if (! (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)))
{ {
foreach($groupslist as $groupforuser) foreach($groupslist as $groupforuser)
{ {
$exclude[]=$groupforuser->id; $exclude[]=$groupforuser->id;
} }
} }
} }
if ($caneditgroup) if ($caneditgroup)
@ -1333,7 +1333,7 @@ else
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><th class="liste_titre" width="25%">'.$langs->trans("GroupsToAdd").'</th>'."\n"; print '<tr class="liste_titre"><th class="liste_titre" width="25%">'.$langs->trans("GroupsToAdd").'</th>'."\n";
print '<th>'; print '<th>';
print $form->select_dolgroups('','group',1,$exclude,0,'','',$fuser->entity); print $form->select_dolgroups('', 'group', 1, $exclude, 0, '', '', $fuser->entity);
print ' &nbsp; '; print ' &nbsp; ';
// Multicompany // Multicompany
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))

View File

@ -350,15 +350,15 @@ else
// On selectionne les users qui ne sont pas deja dans le groupe // On selectionne les users qui ne sont pas deja dans le groupe
$exclude = array(); $exclude = array();
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) if (! empty($object->members))
{ {
if (! empty($object->members)) if (! (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)))
{ {
foreach($object->members as $useringroup) foreach($object->members as $useringroup)
{ {
$exclude[]=$useringroup->id; $exclude[]=$useringroup->id;
} }
} }
} }
if ($caneditperms) if ($caneditperms)