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

This commit is contained in:
Florian HENRY 2015-05-15 17:37:31 +02:00
commit 4bc2d55cb3
133 changed files with 1598 additions and 1457 deletions

View File

@ -18,20 +18,7 @@
echo "<html>";
echo "<head>";
echo "<STYLE type=\"text/css\">
body {
color: #444;
font: 100%/30px 'Helvetica Neue', helvetica, arial, sans-serif;
text-shadow: 0 1px 0 #fff;
}
strong {
font-weight: bold;
}
em {
font-style: italic;
}
echo "<STYLE type=\"text/css\">
table {
background: #f5f5f5;
@ -42,7 +29,7 @@ table {
margin: 30px auto;
text-align: left;
width: 800px;
}
}
th {
background-color: #777;
@ -50,33 +37,11 @@ th {
border-right: 1px solid #777;
border-top: 1px solid #555;
border-bottom: 1px solid #333;
box-shadow: inset 0 1px 0 #999;
color: #fff;
font-weight: bold;
font-weight: bold;
padding: 10px 15px;
position: relative;
text-shadow: 0 1px 0 #000;
}
th:after {
background: linear-gradient(rgba(255,255,255,0), rgba(255,255,255,.08));
content: '';
display: block;
height: 25%;
left: 0;
margin: 1px 0 0 0;
position: absolute;
top: 25%;
width: 100%;
}
th:first-child {
border-left: 1px solid #777;
box-shadow: inset 1px 1px 0 #999;
}
th:last-child {
box-shadow: inset -1px 1px 0 #999;
text-shadow: 0 1px 0 #000;
}
td {
@ -86,17 +51,8 @@ td {
border-bottom: 1px solid #e8e8e8;
padding: 10px 15px;
position: relative;
transition: all 300ms;
}
td:first-child {
box-shadow: inset 1px 0 0 #fff;
}
td:last-child {
border-right: 1px solid #e8e8e8;
box-shadow: inset -1px 0 0 #fff;
}
tr {
background-color: #f1f1f1;
@ -104,42 +60,35 @@ tr {
}
tr:nth-child(odd) td {
background-color: #f1f1f1;
background-color: #f1f1f1;
}
tr:last-of-type td {
box-shadow: inset 0 -1px 0 #fff;
}
tr:last-of-type td:first-child {
box-shadow: inset 1px -1px 0 #fff;
}
tr:last-of-type td:last-child {
box-shadow: inset -1px -1px 0 #fff;
}
tbody:hover td {
color: transparent;
text-shadow: 0 0 3px #aaa;
}
tbody:hover tr:hover td {
color: #444;
text-shadow: 0 1px 0 #fff;
} </STYLE>";
</STYLE>";
echo "<body>";
echo "<h3>If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used</h3>";
echo "<h2>IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly</h2>";
echo "<h3>Happy translating :)</h3>";
// directory containing the php and lang files
$htdocs = "../../htdocs/";
echo "If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used.<br>";
echo "IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly.<br>";
echo "Happy translating :)<br>";
// STEP 1 - Search duplicates keys
// directory containing the php and lang files
$htdocs = "../../htdocs/";
// directory containing the english lang files
$workdir = $htdocs."langs/en_US/";
$files = scandir($workdir);
if (empty($files))
{
echo "Can't scan workdir = ".$workdir;
exit;
}
$exludefiles = array('.','..','README');
$files = array_diff($files,$exludefiles);
$langstrings_3d = array();
@ -154,11 +103,12 @@ foreach ($files AS $file) {
if (substr($row,0,1) !== '#') {
// don't want lines without the separator (why should those even be here, anyway...)
if (strpos($row,'=')!==false) {
$row_array = explode('=',$row);
$row_array = explode('=',$row); // $row_array[0] = key
$langstrings_3d[$path_file['basename']][$line+1]=$row_array[0];
$langstrings_3dtrans[$path_file['basename']][$line+1]=$row_array[1];
$langstrings_full[]=$row_array[0];
$langstrings_dist[$row_array[0]]=$row_array[0];
}
}
}
}
}
@ -167,16 +117,16 @@ foreach ($files AS $file) {
foreach ($langstrings_3d AS $filename => $file) {
foreach ($file AS $linenum => $value) {
$keys = array_keys($langstrings_full, $value);
if (count($keys)>1) {
if (count($keys)>1)
{
foreach ($keys AS $key) {
$dups[$value][$filename][$linenum] = '';
$dups[$value][$filename][$linenum] = trim($langstrings_3dtrans[$filename][$linenum]);
}
}
}
}
echo "<h2>Duplicate strings in lang files in $workdir - ".count($dups)." found</h2>";
echo "<pre>";
echo "<table border_bottom=1> ";
echo "<thead><tr><th align=\"center\">#</th><th>String</th><th>File and lines</th></thead>";
@ -190,22 +140,27 @@ foreach ($dups as $string => $pages) {
echo "<td>";
foreach ($pages AS $page => $lines ) {
echo "$page ";
foreach ($lines as $line => $nothing) {
echo "($line) ";
foreach ($lines as $line => $translatedvalue) {
//echo "($line - ".(substr($translatedvalue,0,20)).") ";
echo "($line - ".htmlentities($translatedvalue).") ";
}
echo "<br>";
}
echo "</td></tr>";
echo "</td></tr>\n";
}
echo "</tbody>";
echo "</table>";
if ($_REQUEST['unused'] == 'true') {
// STEP 2 - Search key not used
foreach ($langstrings_dist AS $value){
if (! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true')
{
foreach ($langstrings_dist AS $value)
{
$search = '\'trans("'.$value.'")\'';
$string = 'grep -R -m 1 -F --include=*.php '.$search.' '.$htdocs.'*';
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'*';
exec($string,$output);
if (empty($output)) {
$unused[$value] = true;
@ -216,6 +171,9 @@ if ($_REQUEST['unused'] == 'true') {
echo "<h2>Strings in en_US that are never used</h2>";
echo "<pre>";
print_r($unused);
echo "</pre>";
}
echo "\n";
echo "</body>";
echo "</html>";
echo "</html>";

View File

@ -547,7 +547,7 @@ $now=dol_now();
llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
if ($rowid)
if ($rowid > 0)
{
$res=$object->fetch($rowid);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
@ -556,8 +556,6 @@ if ($rowid)
$head = member_prepare_head($object);
dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user');
$rowspan=10;
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
if (! empty($conf->societe->enabled)) $rowspan++;
@ -565,6 +563,9 @@ if ($rowid)
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
@ -696,10 +697,11 @@ if ($rowid)
print '</td></tr>';
print "</table>\n";
print '</form>';
dol_fiche_end();
print '</form>';
dol_htmloutput_errors($errmsg,$errmsgs);
@ -873,7 +875,7 @@ if ($rowid)
}
});
';
if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").attr("checked",true);';
if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").prop("checked",true);';
print '});';
print '</script>'."\n";
}
@ -1008,7 +1010,7 @@ if ($rowid)
{
$prodtmp=new Product($db);
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
print '. '.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(0));
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
}
print '<br>';
}
@ -1033,7 +1035,7 @@ if ($rowid)
{
$prodtmp=new Product($db);
$prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
print '. '.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(0));
print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product
}
print '<br>';
}

View File

@ -165,7 +165,7 @@ jQuery(document).ready(function() {
var row_num = field_id.split("_");
jQuery("#updateconst").show();
jQuery("#action").val('update');
jQuery("#check_" + row_num[1]).attr("checked",true);
jQuery("#check_" + row_num[1]).prop("checked",true);
});
});
</script>

View File

@ -271,12 +271,12 @@ if ($action == 'edit')
{
jQuery(".drag").hide();
jQuery("#MAIN_MAIL_EMAIL_TLS").val(0);
jQuery("#MAIN_MAIL_EMAIL_TLS").attr(\'disabled\', \'disabled\');
jQuery("#MAIN_MAIL_EMAIL_TLS").prop("disabled", true);
';
if ($linuxlike)
{
print ' jQuery("#MAIN_MAIL_SMTP_SERVER").attr(\'disabled\', \'disabled\');';
print ' jQuery("#MAIN_MAIL_SMTP_PORT").attr(\'disabled\', \'disabled\');';
print ' jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);';
print ' jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);';
}
print '
}
@ -284,9 +284,9 @@ if ($action == 'edit')
{
jQuery(".drag").show();
jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.');
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr(\'disabled\');
jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr(\'disabled\');
jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr(\'disabled\');
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr("disabled");
}
}
initfields();

View File

@ -255,12 +255,12 @@ if ($action == 'create')
{
if (jQuery("#topleft").val() == \'top\')
{
jQuery("#menuId").attr(\'disabled\',\'disabled\');
jQuery("#menuId").prop("disabled", true);
jQuery("#menuId").val(\'\');
}
else
{
jQuery("#menuId").removeAttr(\'disabled\');
jQuery("#menuId").removeAttr("disabled");
}
}
init_topleft();

View File

@ -51,8 +51,8 @@ print '</ul>';
print $langs->trans("Developpers").':';
print '<ul>';
print '<li>'.$langs->trans("SourcesRepository").': <a href="http://www.github.com/Dolibarr/dolibarr" target="_blank" rel="external">http://www.github.com/Dolibarr/dolibarr</a></li>';
print '<li>'.$langs->trans("SeeWikiForAllTeam").': <a href="http://wiki.dolibarr.org/index.php/Dolibarr_Project" target="_blank" rel="external">http://wiki.dolibarr.org/index.php/Dolibarr_Project</a></li>';
print '<li>'.$langs->trans("DoliForge").': <a href="http://www.doliforge.org" target="_blank" rel="external">http://wwww.doliforge.org</a></li>';
print '</ul>';
//print "<br>\n";

View File

@ -118,7 +118,7 @@ foreach($sortorder as $numero=>$name)
$idperms="";
$var=!$var;
// Module
print "<tr ".$bc[$var]."><td width=\"300\" nowrap=\"nowrap\">";
print "<tr ".$bc[$var].'><td width="300" class="nowrap">';
$alt=$name.' - '.$modules_files[$numero];
if (! empty($picto[$numero]))
{

View File

@ -96,7 +96,7 @@ jQuery(document).ready(function() {
jQuery("#select_sql_compat").click(function() {
if (jQuery("#select_sql_compat").val() == 'POSTGRESQL')
{
jQuery("#checkbox_dump_disable-add-locks").attr('checked',true);
jQuery("#checkbox_dump_disable-add-locks").prop('checked',true);
}
});

View File

@ -32,7 +32,8 @@
include '../master.inc.php';
$phone = GETPOST('phone');
$notfound = "Not found";
$error = "Error"
// Security check
if (empty($conf->clicktodial->enabled)) {
@ -64,13 +65,15 @@ if ($resql)
if ($obj)
{
$found = $obj->name;
} else {
$found = $notfound;
}
$db->free($resql);
}
else
{
dol_print_error($db,'Error');
$found = $error;
}
echo $found;

View File

@ -313,28 +313,28 @@ jQuery(document).ready(function() {
{
if (jQuery("#fillmanually:checked").val() == "fillmanually")
{
jQuery("#submitproduct").attr(\'disabled\',\'disabled\');
jQuery("#submitthirdparty").attr(\'disabled\',\'disabled\');
jQuery("#search_productid").attr(\'disabled\',\'disabled\');
jQuery("#socid").attr(\'disabled\',\'disabled\');
jQuery("#submitproduct").prop("disabled", true);
jQuery("#submitthirdparty").prop("disabled", true);
jQuery("#search_productid").prop("disabled", true);
jQuery("#socid").prop("disabled", true);
jQuery(".showforproductselector").hide();
jQuery(".showforthirdpartyselector").hide();
}
if (jQuery("#fillfromproduct:checked").val() == "fillfromproduct")
{
jQuery("#submitproduct").removeAttr(\'disabled\');
jQuery("#submitthirdparty").attr(\'disabled\',\'disabled\');
jQuery("#search_productid").removeAttr(\'disabled\');
jQuery("#socid").attr(\'disabled\',\'disabled\');
jQuery("#submitproduct").removeAttr("disabled");
jQuery("#submitthirdparty").prop("disabled", true);
jQuery("#search_productid").removeAttr("disabled");
jQuery("#socid").prop("disabled", true);
jQuery(".showforproductselector").show();
jQuery(".showforthirdpartyselector").hide();
}
if (jQuery("#fillfromthirdparty:checked").val() == "fillfromthirdparty")
{
jQuery("#submitproduct").attr(\'disabled\',\'disabled\');
jQuery("#submitthirdparty").removeAttr(\'disabled\');
jQuery("#search_productid").attr(\'disabled\',\'disabled\');
jQuery("#socid").removeAttr(\'disabled\');
jQuery("#submitproduct").prop("disabled", true);
jQuery("#submitthirdparty").removeAttr("disabled");
jQuery("#search_productid").prop("disabled", true);
jQuery("#socid").removeAttr("disabled");
jQuery(".showforproductselector").hide();
jQuery(".showforthirdpartyselector").show();
}
@ -348,11 +348,11 @@ jQuery(document).ready(function() {
{
if (jQuery("#select_fk_barcode_type").val() > 0 && jQuery("#forbarcode").val())
{
jQuery("#submitformbarcodegen").removeAttr(\'disabled\');
jQuery("#submitformbarcodegen").removeAttr("disabled");
}
else
{
jQuery("#submitformbarcodegen").attr(\'disabled\',\'disabled\');
jQuery("#submitformbarcodegen").prop("disabled", true);
}
}
init_gendoc_button();

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Jean-François Ferry <jfefe@aternatik.fr>
@ -128,7 +128,7 @@ if ($object->id)
// Description
print '<tr><td width="20%" class="notopnoleft">';
print $langs->trans("Description").'</td><td>';
print nl2br($object->description);
print dol_htmlentitiesbr($object->description);
print '</td></tr>';
// Visibility

View File

@ -166,6 +166,7 @@ elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type);
dol_fiche_head($head, 'card', $title, 0, 'category');
@ -194,7 +195,7 @@ print '</td></tr>';
// Description
print '<tr><td width="20%" class="notopnoleft">';
print $langs->trans("Description").'</td><td>';
print nl2br($object->description);
print dol_htmlentitiesbr($object->description);
print '</td></tr>';
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -205,12 +206,13 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
print '</table>';
print '</div>';
dol_fiche_end();
/*
* Boutons actions
*/
print "<div class='tabsAction'>\n";
if ($user->rights->categorie->creer)
@ -254,7 +256,7 @@ else
{
$var=!$var;
print "\t<tr ".$bc[$var].">\n";
print "\t\t<td nowrap=\"nowrap\">";
print "\t\t".'<td class="nowrap">';
print "<a href='viewcat.php?id=".$cat->id."&amp;type=".$type."'>".$cat->label."</a>";
print "</td>\n";
print "\t\t".'<td colspan="2">'.$cat->description."</td>\n";

View File

@ -570,11 +570,11 @@ if ($action == 'create')
$(".fulldayendmin").removeAttr("disabled");
$("#p2").removeAttr("disabled");
} else {
$(".fulldaystarthour").attr("disabled","disabled").val("00");
$(".fulldaystartmin").attr("disabled","disabled").val("00");
$(".fulldayendhour").attr("disabled","disabled").val("23");
$(".fulldayendmin").attr("disabled","disabled").val("59");
$("#p2").removeAttr("disabled");
$(".fulldaystarthour").prop("disabled", true).val("00");
$(".fulldaystartmin").prop("disabled", true).val("00");
$(".fulldayendhour").prop("disabled", true).val("23");
$(".fulldayendmin").prop("disabled", true).val("59");
$("#p2").removeAttr("disabled");
}
}
setdatefields();
@ -841,10 +841,10 @@ if ($id > 0)
$(".fulldayendhour").removeAttr("disabled");
$(".fulldayendmin").removeAttr("disabled");
} else {
$(".fulldaystarthour").attr("disabled","disabled").val("00");
$(".fulldaystartmin").attr("disabled","disabled").val("00");
$(".fulldayendhour").attr("disabled","disabled").val("23");
$(".fulldayendmin").attr("disabled","disabled").val("59");
$(".fulldaystarthour").prop("disabled", true).val("00");
$(".fulldaystartmin").prop("disabled", true).val("00");
$(".fulldayendhour").prop("disabled", true).val("23");
$(".fulldayendmin").prop("disabled", true).val("59");
}
}
setdatefields();
@ -986,7 +986,7 @@ if ($id > 0)
}
// Priority
print '<tr><td nowrap width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
print '<tr><td class="nowrap" width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
print '</td></tr>';
@ -1174,7 +1174,7 @@ if ($id > 0)
}
// Priority
print '<tr><td nowrap width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
print '<tr><td class="nowrap" width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
print ($object->priority?$object->priority:'');
print '</td></tr>';

View File

@ -11,7 +11,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1315,6 +1315,8 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<input type="hidden" name="origin" value="' . $origin . '">';
print '<input type="hidden" name="originid" value="' . $originid . '">';
dol_fiche_head('');
print '<table class="border" width="100%">';
// Reference
@ -1545,8 +1547,10 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</table>';
dol_fiche_end();
// Button "Create Draft"
print '<br><div class="center"><input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '"></div>';
print '<div class="center"><input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '"></div>';
print '</form>';

View File

@ -511,10 +511,10 @@ if (($action != 'create' && $action != 'add') && !$error)
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#checkall").click(function() {
jQuery(".checkformerge").attr('checked', true);
jQuery(".checkformerge").prop('checked', true);
});
jQuery("#checknone").click(function() {
jQuery(".checkformerge").attr('checked', false);
jQuery(".checkformerge").prop('checked', false);
});
});
</script>
@ -654,12 +654,12 @@ if (($action != 'create' && $action != 'add') && !$error)
print '<td>'.$objp->ref_client.'</td>';
// Order date
print '<td align="center" nowrap>';
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($objp->date_commande),'day');
print '</td>';
//Delivery date
print '<td align="center" nowrap>';
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($objp->date_livraison),'day');
print '</td>';

View File

@ -313,19 +313,65 @@ if ($id > 0 || ! empty($ref))
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$object->label.'</td></tr>';
print '</table>';
print '<br>';
dol_fiche_end();
/*
* Boutons actions
*/
if ($action != 'delete')
{
print '<div class="tabsAction">';
if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate
{
if ($user->rights->banque->consolidate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}
if ($action != 'addline')
{
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
{
if ($user->rights->banque->modifier)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&amp;id='.$object->id.'&amp;page='.$page.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
print '</div>';
}
print '<br>';
/**
* Search form
*/
@ -364,15 +410,15 @@ if ($id > 0 || ! empty($ref))
}
$navig.='</div>';
//var_dump($navig);
print '<table class="notopnoleftnoright" width="100%">';
// Show title
if ($action != 'addline' && $action != 'delete')
{
print '<tr><td colspan="10" align="right">'.$navig.'</td></tr>';
print '<div class="floatright">'.$navig.'</div>';
}
print '<table class="noborder" width="100%">';
// Form to add a transaction with no invoice
if ($user->rights->banque->modifier && $action == 'addline')
@ -776,11 +822,11 @@ if ($id > 0 || ! empty($ref))
{
if ($total >= 0)
{
print '<td align="right" nowrap>&nbsp;'.price($total).'</td>';
print '<td align="right" class="nowrap">&nbsp;'.price($total).'</td>';
}
else
{
print '<td align="right" class="error" nowrap>&nbsp;'.price($total).'</td>';
print '<td align="right" class="error nowrap">&nbsp;'.price($total).'</td>';
}
}
else
@ -791,7 +837,7 @@ if ($id > 0 || ! empty($ref))
// Transaction reconciliated or edit link
if ($objp->rappro && $object->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
{
print '<td align="center" nowrap>';
print '<td align="center" class="nowrap">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'&amp;page='.$page.'">';
print img_edit();
print '</a>';
@ -844,7 +890,7 @@ if ($id > 0 || ! empty($ref))
if ($sep > 0) print '&nbsp;'; // If we had at least one line in future
else print $langs->trans("CurrentBalance");
print ' '.$object->currency_code.'</td>';
print '<td align="right" nowrap><b>'.price($total, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td align="right" class="nowrap"><b>'.price($total, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td>&nbsp;</td>';
print '</tr>';
}
@ -859,51 +905,6 @@ if ($id > 0 || ! empty($ref))
print "</form>\n";
dol_fiche_end();
/*
* Boutons actions
*/
if ($action != 'delete')
{
print '<div class="tabsAction">';
if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate
{
if ($user->rights->banque->consolidate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}
if ($action != 'addline')
{
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
{
if ($user->rights->banque->modifier)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&amp;id='.$object->id.'&amp;page='.$page.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
print '</div>';
}
print '<br>';
}
else

View File

@ -144,7 +144,7 @@ print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
if ($_GET["account"])
{
@ -172,7 +172,7 @@ else
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">';
if (! empty($id))
{
@ -186,12 +186,14 @@ print '</td></tr>';
print '</table>';
print '<br>';
dol_fiche_end();
// Affiche tableau
print '<table class="notopnoleftnoright" width="100%">';
print '<div class="floatright">'.$link.'</div>';
print '<tr><td colspan="'.(1+($year_end-$year_start+1)*2).'" align="right">'.$link.'</td></tr>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
@ -245,16 +247,13 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
}
print "</tr>\n";
// Ligne vierge
print '<tr><td>&nbsp;</td>';
$nbcol=0;
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{
$nbcol+=2;
}
print "</tr>\n";
print "</table>";
// Solde actuel
print '<br>';
// Current balance
$balance=0;
$sql = "SELECT SUM(b.amount) as total";
@ -274,6 +273,9 @@ if ($resql)
else {
dol_print_error($db);
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_total"><td><b>'.$langs->trans("CurrentBalance")."</b></td>";
print '<td colspan="'.($nbcol).'" align="right">'.price($balance).'</td>';
print "</tr>\n";
@ -496,9 +498,9 @@ else
unset($tblyear[1]);
unset($tblyear[2]);
print '<div class="fichecenter"><div class="fichehalfleft"><div class="center">';
print '<div class="fichecenter"><div class="fichehalfleft"><div align="center">';
print $show1;
print '</div></div><div class="fichehalfright"><div class="ficheaddleft"><div class="center">';
print '</div></div><div class="fichehalfright"><div class="ficheaddleft"><div align="center">';
print $show2;
print '</div></div></div></div>';
print '<div style="clear:both"></div>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
@ -266,24 +266,26 @@ if ($action == 'create')
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="clos" value="0">';
dol_fiche_head('');
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>';
// Label
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label").'"></td></tr>';
// Type
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td colspan="3">';
$formbank->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type");
print '</td></tr>';
// Currency
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Currency").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
print '<td colspan="3">';
$selectedcode=$account->account_currency_code;
if (! $selectedcode) $selectedcode=$conf->currency;
@ -293,7 +295,7 @@ if ($action == 'create')
print '</td></tr>';
// Status
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">';
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print '</td></tr>';
@ -307,7 +309,7 @@ if ($action == 'create')
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
$account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
print '<td colspan="3">';
print $form->select_country($selectedcode,'account_country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
@ -326,11 +328,11 @@ if ($action == 'create')
print '</td></tr>';
// Web
print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
print '<tr><td>'.$langs->trans("Web").'</td>';
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
// Comment
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td colspan="3">';
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -353,18 +355,18 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// Sold
print '<tr><td valign="top" width="25%">'.$langs->trans("InitialBankBalance").'</td>';
print '<tr><td width="25%">'.$langs->trans("InitialBankBalance").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($account->solde)).'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="3">';
$form->select_date('', 're', 0, 0, 0, 'formsoc');
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.($_POST["account_min_allowed"]?$_POST["account_min_allowed"]:$account->account_min_allowed).'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->account_min_desired).'"></td></tr>';
print '</table>';
@ -375,7 +377,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
// If bank account
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
print '<tr><td width="25%">'.$langs->trans("BankName").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
print '</tr>';
@ -452,16 +454,16 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans($bickey).'</td>';
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
print $account->domiciliation;
print "</textarea></td></tr>";
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
print $account->owner_address;
print "</textarea></td></tr>";
@ -474,25 +476,27 @@ if ($action == 'create')
// Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
{
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number'):$account->account_number).'"></td></tr>';
}
else
{
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number'):$account->account_number).'"></td></tr>';
}
// Accountancy journal
if (! empty($conf->accounting->enabled))
{
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(GETPOST("accountancy_journal")?GETPOST('accountancy_journal'):$account->accountancy_journal).'"></td></tr>';
}
print '</table>';
print '<br><div class="center"><input value="'.$langs->trans("CreateAccount").'" type="submit" class="button"></div>';
dol_fiche_end();
print '<div class="center"><input value="'.$langs->trans("CreateAccount").'" type="submit" class="button"></div>';
print '</form>';
}
@ -538,21 +542,21 @@ else
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($account, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$account->label.'</td></tr>';
// Type
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
print '<tr><td>'.$langs->trans("AccountType").'</td>';
print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>';
// Currency
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
print '<tr><td>'.$langs->trans("Currency").'</td>';
print '<td colspan="3">';
$selectedcode=$account->account_currency_code;
if (! $selectedcode) $selectedcode=$conf->currency;
@ -560,7 +564,7 @@ else
print '</td></tr>';
// Status
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
// Country
@ -579,7 +583,7 @@ else
print '</td></tr>';
// Conciliate
print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
print '<td colspan="3">';
$conciliate=$account->canBeConciliated();
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
@ -587,19 +591,19 @@ else
else print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3">'.$account->min_allowed.'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td colspan="3">'.$account->min_desired.'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Web").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("Web").'</td><td colspan="3">';
if ($account->url) print '<a href="'.$account->url.'" target="_gobank">';
print $account->url;
if ($account->url) print '</a>';
print "</td></tr>\n";
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>';
// Other attributes
@ -687,7 +691,7 @@ else
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
print '<tr><td>'.$langs->trans($ibankey).'</td>';
print '<td colspan="3">'.$account->iban.'&nbsp;';
if (! empty($account->iban)) {
if (! checkIbanForAccount($account)) {
@ -698,7 +702,7 @@ else
}
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
print '<tr><td>'.$langs->trans($bickey).'</td>';
print '<td colspan="3">'.$account->bic.'&nbsp;';
if (! empty($account->bic)) {
if (! checkSwiftForAccount($account)) {
@ -709,15 +713,15 @@ else
}
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
print nl2br($account->domiciliation);
print "</td></tr>\n";
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td colspan="3">';
print $account->proprio;
print "</td></tr>\n";
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
print nl2br($account->owner_address);
print "</td></tr>\n";
@ -727,13 +731,13 @@ else
print '<table class="border" width="100%">';
// Accountancy code
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3">'.$account->account_number.'</td></tr>';
// Accountancy journal
if (! empty($conf->accounting->enabled))
{
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td colspan="3">'.$account->accountancy_journal.'</td></tr>';
}
@ -799,24 +803,26 @@ else
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">'."\n\n";
dol_fiche_head('');
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?$_POST["ref"]:$account->ref).'"></td></tr>';
// Label
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.(isset($_POST["label"])?$_POST["label"]:$account->label).'"></td></tr>';
// Type
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td colspan="3">';
$formbank->select_type_comptes_financiers((isset($_POST["type"])?$_POST["type"]:$account->type),"type");
print '</td></tr>';
// Currency
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Currency");
print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
print '<input type="hidden" value="'.$account->currency_code.'">';
print '</td>';
print '<td colspan="3">';
@ -828,7 +834,7 @@ else
print '</td></tr>';
// Status
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">';
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print '</td></tr>';
@ -840,7 +846,7 @@ else
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
$account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
print '<td colspan="3">';
print $form->select_country($selectedcode,'account_country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
@ -859,7 +865,7 @@ else
print '</td></tr>';
// Conciliable
print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
print '<td colspan="3">';
$conciliate=$account->canBeConciliated();
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
@ -868,19 +874,19 @@ else
print '</td></tr>';
// Balance
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(isset($_POST["account_min_allowed"])?$_POST["account_min_allowed"]:$account->min_allowed).'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.(isset($_POST["account_min_desired"])?$_POST["account_min_desired"]:$account->min_desired).'"></td></tr>';
// Web
print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
print '<tr><td>'.$langs->trans("Web").'</td>';
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$account->url).'">';
print '</td></tr>';
// Comment
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
print '<td colspan="3">';
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -903,7 +909,7 @@ else
print '<table class="border" width="100%">';
// If bank account
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
print '<tr><td width="25%">'.$langs->trans("BankName").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
print '</tr>';
@ -975,22 +981,22 @@ else
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
// IBAN
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
print '<tr><td>'.$langs->trans($ibankey).'</td>';
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
print '<tr><td>'.$langs->trans($bickey).'</td>';
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
print $account->domiciliation;
print "</textarea></td></tr>";
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
print $account->owner_address;
print "</textarea></td></tr>";
@ -1004,25 +1010,27 @@ else
// Accountancy code
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
{
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
}
else
{
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
}
// Accountancy journal
if (! empty($conf->accounting->enabled))
{
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(isset($_POST["accountancy_journal"])?$_POST["accountancy_journal"]:$account->accountancy_journal).'"></td></tr>';
}
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input value="'.$langs->trans("Modify").'" type="submit" class="button">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';

View File

@ -441,7 +441,7 @@ else
$datas = array();
$datamin = array();
$dataall = array();
$subtotal = 0;
$day = $min;
@ -483,7 +483,7 @@ else
if ($acct->min_desired) array_push($graph_datas[$i],$datamin[$i]);
if ($acct->min_allowed) array_push($graph_datas[$i],$dataall[$i]);
}
$px3 = new DolGraph();
$px3->SetData($graph_datas);
$arraylegends=array($langs->transnoentities("Balance"));
@ -760,7 +760,7 @@ print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
if ($account)
{
@ -799,7 +799,7 @@ else
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">';
if ($account && $_GET["option"]!='all')
{
@ -813,6 +813,9 @@ print '</td></tr>';
print '</table>';
dol_fiche_end();
print '<table class="notopnoleftnoright" width="100%">';
// Navigation links
@ -876,8 +879,6 @@ if ($mode == 'showalltime')
print '</table>';
print "\n</div>\n";
llxFooter();

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -128,22 +128,21 @@ if (empty($num))
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '</table>';
print '<br>';
dol_fiche_end();
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&amp;account=".$acct->id, $sortfield, $sortorder,'',$numrows);
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$acct->id, $sortfield, $sortorder,'',$numrows);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -489,15 +488,15 @@ else
if ($objp->amount < 0)
{
$totald = $totald + abs($objp->amount);
print '<td align="right" nowrap=\"nowrap\">'.price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
print '<td align="right" class="nowrap">'.price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
}
else
{
$totalc = $totalc + abs($objp->amount);
print "<td>&nbsp;</td><td align=\"right\" nowrap=\"nowrap\">".price($objp->amount)."</td>\n";
print '<td>&nbsp;</td><td align="right" class="nowrap">'.price($objp->amount)."</td>\n";
}
print "<td align=\"right\" nowrap=\"nowrap\">".price($total)."</td>\n";
print '<td align="right" class="nowrap">'.price($total)."</td>\n";
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
{

View File

@ -85,10 +85,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
}
/*
*
*
*/
// Onglets
$head=bank_prepare_head($acct);
dol_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0,'account');
@ -98,25 +94,26 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '</table>';
print '<br>';
dol_fiche_end();
$solde = $acct->solde(0);
/*
* Affiche tableau des echeances a venir
*/
print '<table class="notopnoleftnoright" width="100% border="1">';
print '<table class="noborder centpercent">';
// Ligne de titre tableau des ecritures
print '<tr class="liste_titre">';
@ -134,13 +131,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$var=!$var;
print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("CurrentBalance").'</td>';
print '<td align="right" nowrap>'.price($solde).'</td>';
print '<td align="right" class="nowrap">'.price($solde).'</td>';
print '</tr>';
$var=!$var;
print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("RemainderToPay").'</td>';
print '<td align="right" nowrap>&nbsp;</td>';
print '<td align="right" class="nowrap">&nbsp;</td>';
print '</tr>';
@ -330,7 +327,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$var=!$var;
print '<tr class="liste_total">';
print '<td align="left" colspan="5">'.$langs->trans("FutureBalance").' ('.$acct->currency_code.')</td>';
print '<td align="right" nowrap>'.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).'</td>';
print '<td align="right" class="nowrap">'.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).'</td>';
print '</tr>';
print "</table>";

View File

@ -94,15 +94,14 @@ if ($conf->salaries->enabled)
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm, s.salary, u.salary as current_salary";
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE s.entity IN (".getEntity('user',1).")";
$sql.= " AND u.rowid = s.fk_user";
if ($year > 0)
{
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
$sql.= " AND (s.datesp between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
$sql.= " OR s.dateep between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."')";
}
if (preg_match('/^s\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
@ -114,11 +113,11 @@ if ($conf->salaries->enabled)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
@ -130,7 +129,8 @@ if ($conf->salaries->enabled)
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
print '<td align="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";
print "<td>".$obj->label."</td>\n";
@ -141,7 +141,7 @@ if ($conf->salaries->enabled)
$sal_static->ref=$obj->rowid;
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>";
print "</tr>\n";

View File

@ -1969,6 +1969,8 @@ if ($action == 'create')
print '<input type="hidden" name="origin" value="' . $origin . '">';
print '<input type="hidden" name="originid" value="' . $originid . '">';
dol_fiche_head('');
print '<table class="border" width="100%">';
// Ref
@ -2099,7 +2101,7 @@ if ($action == 'create')
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#typedeposit, #valuedeposit").click(function() {
jQuery("#radio_deposit").attr(\'checked\',\'checked\');
jQuery("#radio_deposit").prop("checked", true);
});
});
</script>';
@ -2154,7 +2156,7 @@ if ($action == 'create')
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#fac_replacement").change(function() {
jQuery("#radio_replacement").attr(\'checked\',\'checked\');
jQuery("#radio_replacement").prop("checked", true);
});
});
</script>';
@ -2200,7 +2202,7 @@ if ($action == 'create')
// Show credit note options only if we checked credit note
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
if (! jQuery("#radio_creditnote").attr(\'checked\'))
if (! jQuery("#radio_creditnote").is(":checked"))
{
jQuery("#credit_note_options").hide();
}
@ -2229,8 +2231,8 @@ if ($action == 'create')
print $desc;
print '<div id="credit_note_options">';
print '&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').attr(\'checked\',\'checked\'); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').attr(\'checked\',\'checked\'); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop("checked", true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop("checked", true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '</div>';
print '</td></tr>' . "\n";
@ -2472,8 +2474,10 @@ if ($action == 'create')
print "</table>\n";
dol_fiche_end();
// Button "Create Draft"
print '<br><div class="center">';
print '<div class="center">';
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
print '&nbsp; &nbsp; &nbsp;';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
@ -3137,28 +3141,28 @@ if ($action == 'create')
// Paye partiellement 'escompte'
if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'discount_vat') {
print '<tr><td colspan="' . $nbcols . '" align="right" nowrap="1">';
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1);
print '</td><td align="right">' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . '</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
}
// Paye partiellement ou Abandon 'badcustomer'
if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'badcustomer') {
print '<tr><td colspan="' . $nbcols . '" align="right" nowrap="1">';
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1);
print '</td><td align="right">' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . '</td><td>&nbsp;</td></tr>';
// $resteapayeraffiche=0;
}
// Paye partiellement ou Abandon 'product_returned'
if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'product_returned') {
print '<tr><td colspan="' . $nbcols . '" align="right" nowrap="1">';
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1);
print '</td><td align="right">' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . '</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
}
// Paye partiellement ou Abandon 'abandon'
if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'abandon') {
print '<tr><td colspan="' . $nbcols . '" align="right" nowrap="1">';
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';
$text = $langs->trans("HelpAbandonOther");
if ($object->close_note)
$text .= '<br><br><b>' . $langs->trans("Reason") . '</b>:' . $object->close_note;
@ -3319,7 +3323,7 @@ if ($action == 'create')
print $object->situation_counter;
print '</td>';
print '<td align="right" colspan="2" nowrap>';
print '<td align="right" colspan="2" class="nowrap">';
$prevsits_total_amount = 0;
foreach ($prevsits as $situation) {
@ -3340,7 +3344,7 @@ if ($action == 'create')
print $prevsits[$i]->situation_counter;
print '</a></td>';
print '<td align="right" colspan="2" nowrap>';
print '<td align="right" colspan="2" class="nowrap">';
print '- ' . price($prevsits[$i]->total_ht);
print '</td>';
print '<td>' . $langs->trans('Currency' . $conf->currency) . '</td></tr>';
@ -3350,20 +3354,20 @@ if ($action == 'create')
// Amount
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
print '<td colspan="3" nowrap>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td colspan="3" nowrap>' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '<td colspan="3" class="nowrap">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td colspan="3" class="nowrap">' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '</tr>';
// Amount Local Taxes
if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1
{
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
print '<td colspan="3" nowrap>' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '<td colspan="3" class="nowrap">' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
}
if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2
{
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
print '<td colspan="3" nowrap>' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
print '<td colspan="3" class=nowrap">' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '</td></tr>';
}
// Revenue stamp

View File

@ -300,7 +300,7 @@ if ($resql)
print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Company'),$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountVAT'),$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);

View File

@ -393,16 +393,16 @@ llxHeader('',$title);
<script type="text/javascript">
$(document).ready(function() {
$("#checkall").click(function() {
$(".checkformerge").attr('checked', true);
$(".checkformerge").prop('checked', true);
});
$("#checknone").click(function() {
$(".checkformerge").attr('checked', false);
$(".checkformerge").prop('checked', false);
});
$("#checkallsend").click(function() {
$(".checkforsend").attr('checked', true);
$(".checkforsend").prop('checked', true);
});
$("#checknonesend").click(function() {
$(".checkforsend").attr('checked', false);
$(".checkforsend").prop('checked', false);
});
});
</script>
@ -646,7 +646,7 @@ if ($resql)
print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"f.fk_reglement_mode","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Taxes"),$_SERVER["PHP_SELF"],"f.tva","",$param,'align="right"',$sortfield,$sortorder);
@ -683,7 +683,7 @@ if ($resql)
print '</td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($search_paymentmode, 'search_paymentmode');
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1);
print '</td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="8" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
@ -799,7 +799,7 @@ if ($resql)
print '</td>';
// Remain to receive
print '<td align="right">'.((! empty($objp->am) || ! empty($cn) || ! empty($dep))?price($objp->total_ttc-$objp->am-$cn-$dep):'&nbsp;').'</td>';
print '<td align="right">'.(((! empty($objp->total_ttc) || ! empty($objp->am) || ! empty($cn) || ! empty($dep)) && ($objp->total_ttc - $objp->am - $cn - $dep)) ? price($objp->total_ttc - $objp->am - $cn - $dep):'&nbsp;').'</td>';
// Status of invoice
print '<td align="right" class="nowrap">';

View File

@ -399,27 +399,27 @@ if ($object->id > 0)
// Montants
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_ht).'</td>';
print '<td align="right" colspan="2" class="nowrap">'.price($object->total_ht).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" nowrap>'.price($object->total_tva).'</td>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td align="right" colspan="2" class="nowrap">'.price($object->total_tva).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
// Amount Local Taxes
if ($mysoc->localtax1_assuj=="1") //Localtax1
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax1).'</td>';
print '<td align="right" colspan="2" class="nowrap">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right" colspan="2" nowrap>'.price($object->total_localtax2).'</td>';
print '<td align="right" colspan="2" class="nowrap">'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
}
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" class="nowrap">'.price($object->total_ttc).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
// We can also use bcadd to avoid pb with floating points
@ -428,7 +428,7 @@ if ($object->id > 0)
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td align="right" colspan="2" nowrap>'.price($resteapayer).'</td>';
print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td align="right" colspan="2" class="nowrap">'.price($resteapayer).'</td>';
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
// Statut

View File

@ -86,7 +86,7 @@ function pt ($db, $sql, $date)
$i++;
}
print '<tr class="liste_total"><td align="right">'.$langs->trans("Total")." :</td><td nowrap=\"nowrap\" align=\"right\"><b>".price($total)."</b></td><td>&nbsp;</td></tr>";
print '<tr class="liste_total"><td align="right">'.$langs->trans("Total")." :</td><td class=\"nowrap\" align=\"right\"><b>".price($total)."</b></td><td>&nbsp;</td></tr>";
print "</table>";
$db->free($result);
@ -253,7 +253,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
$subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
}
}
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td nowrap align="right">'.price($total).'</td>';
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td class="nowrap" align="right">'.price($total).'</td>';
print "<td>&nbsp;</td>\n";
print '</tr>';

View File

@ -414,11 +414,11 @@ if ($action == 'new')
{
jQuery("#checkall_'.$bid.'").click(function()
{
jQuery(".checkforremise_'.$bid.'").attr(\'checked\', true);
jQuery(".checkforremise_'.$bid.'").prop(\'checked\', true);
});
jQuery("#checknone_'.$bid.'").click(function()
{
jQuery(".checkforremise_'.$bid.'").attr(\'checked\', false);
jQuery(".checkforremise_'.$bid.'").prop(\'checked\', false);
});
});
</script>

View File

@ -1,57 +0,0 @@
<?php
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/resultat/bilan.php
* \ingroup compta
* \brief Fichier page bilan compta
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id > 0) $socid = $user->societe_id;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
/*
* Views
*/
llxHeader();
$year=$_GET["year"];
$month=$_GET["month"];
if (! $year) { $year = strftime("%Y", time()); }
/* Le compte de r<>sultat est un document officiel requis par l'administration selon le status ou activit<69> */
print_titre("Bilan".($year?" annee $year":""));
print '<br>';
print $langs->trans("FeatureNotYetAvailable");
llxFooter();
$db->close();

View File

@ -144,6 +144,9 @@ else {
$builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
}
$hselected = 'report';
report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
// Show report array

View File

@ -1,52 +0,0 @@
<?php
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id > 0) $socid = $user->societe_id;
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
/*
* Views
*/
llxHeader();
$year=$_GET["year"];
$month=$_GET["month"];
if (! $year) { $year = strftime("%Y", time()); }
/* Le compte de resultat est un document officiel requis par l'administration selon le status ou activite */
print_titre("Compte de resultat".($year?" annee $year":""));
print '<br>';
print $langs->trans("FeatureNotYetAvailable");
llxFooter();
$db->close();

View File

@ -88,6 +88,9 @@ else {
$builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
}
$hselected='report';
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);

View File

@ -45,7 +45,7 @@ $socid = GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', '', '', '');
$sal = new PaymentSalary($db);
$object = new PaymentSalary($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('salarycard','globalcard'));
@ -66,55 +66,61 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$error=0;
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
$sal->accountid=GETPOST("accountid","int");
$sal->fk_user=GETPOST("fk_user","int");
$sal->datev=$datev;
$sal->datep=$datep;
$sal->amount=price2num(GETPOST("amount"));
$sal->label=GETPOST("label");
$sal->datesp=$datesp;
$sal->dateep=$dateep;
$sal->note=GETPOST("note");
$sal->type_payment=GETPOST("paymenttype");
$sal->num_payment=GETPOST("num_payment");
$sal->fk_user_creat=$user->id;
if (empty($datev)) $datev=$datep;
$object->accountid=GETPOST("accountid","int");
$object->fk_user=GETPOST("fk_user","int");
$object->datev=$datev;
$object->datep=$datep;
$object->amount=price2num(GETPOST("amount"));
$object->label=GETPOST("label");
$object->datesp=$datesp;
$object->dateep=$dateep;
$object->note=GETPOST("note");
$object->type_payment=GETPOST("paymenttype");
$object->num_payment=GETPOST("num_payment");
$object->fk_user_creat=$user->id;
// Set user current salary as ref salaray for the payment
$fuser=new User($db);
$fuser->fetch(GETPOST("fk_user","int"));
$sal->salary=$fuser->salary;
$object->salary=$fuser->salary;
if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
$error++;
}
if (empty($sal->fk_user) || $sal->fk_user < 0)
if (empty($object->fk_user) || $object->fk_user < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Employee")),'errors');
$error++;
}
if (empty($sal->type_payment) || $sal->type_payment < 0)
if (empty($object->type_payment) || $object->type_payment < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');
$error++;
}
if (empty($sal->amount))
if (empty($object->amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")),'errors');
$error++;
}
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Account")),'errors');
$error++;
}
if (! $error)
{
$db->begin();
$ret=$sal->create($user);
$ret=$object->create($user);
if ($ret > 0)
{
$db->commit();
@ -124,7 +130,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
else
{
$db->rollback();
setEventMessage($sal->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action="create";
}
}
@ -134,19 +140,19 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
if ($action == 'delete')
{
$result=$sal->fetch($id);
$result=$object->fetch($id);
if ($sal->rappro == 0)
if ($object->rappro == 0)
{
$db->begin();
$ret=$sal->delete($user);
$ret=$object->delete($user);
if ($ret > 0)
{
if ($sal->fk_bank)
if ($object->fk_bank)
{
$accountline=new AccountLine($db);
$result=$accountline->fetch($sal->fk_bank);
$result=$accountline->fetch($object->fk_bank);
if ($result > 0) $result=$accountline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
}
@ -158,15 +164,15 @@ if ($action == 'delete')
}
else
{
$sal->error=$accountline->error;
$object->error=$accountline->error;
$db->rollback();
setEventMessage($sal->error,'errors');
setEventMessage($object->error,'errors');
}
}
else
{
$db->rollback();
setEventMessage($sal->error,'errors');
setEventMessage($object->error,'errors');
}
}
else
@ -186,8 +192,8 @@ $form = new Form($db);
if ($id)
{
$salpayment = new PaymentSalary($db);
$result = $salpayment->fetch($id);
$object = new PaymentSalary($db);
$result = $object->fetch($id);
if ($result <= 0)
{
dol_print_error($db);
@ -221,6 +227,8 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewSalaryPayment"),'', 'title_accountancy.png');
dol_fiche_head('', '');
print '<table class="border" width="100%">';
print "<tr>";
@ -228,7 +236,7 @@ if ($action == 'create')
print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1);
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1);
print '</td></tr>';
@ -281,7 +289,7 @@ if ($action == 'create')
print '</table>';
print "<br>";
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
@ -311,45 +319,45 @@ if ($id)
print "<tr>";
print '<td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $salpayment->ref;
print $object->ref;
print '</td></tr>';
// Person
print '<tr><td>'.$langs->trans("Person").'</td><td>';
$usersal=new User($db);
$usersal->fetch($salpayment->fk_user);
$usersal->fetch($object->fk_user);
print $usersal->getNomUrl(1);
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$salpayment->label.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
print "<tr>";
print '<td>'.$langs->trans("DateStartPeriod").'</td><td colspan="3">';
print dol_print_date($salpayment->datesp,'day');
print dol_print_date($object->datesp,'day');
print '</td></tr>';
print '<tr><td>'.$langs->trans("DateEndPeriod").'</td><td colspan="3">';
print dol_print_date($salpayment->dateep,'day');
print dol_print_date($object->dateep,'day');
print '</td></tr>';
print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td colspan="3">';
print dol_print_date($salpayment->datep,'day');
print dol_print_date($object->datep,'day');
print '</td></tr>';
print '<tr><td>'.$langs->trans("DateValue").'</td><td colspan="3">';
print dol_print_date($salpayment->datev,'day');
print dol_print_date($object->datev,'day');
print '</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($salpayment->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
if (! empty($conf->banque->enabled))
{
if ($salpayment->fk_account > 0)
if ($object->fk_account > 0)
{
$bankline=new AccountLine($db);
$bankline->fetch($salpayment->fk_bank);
$bankline->fetch($object->fk_bank);
print '<tr>';
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
@ -362,21 +370,22 @@ if ($id)
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
print '</div>';
dol_fiche_end();
/*
* Boutons d'actions
*/
print "<div class=\"tabsAction\">\n";
if ($salpayment->rappro == 0)
* Action buttons
*/
print '<div class="tabsAction">'."\n";
if ($object->rappro == 0)
{
if (! empty($user->rights->salaries->delete))
{
print '<a class="butActionDelete" href="card.php?id='.$salpayment->id.'&action=delete">'.$langs->trans("Delete").'</a>';
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
}
else
{

View File

@ -36,6 +36,7 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', '', '', '');
$search_ref = GETPOST('search_ref','int');
$search_user = GETPOST('search_user','alpha');
$search_label = GETPOST('search_label','alpha');
$search_amount = GETPOST('search_amount','alpha');
$sortfield = GETPOST("sortfield",'alpha');
@ -46,7 +47,7 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="s.datev";
if (! $sortfield) $sortfield="s.datep";
if (! $sortorder) $sortorder="DESC";
$filtre=$_GET["filtre"];
@ -85,7 +86,7 @@ $salstatic = new PaymentSalary($db);
$userstatic = new User($db);
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc,";
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,";
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,";
@ -95,7 +96,8 @@ $sql.= " AND s.entity = ".$conf->entity;
// Search criteria
if ($search_ref) $sql.=" AND s.rowid=".$search_ref;
if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'";
if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email', 'u.note'), $search_user);
if ($search_label) $sql.=natural_search(array('s.label'), $search_label);
if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1);
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
@ -129,7 +131,7 @@ if ($result)
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.salary","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("");
@ -141,11 +143,14 @@ if ($result)
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
print '</td>';
// People
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_user" value="'.$search_user.'">';
print '</td>';
// Current salary
print '<td class="liste_titre">&nbsp;</td>';
// Label
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.$search_label.'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
// Date
print '<td class="liste_titre">&nbsp;</td>';
// Type
print '<td class="liste_titre" align="left">';
@ -170,6 +175,7 @@ if ($result)
$userstatic->login=$obj->login;
$userstatic->email=$obj->email;
$userstatic->societe_id=$obj->fk_soc;
$salstatic->id=$obj->rowid;
$salstatic->ref=$obj->rowid;
// Ref
@ -180,7 +186,8 @@ if ($result)
print "<td>".($obj->salary?price($obj->salary):'')."</td>\n";
// Label payment
print "<td>".dol_trunc($obj->label,40)."</td>\n";
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
// Date payment
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
// Amount

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
*
* This program is free software; you can redistribute it and/or modify
@ -23,7 +23,7 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

View File

@ -25,8 +25,8 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/** \class PaymentSocialContribution
* \brief Class to manage payments of social contributions
/**
* Class to manage payments of social contributions
*/
class PaymentSocialContribution extends CommonObject
{

View File

@ -93,7 +93,7 @@ function pt ($db, $sql, $date)
$i++;
}
print '<tr class="liste_total"><td align="right">'.$langs->trans("Total")." :</td><td nowrap=\"nowrap\" align=\"right\"><b>".price($total)."</b></td><td>&nbsp;</td></tr>";
print '<tr class="liste_total"><td align="right">'.$langs->trans("Total")." :</td><td class=\"nowrap\" align=\"right\"><b>".price($total)."</b></td><td>&nbsp;</td></tr>";
print "</table>";
$db->free($result);
@ -216,7 +216,7 @@ for ($m = 1 ; $m < 13 ; $m++ )
$subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
}
}
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td nowrap align="right">'.price($total).'</td>';
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("TotalToPay").':</td><td class="nowrap" align="right">'.price($total).'</td>';
print "<td>&nbsp;</td>\n";
print '</tr>';

View File

@ -798,19 +798,19 @@ else
print '</td></tr>';
// Note Public
print '<tr><td valign="top"><label for="note_public">'.$langs->trans("NotePublic").'</label></td><td colspan="3">';
print '<tr><td class="tdtop"><label for="note_public">'.$langs->trans("NotePublic").'</label></td><td colspan="3">';
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
print '</td></tr>';
// Note Private
print '<tr><td valign="top"><label for="note_private">'.$langs->trans("NotePrivate").'</label></td><td colspan="3">';
print '<tr><td class="tdtop"><label for="note_private">'.$langs->trans("NotePrivate").'</label></td><td colspan="3">';
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
print '</td></tr>';
// Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td>';
print $object->getLibStatut(5);
print '</td></tr>';
@ -1025,16 +1025,16 @@ else
print '</td></tr>';
// Note Public
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
print '<tr><td class="tdtop">'.$langs->trans("NotePublic").'</td><td colspan="3">';
print nl2br($object->note_public);
print '</td></tr>';
// Note Private
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
print '<tr><td class="tdtop">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
print nl2br($object->note_private);
// Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td>';
print $object->getLibStatut(5);
print '</td>';

View File

@ -437,7 +437,7 @@ if ($result)
print '</form>';
if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '&amp;begin='.$begin.'&amp;view='.$view.'&amp;userid='.$userid, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
$db->free($result);
}

View File

@ -1021,12 +1021,12 @@ if ($action == 'create')
}
// Commercial suivi
print '<tr><td width="20%" nowrap><span class="fieldrequired">'.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").'</span></td><td>';
print '<tr><td width="20%" class="nowrap"><span class="fieldrequired">'.$langs->trans("TypeContact_contrat_internal_SALESREPFOLL").'</span></td><td>';
print $form->select_dolusers(GETPOST("commercial_suivi_id")?GETPOST("commercial_suivi_id"):$user->id,'commercial_suivi_id',1,'');
print '</td></tr>';
// Commercial signature
print '<tr><td width="20%" nowrap><span class="fieldrequired">'.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").'</span></td><td>';
print '<tr><td width="20%" class="nowrap"><span class="fieldrequired">'.$langs->trans("TypeContact_contrat_internal_SALESREPSIGN").'</span></td><td>';
print $form->select_dolusers(GETPOST("commercial_signature_id")?GETPOST("commercial_signature_id"):$user->id,'commercial_signature_id',1,'');
print '</td></tr>';

View File

@ -25,15 +25,19 @@
// $action must be defined
// $object must be defined (object is loaded in this file with fetch)
// $cancel must be defined
// $id or $ref must be defined (object is loaded in this file with fetch)
if ($id > 0 || ! empty($ref))
if (($id > 0 || ! empty($ref)) && empty($cancel))
{
$ret = $object->fetch($id,$ref);
if ($ret > 0) {
if ($ret > 0)
{
$object->fetch_thirdparty();
$id=$object->id;
} else {
$id = $object->id;
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}

View File

@ -1124,7 +1124,7 @@ class ExtraFields
if (!empty($value)) {
$checked=' checked ';
}
$value='<input type="checkbox" '.$checked.' '.($moreparam?$moreparam:'').' readonly="readonly" disabled>';
$value='<input type="checkbox" '.$checked.' '.($moreparam?$moreparam:'').' readonly disabled>';
}
elseif ($type == 'mail')
{

View File

@ -56,9 +56,6 @@ class Form
var $cache_types_fees=array();
var $cache_vatrates=array();
var $tva_taux_value;
var $tva_taux_libelle;
/**
* Constructor
@ -3842,10 +3839,10 @@ class Form
/**
* Output an HTML select vat rate
*
* @param string $htmlname Nom champ html
* @param float $selectedrate Forcage du taux tva pre-selectionne. Mettre '' pour aucun forcage.
* @param Societe $societe_vendeuse Objet societe vendeuse
* @param Societe $societe_acheteuse Objet societe acheteuse
* @param string $htmlname Name of html select field
* @param float $selectedrate Force preselected vat rate. Use '' for no forcing.
* @param Societe $societe_vendeuse Thirdparty seller
* @param Societe $societe_acheteuse Thirdparty buyer
* @param int $idprod Id product
* @param int $info_bits Miscellaneous information on line (1 for NPR)
* @param int $type ''=Unknown, 0=Product, 1=Service (Used if idprod not defined)
@ -3863,9 +3860,6 @@ class Form
global $langs,$conf,$mysoc;
$return='';
$txtva=array();
$libtva=array();
$nprtva=array();
// Define defaultnpr and defaultttx
$defaultnpr=($info_bits & 0x01);
@ -3972,10 +3966,6 @@ class Form
$return.= '>'.vatrate($rate['libtva']);
$return.= $rate['nprtva'] ? ' *': '';
$return.= '</option>';
$this->tva_taux_value[] = $rate['txtva'];
$this->tva_taux_libelle[] = $rate['libtva'];
$this->tva_taux_npr[] = $rate['nprtva'];
}
if (! $options_only) $return.= '</select>';
@ -4356,7 +4346,7 @@ class Form
</script>';
}
$out.='<select id="'.preg_replace('/^\./','',$htmlname).'" '.($disabled?'disabled="disabled" ':'').'class="flat '.(preg_replace('/^\./','',$htmlname)).($morecss?' '.$morecss:'').'" name="'.preg_replace('/^\./','',$htmlname).'" '.($moreparam?$moreparam:'').'>';
$out.='<select id="'.preg_replace('/^\./','',$htmlname).'" '.($disabled?'disabled ':'').'class="flat '.(preg_replace('/^\./','',$htmlname)).($morecss?' '.$morecss:'').'" name="'.preg_replace('/^\./','',$htmlname).'" '.($moreparam?$moreparam:'').'>';
if ($show_empty)
{
@ -4425,7 +4415,7 @@ class Form
static function selectArrayAjax($url, $htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0)
{
$out = '';
// Add code for jquery to use multiselect
if ($addjscombo && empty($conf->dol_use_jmobile))
{
@ -4466,14 +4456,14 @@ class Form
else
{
// TODO get values from ajax page to use a standard already completed array
}
$out.=self::selectarray('.'.$htmlname, $array, $id, $show_empty, $key_in_label, $value_as_key, '', $translate, $maxlen, $disabled, $sort, '', 0);
return $out;
}
/**
* Show a multiselect form from an array.
*
@ -4539,7 +4529,7 @@ class Form
// Try also magic suggest
// Add data-role="none" to disable jmobile decoration
$out = '<select data-role="none" id="'.$htmlname.'" class="multiselect'.($morecss?' '.$morecss:'').'" multiple="multiple" name="'.$htmlname.'[]"'.($moreattrib?' '.$moreattrib:'').($width?' style="width: '.(preg_match('/%/',$width)?$width:$width.'px').'"':'').'>'."\n";
$out = '<select data-role="none" id="'.$htmlname.'" class="multiselect'.($morecss?' '.$morecss:'').'" multiple name="'.$htmlname.'[]"'.($moreattrib?' '.$moreattrib:'').($width?' style="width: '.(preg_match('/%/',$width)?$width:$width.'px').'"':'').'>'."\n";
if (is_array($array) && ! empty($array))
{
if ($value_as_key) $array=array_combine($array, $array);
@ -4568,7 +4558,7 @@ class Form
}
/**
* Render list of categories linked to object with id $id and type $type
*

View File

@ -95,17 +95,17 @@ class FormActions
percentage.val(value);
if (defaultvalue == -1) {
percentage.attr('disabled', 'disabled');
percentage.prop('disabled', true);
$('.hideifna').hide();
}
else if (defaultvalue == 0) {
percentage.val(0);
percentage.attr('disabled', 'disabled');
percentage.prop('disabled', true);
$('.hideifna').show();
}
else if (defaultvalue == 100) {
percentage.val(100);
percentage.attr('disabled', 'disabled');
percentage.prop('disabled', true);
$('.hideifna').show();
}
else {

View File

@ -5,7 +5,8 @@
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,7 +21,7 @@
*/
/**
* Class to manage Dolibarr database access for a Mysql database
* Class to manage Dolibarr database access for an SQL database
*/
interface Database
{
@ -111,13 +111,6 @@ interface Database
*/
function error();
/**
* Return label of manager
*
* @return string Label
*/
function getLabel();
/**
* List tables into a database
*
@ -141,7 +134,7 @@ interface Database
* @param string $sortorder Sort order
* @return string String to provide syntax of a sort sql string
*/
function order($sortfield = 0, $sortorder = 0);
function order($sortfield = null, $sortorder = null);
/**
* Decrypt sensitive data in database
@ -216,7 +209,7 @@ interface Database
* @param string $login login
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param string $port Port of database server
* @param int $port Port of database server
* @return resource Database access handler
* @see close
*/
@ -293,10 +286,10 @@ interface Database
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = "", $fulltext_keys = "", $keys = "");
function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null);
/**
* Return list of available charset that can be used to store data in database
@ -382,15 +375,15 @@ interface Database
);
/**
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
*
* Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
*
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
* @param bool $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return int|string Date TMS or ''
*/
function jdate($string, $gm=false);
*/
function jdate($string, $gm=false);
/**
* Encrypt sensitive data in database
@ -424,7 +417,7 @@ interface Database
* @param resource $resultset Fre cursor
* @return void
*/
function free($resultset = 0);
function free($resultset = null);
/**
* Close database connexion

View File

@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2013-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -29,41 +29,43 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/Database.interface.php';
*/
abstract class DoliDB implements Database
{
//! Database handler
public $db;
//! Database type
public $type;
//! Charset used to force charset when creating database
public $forcecharset='utf8';
//! Collate used to force collate when creating database
public $forcecollate='utf8_general_ci';
//! Resultset of last query
private $_results;
//! 1 if connected, else 0
public $connected;
//! 1 if database selected, else 0
public $database_selected;
//! Selected database name
public $database_name;
//! Database username
public $database_user;
//! Database host
public $database_host;
//! Database port
public $database_port;
//! >=1 if a transaction is opened, 0 otherwise
public $transaction_opened;
//! Last successful query
public $lastquery;
//! Last failed query
public $lastqueryerror;
//! Last error message
public $lasterror;
//! Last error number
public $lasterrno;
/** @var resource Database handler */
public $db;
/** @var string Database type */
public $type;
/** @var string Charset used to force charset when creating database */
public $forcecharset='utf8';
/** @var string Collate used to force collate when creating database */
public $forcecollate='utf8_general_ci';
/** @var resource Resultset of last query */
private $_results;
/** @var bool true if connected, else false */
public $connected;
/** @var bool true if database selected, else false */
public $database_selected;
/** @var string Selected database name */
public $database_name;
/** @var string Database username */
public $database_user;
/** @var string Database host */
public $database_host;
/** @var int Database port */
public $database_port;
/** @var int >=1 if a transaction is opened, 0 otherwise */
public $transaction_opened;
/** @var string Last successful query */
public $lastquery;
/** @ar string Last failed query */
public $lastqueryerror;
/** @var string Last error message */
public $lasterror;
/** @var int Last error number */
public $lasterrno;
public $ok;
public $error;
/** @var bool Status */
public $ok;
/** @var string */
public $error;
/**
* Format a SQL IF
@ -205,16 +207,6 @@ abstract class DoliDB implements Database
return preg_split("/[\.,-]/",$this->getVersion());
}
/**
* Return label of manager
*
* @return string Label
*/
function getLabel()
{
return $this->label;
}
/**
* Return last request executed with query()
*
@ -232,9 +224,9 @@ abstract class DoliDB implements Database
* @param string $sortorder Sort order
* @return string String to provide syntax of a sort sql string
*/
function order($sortfield=0,$sortorder=0)
function order($sortfield=null,$sortorder=null)
{
if ($sortfield)
if (isset($sortfield))
{
$return='';
$fields=explode(',',$sortfield);
@ -244,7 +236,9 @@ abstract class DoliDB implements Database
else $return.=',';
$return.=preg_replace('/[^0-9a-z_\.]/i','',$val);
if ($sortorder) $return.=' '.preg_replace('/[^0-9a-z]/i','',$sortorder);
if (isset($sortorder)) {
$return.=' '.preg_replace('/[^0-9a-z]/i','',$sortorder);
}
}
return $return;
}
@ -270,7 +264,7 @@ abstract class DoliDB implements Database
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
*
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
* @param bool $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return int|string Date TMS or ''
*/
function jdate($string, $gm=false)

View File

@ -21,7 +21,7 @@
/**
* \file htdocs/core/db/mssql.class.php
* \brief Fichier de la classe permettant de gerer une base mssql
* \brief Fichier de la classe permettant de gerer une base MSSQL
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
@ -41,7 +41,7 @@ class DoliDBMssql extends DoliDB
var $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value
//! Version min database
const VERSIONMIN='2000';
//! Resultset of last query
/** @var resource Resultset of last query */
private $_results;
/**
@ -57,7 +57,7 @@ class DoliDBMssql extends DoliDB
*/
function __construct($type, $host, $user, $pass, $name='', $port=0)
{
global $conf,$langs;
global $langs;
$this->database_user=$user;
$this->database_host=$host;
@ -66,8 +66,8 @@ class DoliDBMssql extends DoliDB
if (! function_exists("mssql_connect"))
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error="Mssql PHP functions for using MSSql driver are not available in this version of PHP";
dol_syslog(get_class($this)."::DoliDBMssql : MSsql PHP functions for using MSsql driver are not available in this version of PHP",LOG_ERR);
return $this->ok;
@ -75,8 +75,8 @@ class DoliDBMssql extends DoliDB
if (! $host)
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=$langs->trans("ErrorWrongHostParameter");
dol_syslog(get_class($this)."::DoliDBMssql : Erreur Connect, wrong host parameters",LOG_ERR);
return $this->ok;
@ -88,14 +88,14 @@ class DoliDBMssql extends DoliDB
{
// Si client connecte avec charset different de celui de la base Dolibarr
// (La base Dolibarr a ete forcee en this->forcecharset a l'install)
$this->connected = 1;
$this->ok = 1;
$this->connected = true;
$this->ok = true;
}
else
{
// host, login ou password incorrect
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=mssql_get_last_message();
dol_syslog(get_class($this)."::DoliDBMssql : Erreur Connect mssql_get_last_message=".$this->error,LOG_ERR);
}
@ -105,15 +105,15 @@ class DoliDBMssql extends DoliDB
{
if ($this->select_db($name))
{
$this->database_selected = 1;
$this->database_selected = true;
$this->database_name = $name;
$this->ok = 1;
$this->ok = true;
}
else
{
$this->database_selected = 0;
$this->database_selected = false;
$this->database_name = '';
$this->ok = 0;
$this->ok = false;
$this->error=$this->error();
dol_syslog(get_class($this)."::DoliDBMssql : Erreur Select_db ".$this->error,LOG_ERR);
}
@ -121,7 +121,7 @@ class DoliDBMssql extends DoliDB
else
{
// Pas de selection de base demandee, ok ou ko
$this->database_selected = 0;
$this->database_selected = false;
}
return $this->ok;
@ -157,8 +157,8 @@ class DoliDBMssql extends DoliDB
* @param string $login login
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param string $port Port of database server
* @return resource Database access handler
* @param int $port Port of database server
* @return false|resource|true Database access handler
* @see close
*/
function connect($host, $login, $passwd, $name, $port=0)
@ -212,7 +212,7 @@ class DoliDBMssql extends DoliDB
/**
* Close database connexion
*
* @return boolean True if disconnect successfull, false otherwise
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
function close()
@ -220,7 +220,7 @@ class DoliDBMssql extends DoliDB
if ($this->db)
{
if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR);
$this->connected=0;
$this->connected=false;
return mssql_close($this->db);
}
return false;
@ -230,7 +230,7 @@ class DoliDBMssql extends DoliDB
/**
* Start transaction
*
* @return int 1 if transaction successfuly opened or already opened, 0 if error
* @return bool true if transaction successfuly opened or already opened, false if error
*/
function begin()
{
@ -250,7 +250,7 @@ class DoliDBMssql extends DoliDB
}
else
{
return 1;
return true;
}
}
@ -258,7 +258,7 @@ class DoliDBMssql extends DoliDB
* Validate a database transaction
*
* @param string $log Add more log to default log line
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
* @return bool true if validation is OK or transaction level no started, false if ERROR
*/
function commit($log='')
{
@ -272,25 +272,26 @@ class DoliDBMssql extends DoliDB
if ($ret)
{
dol_syslog("COMMIT Transaction",LOG_DEBUG);
return 1;
return true;
}
else
{
return 0;
return false;
}
}
elseif ($this->transaction_opened > 1)
{
return 1;
} else
trigger_error("Commit requested but no transaction remain");
return true;
}
trigger_error("Commit requested but no transaction remain");
return false;
}
/**
* Annulation d'une transaction et retour aux anciennes valeurs
*
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
* @return bool true si annulation ok ou transaction non ouverte, false en cas d'erreur
*/
function rollback($log='')
{
@ -305,9 +306,10 @@ class DoliDBMssql extends DoliDB
}
elseif ($this->transaction_opened > 1)
{
return 1;
} else
trigger_error("Rollback requested but no transaction remain");
return true;
}
trigger_error("Rollback requested but no transaction remain");
return false;
}
/**
@ -317,7 +319,7 @@ class DoliDBMssql extends DoliDB
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
* @return false|resource|true Resultset of answer
*/
function query($query,$usesavepoint=0,$type='auto')
{
@ -459,8 +461,8 @@ class DoliDBMssql extends DoliDB
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param Resultset $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
* @param resource $resultset Curseur de la requete voulue
* @return object|false Object result line or false if KO or end of cursor
*/
function fetch_object($resultset)
{
@ -472,8 +474,8 @@ class DoliDBMssql extends DoliDB
/**
* Return datas as an array
*
* @param Resultset $resultset Resultset of request
* @return array Array
* @param resource $resultset Resultset of request
* @return array|false Array or false if KO or end of cursor
*/
function fetch_array($resultset)
{
@ -486,8 +488,8 @@ class DoliDBMssql extends DoliDB
/**
* Return datas as an array
*
* @param Resultset $resultset Resultset of request
* @return array Array
* @param resource $resultset Resultset of request
* @return array|false Array or false if KO or end of cursor
*/
function fetch_row($resultset)
{
@ -499,7 +501,7 @@ class DoliDBMssql extends DoliDB
/**
* Return number of lines for result of a SELECT
*
* @param Resultset $resultset Resulset of requests
* @param resource $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
*/
@ -513,7 +515,7 @@ class DoliDBMssql extends DoliDB
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
* @param resultset $resultset Curseur de la requete voulue
* @param resource $resultset Curseur de la requete voulue
* @return int Nombre de lignes
* @see num_rows
*/
@ -532,10 +534,10 @@ class DoliDBMssql extends DoliDB
/**
* Free last resultset used.
*
* @param resultset $resultset Curseur de la requete voulue
* @return void
* @param resource $resultset Curseur de la requete voulue
* @return bool
*/
function free($resultset=0)
function free($resultset=null)
{
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
if (! is_resource($resultset)) { $resultset=$this->_results; }
@ -641,7 +643,7 @@ class DoliDBMssql extends DoliDB
*
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
* @param string $fieldid Field name
* @return int Id of row
* @return int Id of row or -1 on error
*/
function last_insert_id($tab,$fieldid='rowid')
{
@ -662,7 +664,7 @@ class DoliDBMssql extends DoliDB
*
* @param string $fieldorvalue Field name or value to encrypt
* @param int $withQuotes Return string with quotes
* @return return XXX(field) or XXX('value') or field or 'value'
* @return string XXX(field) or XXX('value') or field or 'value'
*/
function encrypt($fieldorvalue, $withQuotes=0)
{
@ -720,7 +722,7 @@ class DoliDBMssql extends DoliDB
* @param string $charset Charset used to store data
* @param string $collation Charset used to sort data
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
* @return false|resource|true resource defined if OK, false if KO
*/
function DDLCreateDb($database,$charset='',$collation='',$owner='')
{
@ -786,11 +788,13 @@ class DoliDBMssql extends DoliDB
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="")
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null)
{
// FIXME: $fulltext_keys parameter is unused
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
$sql = "create table ".$table."(";
@ -820,7 +824,7 @@ class DoliDBMssql extends DoliDB
if($primary_key != "")
$pk = "primary key(".$primary_key.")";
if($unique_keys != "")
if(is_array($unique_keys))
{
$i = 0;
foreach($unique_keys as $key => $value)
@ -829,7 +833,7 @@ class DoliDBMssql extends DoliDB
$i++;
}
}
if($keys != "")
if(is_array($keys))
{
$i = 0;
foreach($keys as $key => $value)
@ -841,9 +845,9 @@ class DoliDBMssql extends DoliDB
$sql .= implode(',',$sqlfields);
if($primary_key != "")
$sql .= ",".$pk;
if($unique_keys != "")
if(is_array($unique_keys))
$sql .= ",".implode(',',$sqluq);
if($keys != "")
if(is_array($keys))
$sql .= ",".implode(',',$sqlk);
$sql .=") type=".$type;
@ -859,7 +863,7 @@ class DoliDBMssql extends DoliDB
*
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
* @return resource Resource
* @return false|resource|true Resource
*/
function DDLDescTable($table,$field="")
{
@ -1047,7 +1051,7 @@ class DoliDBMssql extends DoliDB
// FIXME: Dummy method
// TODO: Implement
return '';
return array();
}
/**
@ -1123,7 +1127,7 @@ class DoliDBMssql extends DoliDB
*
* @param string $table Table name which contains fields
* @param mixed $fields String for one field or array of string for multiple field
* @return boolean|multitype:object
* @return false|object
*/
function GetFieldInformation($table,$fields) {
$sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME";

View File

@ -21,13 +21,13 @@
/**
* \file htdocs/core/db/mysql.class.php
* \brief Class file to manage Dolibarr database access for a Mysql database
* \brief Class file to manage Dolibarr database access for a MySQL database
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/**
* Class to manage Dolibarr database access for a Mysql database
* Class to manage Dolibarr database access for a MySQL database using the mysql extension
*/
class DoliDBMysql extends DoliDB
{
@ -37,7 +37,7 @@ class DoliDBMysql extends DoliDB
const LABEL='MySQL';
//! Version min database
const VERSIONMIN='4.1.0';
//! Resultset of last query
/** @var resource Resultset of last query */
private $_results;
/**
@ -69,8 +69,8 @@ class DoliDBMysql extends DoliDB
if (! function_exists("mysql_connect"))
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error="Mysql PHP functions for using MySql driver are not available in this version of PHP. Try to use another driver.";
dol_syslog(get_class($this)."::DoliDBMysql : Mysql PHP functions for using Mysql driver are not available in this version of PHP. Try to use another driver.",LOG_ERR);
return $this->ok;
@ -78,8 +78,8 @@ class DoliDBMysql extends DoliDB
if (! $host)
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=$langs->trans("ErrorWrongHostParameter");
dol_syslog(get_class($this)."::DoliDBMysql : Erreur Connect, wrong host parameters",LOG_ERR);
return $this->ok;
@ -89,14 +89,14 @@ class DoliDBMysql extends DoliDB
$this->db = $this->connect($host, $user, $pass, $name, $port);
if ($this->db)
{
$this->connected = 1;
$this->ok = 1;
$this->connected = true;
$this->ok = true;
}
else
{
// host, login ou password incorrect
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=mysql_error();
dol_syslog(get_class($this)."::DoliDBMysql : Erreur Connect mysql_error=".$this->error,LOG_ERR);
}
@ -106,9 +106,9 @@ class DoliDBMysql extends DoliDB
{
if ($this->select_db($name))
{
$this->database_selected = 1;
$this->database_selected = true;
$this->database_name = $name;
$this->ok = 1;
$this->ok = true;
// If client connected with different charset than Dolibarr HTML output
$clientmustbe='';
@ -122,9 +122,9 @@ class DoliDBMysql extends DoliDB
}
else
{
$this->database_selected = 0;
$this->database_selected = false;
$this->database_name = '';
$this->ok = 0;
$this->ok = false;
$this->error=$this->error();
dol_syslog(get_class($this)."::DoliDBMysql : Erreur Select_db ".$this->error,LOG_ERR);
}
@ -132,7 +132,7 @@ class DoliDBMysql extends DoliDB
else
{
// Pas de selection de base demandee, ok ou ko
$this->database_selected = 0;
$this->database_selected = false;
if ($this->connected)
{
@ -177,14 +177,14 @@ class DoliDBMysql extends DoliDB
}
/**
* Connexion to server
* Connection to server
*
* @param string $host database server host
* @param string $login login
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server
* @return resource Database access handler
* @return resource|false Database access handler
* @see close
*/
function connect($host, $login, $passwd, $name, $port=0)
@ -219,7 +219,7 @@ class DoliDBMysql extends DoliDB
*/
function getDriverInfo()
{
return mysqli_get_client_info();
return mysql_get_client_info();
}
@ -234,7 +234,7 @@ class DoliDBMysql extends DoliDB
if ($this->db)
{
if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR);
$this->connected=0;
$this->connected=false;
return mysql_close($this->db);
}
return false;
@ -247,7 +247,7 @@ class DoliDBMysql extends DoliDB
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
* @return resource|true|false Resultset of answer
*/
function query($query,$usesavepoint=0,$type='auto')
{
@ -287,8 +287,8 @@ class DoliDBMysql extends DoliDB
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param Resultset $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
* @param resource $resultset Curseur de la requete voulue
* @return resource|false Object result line or false if KO or end of cursor
*/
function fetch_object($resultset)
{
@ -300,7 +300,7 @@ class DoliDBMysql extends DoliDB
/**
* Return datas as an array
*
* @param Resultset $resultset Resultset of request
* @param resource $resultset Resultset of request
* @return array Array
*/
function fetch_array($resultset)
@ -327,7 +327,7 @@ class DoliDBMysql extends DoliDB
/**
* Return number of lines for result of a SELECT
*
* @param Resultset $resultset Resulset of requests
* @param resource $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
*/
@ -341,7 +341,7 @@ class DoliDBMysql extends DoliDB
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
* @param resultset $resultset Curseur de la requete voulue
* @param resource $resultset Curseur de la requete voulue
* @return int Nombre de lignes
* @see num_rows
*/
@ -358,10 +358,10 @@ class DoliDBMysql extends DoliDB
/**
* Free last resultset used.
*
* @param resultset $resultset Curseur de la requete voulue
* @param resource $resultset Curseur de la requete voulue
* @return void
*/
function free($resultset=0)
function free($resultset=null)
{
// If resultset not provided, we take the last used by connexion
if (! is_resource($resultset)) { $resultset=$this->_results; }
@ -558,7 +558,7 @@ class DoliDBMysql extends DoliDB
* @param string $charset Charset used to store data
* @param string $collation Charset used to sort data
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
* @return false|resource|true resource defined if OK, null if KO
*/
function DDLCreateDb($database,$charset='',$collation='',$owner='')
{
@ -634,11 +634,13 @@ class DoliDBMysql extends DoliDB
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="")
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null)
{
// FIXME: $fulltext_keys parameter is unused
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
$sql = "CREATE TABLE ".$table."(";
@ -673,7 +675,7 @@ class DoliDBMysql extends DoliDB
if($primary_key != "")
$pk = "primary key(".$primary_key.")";
if($unique_keys != "")
if(is_array($unique_keys))
{
$i = 0;
foreach($unique_keys as $key => $value)
@ -682,7 +684,7 @@ class DoliDBMysql extends DoliDB
$i++;
}
}
if($keys != "")
if(is_array($keys))
{
$i = 0;
foreach($keys as $key => $value)
@ -694,9 +696,9 @@ class DoliDBMysql extends DoliDB
$sql .= implode(',',$sqlfields);
if($primary_key != "")
$sql .= ",".$pk;
if($unique_keys != "")
if(is_array($unique_keys))
$sql .= ",".implode(',',$sqluq);
if($keys != "")
if(is_array($keys))
$sql .= ",".implode(',',$sqlk);
$sql .=") engine=".$type;
@ -712,7 +714,7 @@ class DoliDBMysql extends DoliDB
*
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
* @return resource Resource
* @return false|resource|true Resource
*/
function DDLDescTable($table,$field="")
{

View File

@ -21,13 +21,13 @@
/**
* \file htdocs/core/db/mysqli.class.php
* \brief Class file to manage Dolibarr database access for a Mysql database
* \brief Class file to manage Dolibarr database access for a MySQL database
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/**
* Class to manage Dolibarr database access for a Mysql database
* Class to manage Dolibarr database access for a MySQL database using the MySQLi extension
*/
class DoliDBMysqli extends DoliDB
{
@ -36,8 +36,8 @@ class DoliDBMysqli extends DoliDB
//! Database label
const LABEL='MySQL';
//! Version min database
const VERSIONMIN='4.1.0';
//! Resultset of last query
const VERSIONMIN='4.1.3';
/** @var mysqli_result Resultset of last query */
private $_results;
/**
@ -69,8 +69,8 @@ class DoliDBMysqli extends DoliDB
if (! function_exists("mysqli_connect"))
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error="Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.";
dol_syslog(get_class($this)."::DoliDBMysqli : Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.",LOG_ERR);
return $this->ok;
@ -78,8 +78,8 @@ class DoliDBMysqli extends DoliDB
if (! $host)
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=$langs->trans("ErrorWrongHostParameter");
dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Connect, wrong host parameters",LOG_ERR);
return $this->ok;
@ -91,14 +91,14 @@ class DoliDBMysqli extends DoliDB
if ($this->db)
{
$this->connected = 1;
$this->ok = 1;
$this->connected = true;
$this->ok = true;
}
else
{
// host, login ou password incorrect
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=mysqli_connect_error();
dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Connect mysqli_connect_error=".$this->error,LOG_ERR);
}
@ -108,9 +108,9 @@ class DoliDBMysqli extends DoliDB
{
if ($this->select_db($name))
{
$this->database_selected = 1;
$this->database_selected = true;
$this->database_name = $name;
$this->ok = 1;
$this->ok = true;
// If client connected with different charset than Dolibarr HTML output
$clientmustbe='';
@ -124,9 +124,9 @@ class DoliDBMysqli extends DoliDB
}
else
{
$this->database_selected = 0;
$this->database_selected = false;
$this->database_name = '';
$this->ok = 0;
$this->ok = false;
$this->error=$this->error();
dol_syslog(get_class($this)."::DoliDBMysqli : Erreur Select_db ".$this->error,LOG_ERR);
}
@ -134,7 +134,7 @@ class DoliDBMysqli extends DoliDB
else
{
// Pas de selection de base demandee, ok ou ko
$this->database_selected = 0;
$this->database_selected = false;
if ($this->connected)
{
@ -187,7 +187,7 @@ class DoliDBMysqli extends DoliDB
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server
* @return resource Database access handler
* @return mysqli Database access handler
* @see close
*/
function connect($host, $login, $passwd, $name, $port=0)
@ -230,7 +230,7 @@ class DoliDBMysqli extends DoliDB
/**
* Close database connexion
*
* @return boolean True if disconnect successfull, false otherwise
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
function close()
@ -238,7 +238,7 @@ class DoliDBMysqli extends DoliDB
if ($this->db)
{
if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR);
$this->connected=0;
$this->connected=false;
return mysqli_close($this->db);
}
return false;
@ -251,7 +251,7 @@ class DoliDBMysqli extends DoliDB
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
* @return bool|mysqli_result Resultset of answer
*/
function query($query,$usesavepoint=0,$type='auto')
{
@ -290,8 +290,8 @@ class DoliDBMysqli extends DoliDB
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param Resultset $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
* @param mysqli_result $resultset Curseur de la requete voulue
* @return object|null Object result line or null if KO or end of cursor
*/
function fetch_object($resultset)
{
@ -304,8 +304,8 @@ class DoliDBMysqli extends DoliDB
/**
* Return datas as an array
*
* @param Resultset $resultset Resultset of request
* @return array Array
* @param mysqli_result $resultset Resultset of request
* @return array|null Array or null if KO or end of cursor
*/
function fetch_array($resultset)
{
@ -317,8 +317,8 @@ class DoliDBMysqli extends DoliDB
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
* @param mysqli_result $resultset Resultset of request
* @return array|null|0 Array or null if KO or end of cursor or 0 if resultset is bool
*/
function fetch_row($resultset)
{
@ -338,8 +338,8 @@ class DoliDBMysqli extends DoliDB
/**
* Return number of lines for result of a SELECT
*
* @param Resultset $resultset Resulset of requests
* @return int Nb of lines
* @param mysqli_result $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
*/
function num_rows($resultset)
@ -352,8 +352,8 @@ class DoliDBMysqli extends DoliDB
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
* @param resultset $resultset Curseur de la requete voulue
* @return int Nombre de lignes
* @param mysqli_result $resultset Curseur de la requete voulue
* @return int Nombre de lignes
* @see num_rows
*/
function affected_rows($resultset)
@ -369,10 +369,10 @@ class DoliDBMysqli extends DoliDB
/**
* Libere le dernier resultset utilise sur cette connexion
*
* @param resultset $resultset Curseur de la requete voulue
* @param mysqli_result $resultset Curseur de la requete voulue
* @return void
*/
function free($resultset=0)
function free($resultset=null)
{
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
@ -401,8 +401,7 @@ class DoliDBMysqli extends DoliDB
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide.
return 'DB_ERROR_FAILED_TO_CONNECT';
}
else {
} else {
// Constants to convert a MySql error code to a generic Dolibarr error code
$errorcode_map = array(
1004 => 'DB_ERROR_CANNOT_CREATE',
@ -434,8 +433,7 @@ class DoliDBMysqli extends DoliDB
1451 => 'DB_ERROR_CHILD_EXISTS'
);
if (isset($errorcode_map[mysqli_errno($this->db)]))
{
if (isset($errorcode_map[mysqli_errno($this->db)])) {
return $errorcode_map[mysqli_errno($this->db)];
}
$errno=mysqli_errno($this->db);
@ -464,7 +462,7 @@ class DoliDBMysqli extends DoliDB
*
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
* @param string $fieldid Field name
* @return int Id of row
* @return int|string Id of row
*/
function last_insert_id($tab,$fieldid='rowid')
{
@ -562,7 +560,7 @@ class DoliDBMysqli extends DoliDB
* @param string $charset Charset used to store data
* @param string $collation Charset used to sort data
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
* @return bool|mysqli_result resource defined if OK, null if KO
*/
function DDLCreateDb($database,$charset='',$collation='',$owner='')
{
@ -638,11 +636,13 @@ class DoliDBMysqli extends DoliDB
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="")
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null)
{
// FIXME: $fulltext_keys parameter is unused
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
$sql = "CREATE TABLE ".$table."(";
@ -677,8 +677,7 @@ class DoliDBMysqli extends DoliDB
if($primary_key != "")
$pk = "primary key(".$primary_key.")";
if($unique_keys != "")
{
if(is_array($unique_keys)) {
$i = 0;
foreach($unique_keys as $key => $value)
{
@ -686,7 +685,7 @@ class DoliDBMysqli extends DoliDB
$i++;
}
}
if($keys != "")
if(is_array($keys))
{
$i = 0;
foreach($keys as $key => $value)
@ -700,7 +699,7 @@ class DoliDBMysqli extends DoliDB
$sql .= ",".$pk;
if($unique_keys != "")
$sql .= ",".implode(',',$sqluq);
if($keys != "")
if(is_array($keys))
$sql .= ",".implode(',',$sqlk);
$sql .=") engine=".$type;
@ -716,7 +715,7 @@ class DoliDBMysqli extends DoliDB
*
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
* @return resource Resultset x (x->Field, x->Type, ...)
* @return bool|mysqli_result Resultset x (x->Field, x->Type, ...)
*/
function DDLDescTable($table,$field="")
{
@ -763,14 +762,10 @@ class DoliDBMysqli extends DoliDB
$sql.= " ".$field_position;
dol_syslog(get_class($this)."::DDLAddField ".$sql,LOG_DEBUG);
if(! $this->query($sql))
{
return -1;
}
else
{
if($this->query($sql)) {
return 1;
}
return -1;
}
/**
@ -808,12 +803,11 @@ class DoliDBMysqli extends DoliDB
{
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
dol_syslog(get_class($this)."::DDLDropField ".$sql,LOG_DEBUG);
if (! $this->query($sql))
{
$this->error=$this->lasterror();
return -1;
if ($this->query($sql)) {
return 1;
}
else return 1;
$this->error=$this->lasterror();
return -1;
}
@ -883,7 +877,7 @@ class DoliDBMysqli extends DoliDB
/**
* Return list of available charset that can be used to store data in database
*
* @return array List of Charset
* @return array|null List of Charset
*/
function getListOfCharacterSet()
{
@ -926,7 +920,7 @@ class DoliDBMysqli extends DoliDB
/**
* Return list of available collation that can be used for database
*
* @return array Liste of Collation
* @return array|null Liste of Collation
*/
function getListOfCollation()
{

View File

@ -45,7 +45,7 @@ class DoliDBPgsql extends DoliDB
var $forcecollate=''; // Can't be static as it may be forced with a dynamic value
//! Version min database
const VERSIONMIN='8.4.0'; // Version min database
//! Resultset of last query
/** @var resource Resultset of last query */
private $_results;
public $unescapeslashquot;
@ -80,8 +80,8 @@ class DoliDBPgsql extends DoliDB
if (! function_exists("pg_connect"))
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error="Pgsql PHP functions are not available in this version of PHP";
dol_syslog(get_class($this)."::DoliDBPgsql : Pgsql PHP functions are not available in this version of PHP",LOG_ERR);
return $this->ok;
@ -89,8 +89,8 @@ class DoliDBPgsql extends DoliDB
if (! $host)
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=$langs->trans("ErrorWrongHostParameter");
dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Connect, wrong host parameters",LOG_ERR);
return $this->ok;
@ -102,14 +102,14 @@ class DoliDBPgsql extends DoliDB
if ($this->db)
{
$this->connected = 1;
$this->ok = 1;
$this->connected = true;
$this->ok = true;
}
else
{
// host, login ou password incorrect
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error='Host, login or password incorrect';
dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Connect ".$this->error,LOG_ERR);
}
@ -119,15 +119,15 @@ class DoliDBPgsql extends DoliDB
{
if ($this->select_db($name))
{
$this->database_selected = 1;
$this->database_selected = true;
$this->database_name = $name;
$this->ok = 1;
$this->ok = true;
}
else
{
$this->database_selected = 0;
$this->database_selected = false;
$this->database_name = '';
$this->ok = 0;
$this->ok = false;
$this->error=$this->error();
dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Select_db ".$this->error,LOG_ERR);
}
@ -135,7 +135,7 @@ class DoliDBPgsql extends DoliDB
else
{
// Pas de selection de base demandee, ok ou ko
$this->database_selected = 0;
$this->database_selected = false;
}
return $this->ok;
@ -147,10 +147,10 @@ class DoliDBPgsql extends DoliDB
*
* @param string $line SQL request line to convert
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @param string $unescapeslashquot Unescape slash quote with quote quote
* @param bool $unescapeslashquot Unescape slash quote with quote quote
* @return string SQL request line converted
*/
static function convertSQLFromMysql($line,$type='auto',$unescapeslashquot=0)
static function convertSQLFromMysql($line,$type='auto',$unescapeslashquot=false)
{
// Removed empty line if this is a comment line for SVN tagging
if (preg_match('/^--\s\$Id/i',$line)) {
@ -353,7 +353,7 @@ class DoliDBPgsql extends DoliDB
* On compare juste manuellement si la database choisie est bien celle activee par la connexion
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
* @return bool true if OK, false if KO
*/
function select_db($database)
{
@ -369,7 +369,7 @@ class DoliDBPgsql extends DoliDB
* @param string $passwd Password
* @param string $name Name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server
* @return resource Database access handler
* @return false|resource Database access handler
* @see close
*/
function connect($host, $login, $passwd, $name, $port=0)
@ -451,7 +451,7 @@ class DoliDBPgsql extends DoliDB
if ($this->db)
{
if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR);
$this->connected=0;
$this->connected=false;
return pg_close($this->db);
}
return false;
@ -463,7 +463,7 @@ class DoliDBPgsql extends DoliDB
* @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
* @return false|resource Resultset of answer
*/
function query($query,$usesavepoint=0,$type='auto')
{
@ -530,8 +530,8 @@ class DoliDBPgsql extends DoliDB
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param Resultset $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
* @param resource $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor
*/
function fetch_object($resultset)
{
@ -544,7 +544,7 @@ class DoliDBPgsql extends DoliDB
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
* @return false|array Array
*/
function fetch_array($resultset)
{
@ -557,7 +557,7 @@ class DoliDBPgsql extends DoliDB
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
* @return false|array Array
*/
function fetch_row($resultset)
{
@ -569,8 +569,8 @@ class DoliDBPgsql extends DoliDB
/**
* Return number of lines for result of a SELECT
*
* @param Resultset $resultset Resulset of requests
* @return int Nb of lines
* @param resourse $resultset Resulset of requests
* @return int Nb of lines, -1 on error
* @see affected_rows
*/
function num_rows($resultset)
@ -583,7 +583,7 @@ class DoliDBPgsql extends DoliDB
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
* @param Resultset $resultset Result set of request
* @param resource $resultset Result set of request
* @return int Nb of lines
* @see num_rows
*/
@ -600,10 +600,10 @@ class DoliDBPgsql extends DoliDB
/**
* Libere le dernier resultset utilise sur cette connexion
*
* @param Resultset $resultset Result set of request
* @param resource $resultset Result set of request
* @return void
*/
function free($resultset=0)
function free($resultset=null)
{
// If resultset not provided, we take the last used by connexion
if (! is_resource($resultset)) { $resultset=$this->_results; }
@ -746,7 +746,7 @@ class DoliDBPgsql extends DoliDB
*
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
* @param string $fieldid Field name
* @return int Id of row
* @return string Id of row
*/
function last_insert_id($tab,$fieldid='rowid')
{
@ -827,7 +827,7 @@ class DoliDBPgsql extends DoliDB
* @param string $charset Charset used to store data
* @param string $collation Charset used to sort data
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
* @return false|resource resource defined if OK, null if KO
*/
function DDLCreateDb($database,$charset='',$collation='',$owner='')
{
@ -910,11 +910,13 @@ class DoliDBPgsql extends DoliDB
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="")
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null)
{
// FIXME: $fulltext_keys parameter is unused
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
$sql = "create table ".$table."(";
@ -944,7 +946,7 @@ class DoliDBPgsql extends DoliDB
if($primary_key != "")
$pk = "primary key(".$primary_key.")";
if($unique_keys != "")
if(is_array($unique_keys))
{
$i = 0;
foreach($unique_keys as $key => $value)
@ -953,7 +955,7 @@ class DoliDBPgsql extends DoliDB
$i++;
}
}
if($keys != "")
if(is_array($keys))
{
$i = 0;
foreach($keys as $key => $value)
@ -965,9 +967,9 @@ class DoliDBPgsql extends DoliDB
$sql .= implode(',',$sqlfields);
if($primary_key != "")
$sql .= ",".$pk;
if($unique_keys != "")
if(is_array($unique_keys))
$sql .= ",".implode(',',$sqluq);
if($keys != "")
if(is_array($keys))
$sql .= ",".implode(',',$sqlk);
$sql .=") type=".$type;
@ -1007,7 +1009,7 @@ class DoliDBPgsql extends DoliDB
*
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
* @return resource Resultset x (x->attname)
* @return false|resource Resultset x (x->attname)
*/
function DDLDescTable($table,$field="")
{
@ -1052,8 +1054,7 @@ class DoliDBPgsql extends DoliDB
dol_syslog($sql,LOG_DEBUG);
if(! $this -> query($sql))
return -1;
else
return -1;
return 1;
}
@ -1078,8 +1079,7 @@ class DoliDBPgsql extends DoliDB
dol_syslog($sql,LOG_DEBUG);
if (! $this->query($sql))
return -1;
else
return -1;
return 1;
}
@ -1099,7 +1099,7 @@ class DoliDBPgsql extends DoliDB
$this->error=$this->lasterror();
return -1;
}
else return 1;
return 1;
}
/**

View File

@ -37,7 +37,7 @@ class DoliDBSqlite extends DoliDB
const LABEL='PDO Sqlite';
//! Version min database
const VERSIONMIN='3.0.0';
//! Resultset of last query
/** @var PDOStatement Resultset of last query */
private $_results;
/**
@ -54,7 +54,7 @@ class DoliDBSqlite extends DoliDB
*/
function __construct($type, $host, $user, $pass, $name='', $port=0)
{
global $conf,$langs;
global $conf;
// Note that having "static" property for "$forcecharset" and "$forcecollate" will make error here in strict mode, so they are not static
if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set;
@ -70,8 +70,8 @@ class DoliDBSqlite extends DoliDB
/*if (! function_exists("sqlite_query"))
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error="Sqlite PHP functions for using Sqlite driver are not available in this version of PHP. Try to use another driver.";
dol_syslog(get_class($this)."::DoliDBSqlite : Sqlite PHP functions for using Sqlite driver are not available in this version of PHP. Try to use another driver.",LOG_ERR);
return $this->ok;
@ -79,8 +79,8 @@ class DoliDBSqlite extends DoliDB
/*if (! $host)
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=$langs->trans("ErrorWrongHostParameter");
dol_syslog(get_class($this)."::DoliDBSqlite : Erreur Connect, wrong host parameters",LOG_ERR);
return $this->ok;
@ -92,9 +92,9 @@ class DoliDBSqlite extends DoliDB
if ($this->db)
{
$this->connected = 1;
$this->ok = 1;
$this->database_selected = 1;
$this->connected = true;
$this->ok = true;
$this->database_selected = true;
$this->database_name = $name;
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@ -102,15 +102,15 @@ class DoliDBSqlite extends DoliDB
else
{
// host, login ou password incorrect
$this->connected = 0;
$this->ok = 0;
$this->database_selected = 0;
$this->connected = false;
$this->ok = false;
$this->database_selected = false;
$this->database_name = '';
//$this->error=sqlite_connect_error();
dol_syslog(get_class($this)."::DoliDBSqlite : Erreur Connect ".$this->error,LOG_ERR);
}
return $this->ok;
return (int) $this->ok;
}
@ -285,6 +285,7 @@ class DoliDBSqlite extends DoliDB
function select_db($database)
{
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
// FIXME: sqlite_select_db() does not exist
return sqlite_select_db($this->db,$database);
}
@ -297,12 +298,12 @@ class DoliDBSqlite extends DoliDB
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server
* @return resource Database access handler
* @return PDO Database access handler
* @see close
*/
function connect($host, $login, $passwd, $name, $port=0)
{
global $conf,$main_data_dir;
global $main_data_dir;
dol_syslog(get_class($this)."::connect name=".$name,LOG_DEBUG);
@ -352,7 +353,7 @@ class DoliDBSqlite extends DoliDB
/**
* Close database connexion
*
* @return boolean True if disconnect successfull, false otherwise
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
function close()
@ -360,7 +361,7 @@ class DoliDBSqlite extends DoliDB
if ($this->db)
{
if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR);
$this->connected=0;
$this->connected=false;
$this->db=null; // Clean this->db
return true;
}
@ -374,13 +375,11 @@ class DoliDBSqlite extends DoliDB
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
* @return PDOStatement Resultset of answer
*/
function query($query,$usesavepoint=0,$type='auto')
{
$errmsg='';
$ret='';
$ret=null;
$query = trim($query);
$this->error = 0;
@ -429,8 +428,8 @@ class DoliDBSqlite extends DoliDB
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param Resultset $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
* @param PDOStatement $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor
*/
function fetch_object($resultset)
{
@ -443,8 +442,8 @@ class DoliDBSqlite extends DoliDB
/**
* Return datas as an array
*
* @param Resultset $resultset Resultset of request
* @return array Array
* @param PDOStatement $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor
*/
function fetch_array($resultset)
{
@ -456,8 +455,8 @@ class DoliDBSqlite extends DoliDB
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
* @param PDOStatement $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor
*/
function fetch_row($resultset)
{
@ -477,7 +476,7 @@ class DoliDBSqlite extends DoliDB
/**
* Return number of lines for result of a SELECT
*
* @param Resultset $resultset Resulset of requests
* @param PDOStatement $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
*/
@ -491,7 +490,7 @@ class DoliDBSqlite extends DoliDB
/**
* Return number of lines for result of a SELECT
*
* @param Resultset $resultset Resulset of requests
* @param PDOStatement $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
*/
@ -508,10 +507,10 @@ class DoliDBSqlite extends DoliDB
/**
* Free last resultset used.
*
* @param integer $resultset Curseur de la requete voulue
* @param PDOStatement $resultset Curseur de la requete voulue
* @return void
*/
function free($resultset=0)
function free($resultset=null)
{
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
@ -709,7 +708,7 @@ class DoliDBSqlite extends DoliDB
* @param string $charset Charset used to store data
* @param string $collation Charset used to sort data
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
* @return PDOStatement resource defined if OK, null if KO
*/
function DDLCreateDb($database,$charset='',$collation='',$owner='')
{
@ -786,11 +785,13 @@ class DoliDBSqlite extends DoliDB
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="")
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null)
{
// FIXME: $fulltext_keys parameter is unused
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
$sql = "create table ".$table."(";
@ -820,7 +821,7 @@ class DoliDBSqlite extends DoliDB
if($primary_key != "")
$pk = "primary key(".$primary_key.")";
if($unique_keys != "")
if(is_array($unique_keys))
{
$i = 0;
foreach($unique_keys as $key => $value)
@ -829,7 +830,7 @@ class DoliDBSqlite extends DoliDB
$i++;
}
}
if($keys != "")
if(is_array($keys))
{
$i = 0;
foreach($keys as $key => $value)
@ -841,9 +842,9 @@ class DoliDBSqlite extends DoliDB
$sql .= implode(',',$sqlfields);
if($primary_key != "")
$sql .= ",".$pk;
if($unique_keys != "")
if(is_array($unique_keys))
$sql .= ",".implode(',',$sqluq);
if($keys != "")
if(is_array($keys))
$sql .= ",".implode(',',$sqlk);
$sql .=") type=".$type;

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,13 +22,13 @@
/**
* \file htdocs/core/db/sqlite.class.php
* \brief Class file to manage Dolibarr database access for a Sqlite database
* \brief Class file to manage Dolibarr database access for a SQLite database
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/**
* Class to manage Dolibarr database access for a Sqlite database
* Class to manage Dolibarr database access for a SQLite database
*/
class DoliDBSqlite3 extends DoliDB
{
@ -37,8 +38,8 @@ class DoliDBSqlite3 extends DoliDB
const LABEL='Sqlite3';
//! Version min database
const VERSIONMIN='3.0.0';
//! Resultset of last query
private $_results;
/** @var SQLite3Result Resultset of last query */
private $_results;
const WEEK_MONDAY_FIRST=1;
const WEEK_YEAR = 2;
@ -58,7 +59,7 @@ class DoliDBSqlite3 extends DoliDB
*/
function __construct($type, $host, $user, $pass, $name='', $port=0)
{
global $conf,$langs;
global $conf;
// Note that having "static" property for "$forcecharset" and "$forcecollate" will make error here in strict mode, so they are not static
if (! empty($conf->db->character_set)) $this->forcecharset=$conf->db->character_set;
@ -74,8 +75,8 @@ class DoliDBSqlite3 extends DoliDB
/*if (! function_exists("sqlite_query"))
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error="Sqlite PHP functions for using Sqlite driver are not available in this version of PHP. Try to use another driver.";
dol_syslog(get_class($this)."::DoliDBSqlite3 : Sqlite PHP functions for using Sqlite driver are not available in this version of PHP. Try to use another driver.",LOG_ERR);
return $this->ok;
@ -83,8 +84,8 @@ class DoliDBSqlite3 extends DoliDB
/*if (! $host)
{
$this->connected = 0;
$this->ok = 0;
$this->connected = false;
$this->ok = false;
$this->error=$langs->trans("ErrorWrongHostParameter");
dol_syslog(get_class($this)."::DoliDBSqlite3 : Erreur Connect, wrong host parameters",LOG_ERR);
return $this->ok;
@ -96,9 +97,9 @@ class DoliDBSqlite3 extends DoliDB
if ($this->db)
{
$this->connected = 1;
$this->ok = 1;
$this->database_selected = 1;
$this->connected = true;
$this->ok = true;
$this->database_selected = true;
$this->database_name = $name;
$this->addCustomFunction('IF');
@ -114,9 +115,9 @@ class DoliDBSqlite3 extends DoliDB
else
{
// host, login ou password incorrect
$this->connected = 0;
$this->ok = 0;
$this->database_selected = 0;
$this->connected = false;
$this->ok = false;
$this->database_selected = false;
$this->database_name = '';
//$this->error=sqlite_connect_error();
dol_syslog(get_class($this)."::DoliDBSqlite3 : Error Connect ".$this->error,LOG_ERR);
@ -304,6 +305,7 @@ class DoliDBSqlite3 extends DoliDB
function select_db($database)
{
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
// FIXME: sqlite_select_db() does not exist
return sqlite_select_db($this->db,$database);
}
@ -316,12 +318,12 @@ class DoliDBSqlite3 extends DoliDB
* @param string $passwd password
* @param string $name name of database (not used for mysql, used for pgsql)
* @param integer $port Port of database server
* @return resource Database access handler
* @return SQLite3 Database access handler
* @see close
*/
function connect($host, $login, $passwd, $name, $port=0)
{
global $conf,$main_data_dir;
global $main_data_dir;
dol_syslog(get_class($this)."::connect name=".$name,LOG_DEBUG);
@ -372,7 +374,7 @@ class DoliDBSqlite3 extends DoliDB
/**
* Close database connexion
*
* @return boolean True if disconnect successfull, false otherwise
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
function close()
@ -380,9 +382,9 @@ class DoliDBSqlite3 extends DoliDB
if ($this->db)
{
if ($this->transaction_opened > 0) dol_syslog(get_class($this)."::close Closing a connection with an opened transaction depth=".$this->transaction_opened,LOG_ERR);
$this->connected=0;
$this->connected=false;
$this->db->close();
$this->db=null; // Clean this->db
unset($this->db); // Clean this->db
return true;
}
return false;
@ -395,13 +397,11 @@ class DoliDBSqlite3 extends DoliDB
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
* @return SQLite3Result Resultset of answer
*/
function query($query,$usesavepoint=0,$type='auto')
{
$errmsg='';
$ret='';
$ret=null;
$query = trim($query);
$this->error = 0;
@ -492,8 +492,8 @@ class DoliDBSqlite3 extends DoliDB
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
*
* @param Resultset $resultset Curseur de la requete voulue
* @return Object Object result line or false if KO or end of cursor
* @param SQLite3Result $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor
*/
function fetch_object($resultset)
{
@ -504,14 +504,15 @@ class DoliDBSqlite3 extends DoliDB
if ($ret) {
return (object) $ret;
}
return false;
}
/**
* Return datas as an array
*
* @param Resultset $resultset Resultset of request
* @return array Array
* @param SQLite3Result $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor
*/
function fetch_array($resultset)
{
@ -519,16 +520,14 @@ class DoliDBSqlite3 extends DoliDB
if (! is_object($resultset)) { $resultset=$this->_results; }
//return $resultset->fetch(PDO::FETCH_ASSOC);
$ret = $resultset->fetchArray(SQLITE3_ASSOC);
if ($ret) {
return (array) $ret;
}
return $ret;
}
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array Array
* @param SQLite3Result $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor
*/
function fetch_row($resultset)
{
@ -541,19 +540,21 @@ class DoliDBSqlite3 extends DoliDB
else
{
// si le curseur est un booleen on retourne la valeur 0
return 0;
return false;
}
}
/**
* Return number of lines for result of a SELECT
*
* @param Resultset $resultset Resulset of requests
* @param SQLite3Result $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
*/
function num_rows($resultset)
{
// FIXME: SQLite3Result does not have a queryString member
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
if (preg_match("/^SELECT/i", $resultset->queryString)) {
@ -565,12 +566,14 @@ class DoliDBSqlite3 extends DoliDB
/**
* Return number of lines for result of a SELECT
*
* @param Resultset $resultset Resulset of requests
* @param SQLite3Result $resultset Resulset of requests
* @return int Nb of lines
* @see affected_rows
*/
function affected_rows($resultset)
{
// FIXME: SQLite3Result does not have a queryString member
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
if (preg_match("/^SELECT/i", $resultset->queryString)) {
@ -585,10 +588,10 @@ class DoliDBSqlite3 extends DoliDB
/**
* Free last resultset used.
*
* @param integer $resultset Curseur de la requete voulue
* @param SQLite3Result $resultset Curseur de la requete voulue
* @return void
*/
function free($resultset=0)
function free($resultset=null)
{
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
@ -789,7 +792,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $charset Charset used to store data
* @param string $collation Charset used to sort data
* @param string $owner Username of database owner
* @return resource resource defined if OK, null if KO
* @return SQLite3Result resource defined if OK, null if KO
*/
function DDLCreateDb($database,$charset='',$collation='',$owner='')
{
@ -866,11 +869,13 @@ class DoliDBSqlite3 extends DoliDB
* @param string $type Type de la table
* @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
* @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext
* @param string $keys Tableau des champs cles noms => valeur
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="")
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null)
{
// FIXME: $fulltext_keys parameter is unused
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
$sql = "create table ".$table."(";
@ -900,7 +905,7 @@ class DoliDBSqlite3 extends DoliDB
if($primary_key != "")
$pk = "primary key(".$primary_key.")";
if($unique_keys != "")
if(is_array($unique_keys))
{
$i = 0;
foreach($unique_keys as $key => $value)
@ -909,7 +914,7 @@ class DoliDBSqlite3 extends DoliDB
$i++;
}
}
if($keys != "")
if(is_array($keys))
{
$i = 0;
foreach($keys as $key => $value)
@ -921,16 +926,15 @@ class DoliDBSqlite3 extends DoliDB
$sql .= implode(',',$sqlfields);
if($primary_key != "")
$sql .= ",".$pk;
if($unique_keys != "")
if(is_array($unique_keys))
$sql .= ",".implode(',',$sqluq);
if($keys != "")
if(is_array($keys))
$sql .= ",".implode(',',$sqlk);
$sql .=") type=".$type;
dol_syslog($sql,LOG_DEBUG);
if(! $this -> query($sql))
return -1;
else
return -1;
return 1;
}
@ -939,7 +943,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @param string $table Name of table
* @param string $field Optionnel : Name of field if we want description of field
* @return resource Resource
* @return SQLite3Result Resource
*/
function DDLDescTable($table,$field="")
{
@ -990,10 +994,7 @@ class DoliDBSqlite3 extends DoliDB
{
return -1;
}
else
{
return 1;
}
return 1;
}
/**
@ -1014,8 +1015,7 @@ class DoliDBSqlite3 extends DoliDB
dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG);
if (! $this->query($sql))
return -1;
else
return -1;
return 1;
}
@ -1035,7 +1035,7 @@ class DoliDBSqlite3 extends DoliDB
$this->error=$this->lasterror();
return -1;
}
else return 1;
return 1;
}
@ -1082,7 +1082,6 @@ class DoliDBSqlite3 extends DoliDB
{
return -1;
}
return 1;
}
@ -1141,6 +1140,7 @@ class DoliDBSqlite3 extends DoliDB
*/
function getPathOfDump()
{
// FIXME: not for SQLite
$fullpathofdump='/pathtomysqldump/mysqldump';
$resql=$this->query('SHOW VARIABLES LIKE \'basedir\'');
@ -1160,6 +1160,7 @@ class DoliDBSqlite3 extends DoliDB
*/
function getPathOfRestore()
{
// FIXME: not for SQLite
$fullpathofimport='/pathtomysql/mysql';
$resql=$this->query('SHOW VARIABLES LIKE \'basedir\'');
@ -1425,10 +1426,10 @@ class DoliDBSqlite3 extends DoliDB
/**
* calc_daynr
*
* @param string $year Year
* @param string $month Month
* @param string $day Day
* @return string La date formatee.
* @param int $year Year
* @param int $month Month
* @param int $day Day
* @return int Formatted date
*/
private static function calc_daynr($year, $month, $day) {
$y = $year;
@ -1446,8 +1447,9 @@ class DoliDBSqlite3 extends DoliDB
/**
* calc_weekday
*
* @param string $daynr ???
* @param string $sunday_first_day_of_week ???
* @param int $daynr ???
* @param bool $sunday_first_day_of_week ???
* @return int
*/
private static function calc_weekday($daynr, $sunday_first_day_of_week) {
$ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7);

View File

@ -106,7 +106,7 @@ window.onload = function()
<tr>
<td><?php echo img_picto_common('','treemenu/folder.gif','width="16" height="16"'); ?></td>
<td>&nbsp;</td>
<td id="tdName" width="100%" nowrap class="ActualFolder">/</td>
<td id="tdName" width="100%" class="ActualFolder nowrap">/</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>

View File

@ -220,7 +220,7 @@ window.onload = function()
<table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr id="trUp" style="DISPLAY: none">
<td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td>
<td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>
<td class="nowrap" width="100%">&nbsp;<a id="linkUp" href="#">..</a></td>
</tr>
</table>
</body>

View File

@ -77,7 +77,7 @@ oListManager.GetFolderRowHtml = function( folderName, folderPath )
'<td width="16">' +
sLink +
'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
'<\/td><td nowrap colspan="2">&nbsp;' +
'<\/td><td class="nowrap" colspan="2">&nbsp;' +
sLink +
folderName +
'<\/a>' +
@ -100,7 +100,7 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
sLink +
fileName +
'<\/a>' +
'<\/td><td align="right" nowrap>&nbsp;' +
'<\/td><td align="right" class="nowrap">&nbsp;' +
fileSize +
' KB' +
'<\/td><\/tr>' ;

View File

@ -132,7 +132,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
// Disable an element
if (options.option_disabled) {
if (ui.item.disabled) {
$("#" + options.option_disabled).attr("disabled", "disabled");
$("#" + options.option_disabled).prop("disabled", true);
if (options.error) {
$.jnotify(options.error, "error", true); // Output with jnotify the error message
}
@ -145,7 +145,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
}
if (options.disabled) {
$.each(options.disabled, function(key, value) {
$("#" + value).attr("disabled", "disabled");
$("#" + value).prop("disabled", true);
});
}
if (options.show) {
@ -524,7 +524,7 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=a
// Disable another element
if (input.disabled && input.disabled.length > 0) {
$.each(input.disabled, function(key,value) {
$("#" + value).attr("disabled", true);
$("#" + value).prop("disabled", true);
if ($("#" + value).hasClass("butAction") == true) {
$("#" + value).removeClass("butAction");
$("#" + value).addClass("butActionRefused");

View File

@ -2804,7 +2804,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
print "\n";
print "<!-- Begin title '".$titre."' -->\n";
print '<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
print '<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 6px;"><tr>';
// Left
if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, '', $pictoisfullpath).'</td>';
@ -2824,43 +2824,44 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
$pagelist = '';
if ($page > 0 || $num > $conf->liste_limit)
{
if ($totalnboflines)
if ($totalnboflines) // If we know total nb of lines
{
$maxnbofpage=10;
$nbpages=ceil($totalnboflines/$conf->liste_limit);
$cpt=($page-$maxnbofpage);
if ($cpt < 0) { $cpt=0; }
$pagelist.=$langs->trans('Page');
if ($cpt>=1)
{
$pagelist.=' <a href="'.$file.'?page=0'.$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">1</a>';
if ($cpt >= 2) $pagelist.=' ...';
$pagelist.= '<li><a href="'.$file.'?page=0'.$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">1</a></li>'."\n";
if ($cpt >= 2) $pagelist.='<li><span>...</span></li>';
}
do
{
if ($cpt==$page)
{
$pagelist.= ' <u>'.($page+1).'</u>';
$pagelist.= '<li><span class="active">'.($page+1).'</span></li>'."\n";
}
else
{
$pagelist.= ' <a href="'.$file.'?page='.$cpt.$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">'.($cpt+1).'</a>';
$pagelist.= '<li><a href="'.$file.'?page='.$cpt.$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">'.($cpt+1).'</a></li>'."\n";
}
$cpt++;
}
while ($cpt < $nbpages && $cpt<=$page+$maxnbofpage);
if ($cpt<$nbpages)
{
if ($cpt<$nbpages-1) $pagelist.= ' ...';
$pagelist.= ' <a href="'.$file.'?page='.($nbpages-1).$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">'.$nbpages.'</a>';
if ($cpt<$nbpages-1) $pagelist.= '<li><span>...</span></li>';
$pagelist.= '<li><a href="'.$file.'?page='.($nbpages-1).$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">'.$nbpages.'</a></li>'."\n";
}
}
else
{
$pagelist.= $langs->trans('Page').' '.($page+1);
$pagelist.= '<li><span class="active">'.($page+1)."</li>\n";
}
}
print "\n";
print_fleche_navigation($page,$file,$options,$nextpage,$pagelist);
if ($morehtml) print $morehtml;
print '</td>';
@ -2870,12 +2871,12 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
}
/**
* Fonction servant a afficher les fleches de navigation dans les pages de listes
* Function to show navigation arrows into lists
*
* @param int $page Number of page
* @param string $file Lien
* @param string $options Autres parametres d'url a propager dans les liens ("" par defaut)
* @param integer $nextpage Do we show a next page button
* @param string $file Page
* @param string $options Other url paramaters to propagate ("" by default)
* @param integer $nextpage Do we show a next page button
* @param string $betweenarrows HTML Content to show between arrows
* @return void
*/
@ -2883,17 +2884,20 @@ function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarr
{
global $conf, $langs;
print '<div class="pagination"><ul>';
if ($page > 0)
{
if (empty($conf->dol_use_jmobile)) print '<a href="'.$file.'?page='.($page-1).$options.'">'.img_previous($langs->trans("Previous")).'</a>';
else print '<a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$file.'?page='.($page-1).$options.'">'.$langs->trans("Previous").'</a>';
if (empty($conf->dol_use_jmobile)) print '<li><a class="paginationprevious" href="'.$file.'?page='.($page-1).$options.'"><</a></li>'."\n";
else print '<li><a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$file.'?page='.($page-1).$options.'">'.$langs->trans("Previous").'</a></li>'."\n";
}
if ($betweenarrows) print ($page > 0?' ':'').$betweenarrows.($nextpage>0?' ':'');
//if ($betweenarrows) print ($page > 0?' ':'').$betweenarrows.($nextpage>0?' ':'');
print $betweenarrows;
if ($nextpage > 0)
{
if (empty($conf->dol_use_jmobile)) print '<a href="'.$file.'?page='.($page+1).$options.'">'.img_next($langs->trans("Next")).'</a>';
else print '<a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$file.'?page='.($page+1).$options.'">'.$langs->trans("Next").'</a>';
if (empty($conf->dol_use_jmobile)) print '<li><a class="paginationnext" href="'.$file.'?page='.($page+1).$options.'">></a></li>'."\n";
else print '<li><a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$file.'?page='.($page+1).$options.'">'.$langs->trans("Next").'</a></li>'."\n";
}
print '</ul></div>'."\n";
}

View File

@ -41,6 +41,8 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
{
global $langs, $hselected;
if (empty($hselected)) $hselected='report';
print "\n\n<!-- debut cartouche rapport -->\n";
$h=0;

View File

@ -33,7 +33,7 @@ function salaries_prepare_head($object) {
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'salaries';
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
@ -42,11 +42,13 @@ function salaries_prepare_head($object) {
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries');
/*
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
*/
complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries', 'remove');
return $head;

View File

@ -102,21 +102,21 @@ function dol_hash($chain,$type=0)
* @param User $user User to check
* @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @param Canvas $objcanvas Object canvas
* @return int Always 1, die process if not allowed
*/
function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
function restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
{
global $db, $conf;
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename,$feature2,$dbt_socfield,$dbt_select");
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
//print ", perm: ".$features."->".$feature2."=".$user->rights->$features->$feature2->lire."<br>";
//print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."<br>";
// If we use canvas, we try to use function that overlod restrictarea if provided with canvas
if (is_object($objcanvas))
@ -135,7 +135,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
if (! empty($feature2)) $feature2 = explode("|", $feature2);
// More parameters
$params = explode('&', $dbtablename);
$params = explode('&', $tableandshare);
$dbtablename=(! empty($params[0]) ? $params[0] : '');
$sharedelement=(! empty($params[1]) ? $params[1] : $dbtablename);
@ -331,7 +331,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
// is linked to a company allowed to $user.
if (! empty($objectid) && $objectid > 0)
{
$ok = checkUserAccessToObject($user, $featuresarray,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
$ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select);
return $ok ? 1 : accessforbidden();
}
@ -344,19 +344,19 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
* @param User $user User to check
* @param array $featuresarray Features/modules to check
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
* @param string $dbtablename 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
*
* @return bool True if user has access, False otherwise
*/
function checkUserAccessToObject($user, $featuresarray, $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='', $dbt_select='')
function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='')
{
global $db, $conf;
// More parameters
$params = explode('&', $dbtablename);
$params = explode('&', $tableandshare);
$dbtablename=(! empty($params[0]) ? $params[0] : '');
$sharedelement=(! empty($params[1]) ? $params[1] : $dbtablename);

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -23,16 +24,16 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/expensereport/modules_expensereport.php';
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
* Classe permettant de generer les factures au modele Crabe
* Class to generate expense report based on standard model
*/
class pdf_standard extends ModeleExpenseReport
{
@ -252,7 +253,7 @@ class pdf_standard extends ModeleExpenseReport
$tab_height = 110;
$tab_height_newpage = 110;
// Affiche notes
// Show notes
$notetoshow=empty($object->note_public)?'':$object->note_public;
if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
{
@ -308,7 +309,7 @@ class pdf_standard extends ModeleExpenseReport
$showpricebeforepagebreak=1;
// Piece comptable
// Accountancy piece
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-1, 3, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
@ -334,17 +335,18 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetXY($this->posxtype, $curY);
$pdf->MultiCell($this->posxprojet-$this->posxtype-1, 3,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C');
// Projet
// Project
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxprojet, $curY);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C');
// VAT Rate
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,vatrate($object->lines[$i]->tva_taux,true), 0, 'R');
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R');
// UP
// Unit price
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3,price($object->lines[$i]->value_unit), 0, 'R');
@ -354,7 +356,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->postotalttc-$this->posxqty, 3,$object->lines[$i]->qty, 0, 'C');
// TotalTTC
// Total with all taxes
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->postotalttc-2, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R');
@ -439,6 +441,13 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_ht), 1, 'R');
$pdf->SetFillColor(248,248,248);
$posy+=5;
$pdf->SetXY(100, $posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L');
$pdf->SetXY(160, $posy);
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_tva),1, 'R');
$posy+=5;
$pdf->SetXY(100, $posy);
$pdf->SetFont('','B', 10);
@ -507,7 +516,7 @@ class pdf_standard extends ModeleExpenseReport
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
*/
// Filligrane brouillon
// Draft watermark
if ($object->fk_statut==1 && ! empty($conf->global->EXPENSEREPORT_FREE_TEXT))
{
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->EXPENSEREPORT_FREE_TEXT);
@ -551,25 +560,25 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetFont('','', $default_font_size -1);
// Réf complète
// Ref complete
$posy+=8;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("Ref")." : " . $object->ref, '', 'L');
// Date début période
// Date start period
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateStart")." : " . ($object->date_debut>0?dol_print_date($object->date_debut,"day",false,$outpulangs):''), '', 'L');
// Date fin période
// Date end period
$posy+=5;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $outputlangs->transnoentities("DateEnd")." : " . ($object->date_fin>0?dol_print_date($object->date_fin,"day",false,$outpulangs):''), '', 'L');
// Statut NDF
// Status Expense Report
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->SetFont('','B',18);
@ -581,7 +590,7 @@ class pdf_standard extends ModeleExpenseReport
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
$carac_emetteur .= "\n";
// Tel
// Phone
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
// Fax
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax")." : ".$outputlangs->convToOutputCharset($this->emetteur->fax);
@ -734,46 +743,46 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetFont('','',8);
//Piece comptable
// Accountancy piece
$pdf->SetXY($this->posxpiece-1, $tab_top+1);
$pdf->MultiCell($this->posxdesc-$this->posxpiece-1,1,'','','R');
//Comments
// Comments
$pdf->line($this->posxdesc-1, $tab_top, $this->posxdesc-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell($this->posxdate-$this->posxdesc-1,1,$outputlangs->transnoentities("Description"),'','L');
//Date
// Date
$pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxdate-1, $tab_top+1);
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
//Type
// Type
$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtype-1, $tab_top+1);
$pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C');
// Projet
// Project
$pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxprojet-1, $tab_top+1);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
//TVA
// VAT
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtva-1, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
//PU
// Unit price
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("UP"),'','C');
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');
//QTY
// Quantity
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R');
//TOTALTTC
// Total with all taxes
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
$pdf->SetXY($this->postotalttc-1, $tab_top+1);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R');

View File

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -65,8 +65,21 @@ class ExportExcel extends ModeleExports
$this->version='1.30'; // Driver version
// If driver use an external library, put its name here
$this->label_lib='PhpExcel';
$this->version_lib='1.7.8';
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php';
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php';
require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
$this->label_lib='PhpWriteExcel';
$this->version_lib='unknown';
}
else
{
require_once PHPEXCEL_PATH.'PHPExcel.php';
require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
$this->label_lib='PhpExcel';
$this->version_lib='1.8.0'; // No way to get info from library
}
$this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages)

View File

@ -64,10 +64,23 @@ class ExportExcel2007 extends ExportExcel
$this->picto='mime/xls'; // Picto
$this->version='1.30'; // Driver version
// If driver use an external library, put its name here
$this->label_lib='PhpExcel';
$this->version_lib='1.7.8';
// If driver use an external library, put its name here
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php';
require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php';
require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php';
$this->label_lib='PhpWriteExcel';
$this->version_lib='unknown';
}
else
{
require_once PHPEXCEL_PATH.'PHPExcel.php';
require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
$this->label_lib='PhpExcel';
$this->version_lib='1.8.0'; // No way to get info from library
}
$this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages)
$this->row=0;

0
htdocs/core/modules/modExpenseReport.class.php Executable file → Normal file
View File

View File

@ -133,6 +133,19 @@ class modSalaries extends DolibarrModules
//--------
$r=0;
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Salaries and payments';
$this->export_permission[$r]=array(array("salary","export"));
$this->export_fields_array[$r]=array('u.firstname'=>"Firstname",'u.lastname'=>"Lastname",'u.login'=>"Login",'u.salary'=>'CurrentSalary','p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.datesp'=>'DateStartPeriod','p.dateep'=>'DateEndPeriod','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero','p.label'=>'Label','p.note'=>'Note');
$this->export_TypeFields_array[$r]=array('u.firstname'=>"Text",'u.lastname'=>"Text",'u.login'=>'Text','u.salary'=>"Number",'p.datep'=>'Date','p.datesp'=>'Date','p.dateep'=>'Date','p.amount'=>'Number','p.num_paiement'=>'Number','p.label'=>'Text');
$this->export_entities_array[$r]=array('u.firstname'=>'user','u.lastname'=>'user','u.login'=>'user','u.salary'=>'user','p.datep'=>'payment','p.datesp'=>'payment','p.dateep'=>'payment','p.amount'=>'payment','p.label'=>'payment','p.note'=>'payment','p.num_paiement'=>'payment');
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementsalary as p ON p.fk_user = u.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepaiement = cp.rowid';
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user',1).')';
}

View File

@ -42,27 +42,27 @@
if (GETPOST('type') == "separate")
{
print "jQuery('#size, #unique, #required, #default_value').val('').attr('disabled','disabled');";
print "jQuery('#size, #unique, #required, #default_value').val('').prop('disabled', true);";
print 'jQuery("#value_choice").hide();';
}
?>
if (type == 'date') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'datetime') { size.val('').attr('disabled','disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
if (type == 'date') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'datetime') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'double') { size.val('24,8').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'int') { size.val('10').removeAttr('disabled'); unique.removeAttr('disabled'); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();}
else if (type == 'text') { size.val('2000').removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'varchar') { size.val('255').removeAttr('disabled'); unique.removeAttr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide(); }
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'select') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'link') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
else if (type == 'sellist') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'radio') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'checkbox') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'chkbxlst') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
else if (type == 'separate') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled'); required.val('').attr('disabled','disabled'); default_value.val('').attr('disabled','disabled'); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else size.val('').attr('disabled','disabled');
else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();}
else if (type == 'select') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'link') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();}
else if (type == 'sellist') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").show();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'radio') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();}
else if (type == 'separate') { size.val('').prop('disabled', true); unique.prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();}
else size.val('').prop('disabled', true);
}
init_typeoffields('<?php echo GETPOST('type'); ?>');
jQuery("#type").change(function() {

View File

@ -25,15 +25,15 @@
var size = jQuery("#size");
var unique = jQuery("#unique");
var required = jQuery("#required");
if (type == 'date') { size.attr('disabled','disabled'); }
else if (type == 'datetime') { size.attr('disabled','disabled'); }
if (type == 'date') { size.prop('disabled', true); }
else if (type == 'datetime') { size.prop('disabled', true); }
else if (type == 'double') { size.removeAttr('disabled'); }
else if (type == 'int') { size.removeAttr('disabled'); }
else if (type == 'text') { size.removeAttr('disabled'); unique.attr('disabled','disabled').removeAttr('checked'); }
else if (type == 'text') { size.removeAttr('disabled'); unique.prop('disabled', true).removeAttr('checked'); }
else if (type == 'varchar') { size.removeAttr('disabled'); }
else if (type == 'boolean') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');}
else if (type == 'price') { size.val('').attr('disabled','disabled'); unique.attr('disabled','disabled');}
else size.val('').attr('disabled','disabled');
else if (type == 'boolean') { size.val('').prop('disabled', true); unique.prop('disabled', true);}
else if (type == 'price') { size.val('').prop('disabled', true); unique.prop('disabled', true);}
else size.val('').prop('disabled', true);
}
init_typeoffields(jQuery("#type").val());
});

View File

@ -583,8 +583,8 @@ function setforfree() {
jQuery("#idprod").val('');
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
jQuery("#search_idprodfournprice").val('');
jQuery("#prod_entry_mode_free").attr('checked',true);
jQuery("#prod_entry_mode_predef").attr('checked',false);
jQuery("#prod_entry_mode_free").prop('checked',true);
jQuery("#prod_entry_mode_predef").prop('checked',false);
jQuery("#price_ht").show();
jQuery("#price_ttc").show(); // May no exists
jQuery("#tva_tx").show();
@ -601,8 +601,8 @@ function setforfree() {
}
function setforpredef() {
jQuery("#select_type").val(-1);
jQuery("#prod_entry_mode_free").attr('checked',false);
jQuery("#prod_entry_mode_predef").attr('checked',true);
jQuery("#prod_entry_mode_free").prop('checked',false);
jQuery("#prod_entry_mode_predef").prop('checked',true);
jQuery("#price_ht").hide();
jQuery("#title_up_ht").hide();
jQuery("#price_ttc").hide(); // May no exists

View File

@ -99,7 +99,7 @@ $coldisplay=-1; // We remove first td
$doleditor=new DolEditor('product_desc',$line->description,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%');
$doleditor->Create();
} else {
print '<textarea id="desc" class="flat" name="desc" readonly="readonly" style="width: 200px; height:80px;">' . $line->description . '</textarea>';
print '<textarea id="desc" class="flat" name="desc" readonly style="width: 200px; height:80px;">' . $line->description . '</textarea>';
}
?>
</td>
@ -113,19 +113,19 @@ $coldisplay=-1; // We remove first td
if ($this->situation_counter == 1 || !$this->situation_cycle_ref) {
print '<td align="right">' . $form->load_tva('tva_tx',$line->tva_tx,$seller,$buyer,0,$line->info_bits,$line->product_type) . '</td>';
} else {
print '<td align="right"><input size="1" type="text" class="flat" name="tva_tx" value="' . price($line->tva_tx) . '" readonly="readonly" />%</td>';
print '<td align="right"><input size="1" type="text" class="flat" name="tva_tx" value="' . price($line->tva_tx) . '" readonly />%</td>';
}
$coldisplay++;
print '<td align="right"><input type="text" class="flat" size="8" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"';
if ($this->situation_counter > 1) print ' readonly="readonly"';
if ($this->situation_counter > 1) print ' readonly';
print '></td>';
if ($inputalsopricewithtax)
{
$coldisplay++;
print '<td align="right"><input type="text" class="flat" size="8" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"';
if ($this->situation_counter > 1) print ' readonly="readonly"';
if ($this->situation_counter > 1) print ' readonly';
print '></td>';
}
?>
@ -136,7 +136,7 @@ $coldisplay=-1; // We remove first td
// must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
print '<input size="3" type="text" class="flat" name="qty" id="qty" value="' . $line->qty . '"';
if ($this->situation_counter > 1) print ' readonly="readonly"';
if ($this->situation_counter > 1) print ' readonly';
print '>';
} else { ?>
&nbsp;
@ -152,10 +152,10 @@ $coldisplay=-1; // We remove first td
}
?>
<td align="right" nowrap><?php $coldisplay++; ?>
<td align="right" class="nowrap"><?php $coldisplay++; ?>
<?php if (($line->info_bits & 2) != 2) {
print '<input size="1" type="text" class="flat" name="remise_percent" id="remise_percent" value="' . $line->remise_percent . '"';
if ($this->situation_counter > 1) print ' readonly="readonly"';
if ($this->situation_counter > 1) print ' readonly';
print '>%';
} else { ?>
&nbsp;
@ -164,7 +164,7 @@ $coldisplay=-1; // We remove first td
<?php
if ($this->situation_cycle_ref) {
$coldisplay++;
print '<td align="right" nowrap><input type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>';
print '<td align="right" class="nowrap"><input type="text" size="1" value="' . $line->situation_percent . '" name="progress">%</td>';
}
if (! empty($usemargins))
{

View File

@ -148,7 +148,7 @@ if (empty($usemargins)) $usemargins=0;
<?php
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td align="left" nowrap="nowrap">';
print '<td align="left" class="nowrap">';
$label = $line->getLabelOfUnit('short');
if ($label !== '') {
print $langs->trans($label);
@ -169,7 +169,7 @@ if (empty($usemargins)) $usemargins=0;
if ($this->situation_cycle_ref) {
$coldisplay++;
print '<td align="right" nowrap="nowrap">' . $line->situation_percent . '%</td>';
print '<td align="right" class="nowrap">' . $line->situation_percent . '%</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
@ -64,6 +64,7 @@ $hookmanager->initHooks(array('doncard','globalcard'));
/*
* Actions
*/
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -227,6 +228,7 @@ if ($action == 'set_paid')
/*
* Build doc
*/
if ($action == 'builddoc')
{
$object = new Don($db);
@ -265,21 +267,17 @@ $formfile = new FormFile($db);
$formcompany = new FormCompany($db);
/* ************************************************************************** */
/* */
/* Donation card in create mode */
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print_fiche_titre($langs->trans("AddDonation"));
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
print '<input type="hidden" name="action" value="add">';
dol_fiche_head('');
print '<table class="border" width="100%">';
$nbrows=11;
if (! empty($conf->projet->enabled)) $nbrows++;
@ -343,7 +341,7 @@ if ($action == 'create')
$formproject=new FormProjets($db);
print "<tr><td>".$langs->trans("Project")."</td><td>";
$formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 1, 0, 1);
$formproject->select_projects(-1, GETPOST("fk_projet"),'fk_projet', 0, 0, 1, 1);
print "</td></tr>\n";
}
@ -356,7 +354,11 @@ if ($action == 'create')
}
print "</table>\n";
print '<br><div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
print "</form>\n";
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -98,7 +98,7 @@ foreach ($listofstatus as $status)
if ($conf->use_javascript_ajax)
{
print '<tr><td align="center" colspan="4">';
print '<tr '.$bc[false].'><td align="center" colspan="4">';
$data=array('series'=>$dataseries);
dol_print_graph('stats',300,180,$data,1,'pie',1);
print '</td></tr>';

View File

@ -93,7 +93,7 @@ if ($resql)
{
$var=!$var;
$obj = $db->fetch_object($resql);
print "<tr ".$bc[$var]."><td nowrap=\"nowrap\">";
print "<tr ".$bc[$var].'><td class="nowrap">';
$shipment->id=$obj->rowid;
$shipment->ref=$obj->ref;
print $shipment->getNomUrl(1);

View File

@ -546,7 +546,7 @@ if ($id > 0 || ! empty($ref))
}
print "</tr>\n";
// Show subproducts details
// Show subproducts lines
if ($objp->fk_product > 0 && ! empty($conf->global->PRODUIT_SOUSPRODUITS))
{
// Set tree of subproducts in product->sousprods
@ -560,20 +560,16 @@ if ($id > 0 || ! empty($ref))
{
foreach($prods_arbo as $key => $value)
{
print '<tr><td colspan="4">';
$img='';
if ($value['stock'] < $value['stock_alert'])
{
$img=img_warning($langs->trans("StockTooLow"));
}
print '<tr><td>&nbsp; &nbsp; &nbsp; -> <a href="'.DOL_URL_ROOT."/product/card.php?id=".$value['id'].'">'.$value['fullpath'].'</a> ('.$value['nb'].')</td>';
print '<tr '.$bc[$var].'><td>&nbsp; &nbsp; &nbsp; -> <a href="'.DOL_URL_ROOT."/product/card.php?id=".$value['id'].'">'.$value['fullpath'].'</a> ('.$value['nb'].')</td>';
print '<td align="center"> '.$value['nb_total'].'</td>';
print '<td>&nbsp</td>';
print '<td>&nbsp</td>';
print '<td align="center">'.$value['stock'].' '.$img.'</td></tr>'."\n";
print '</td></tr>'."\n";
}
}
}

0
htdocs/expensereport/ajax/ajaxprojet.php Executable file → Normal file
View File

73
htdocs/expensereport/card.php Executable file → Normal file
View File

@ -828,9 +828,8 @@ if ($action == "addline")
$object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees');
$vatrate=GETPOST('vatrate');
$object_ligne->fk_c_tva = $vatrate;
$object_ligne->vatrate = $vatrate;
$object_ligne->fk_c_tva = GETPOST('fk_c_tva');
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
$object_ligne->fk_projet = $fk_projet;
@ -878,8 +877,8 @@ if ($action == "addline")
$type = 0; // TODO What if service
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type);
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
$object_ligne->total_ttc = $tmp[2];
$object_ligne->tva_taux = GETPOST('vatrate');
$object_ligne->total_ht = $tmp[0];
$object_ligne->total_tva = $tmp[1];
@ -906,11 +905,11 @@ if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes")
$object->fetch($id);
$object_ligne = new ExpenseReportLine($db);
$object_ligne->fetch($_GET["rowid"]);
$object_ligne->fetch(GETPOST("rowid"));
$total_ht = $object_ligne->total_ht;
$total_tva = $object_ligne->total_tva;
$result=$object->deleteline($_GET["rowid"]);
$result=$object->deleteline(GETPOST("rowid"));
if ($result >= 0)
{
if ($result > 0)
@ -950,12 +949,13 @@ if ($action == "updateligne" )
$rowid = $_POST['rowid'];
$type_fees_id = GETPOST('fk_c_type_fees');
$c_tva=GETPOST('vatrate');
$object_ligne->fk_c_tva = $c_tva;
$object_ligne->fk_c_tva = GETPOST('fk_c_tva');
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
$projet_id = $fk_projet;
$comments = GETPOST('comments');
$qty = GETPOST('qty');
$value_unit = GETPOST('value_unit');
$vatrate = GETPOST('vatrate');
if (! GETPOST('fk_c_type_fees') > 0)
{
@ -972,7 +972,7 @@ if ($action == "updateligne" )
if (! $error)
{
$result = $object->updateline($rowid, $type_fees_id, $projet_id, $c_tva, $comments, $qty, $value_unit, $date, $object_id);
$result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id);
if ($result >= 0)
{
if ($result > 0)
@ -995,8 +995,9 @@ if ($action == "updateligne" )
}
}
$object->recalculer($object_id);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object_id);
$result = $object->recalculer($id);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@ -1008,9 +1009,9 @@ if ($action == "updateligne" )
/*
* Generer ou regenerer le document PDF
* Generate or regenerate the PDF document
*/
if ($action == 'builddoc') // En get ou en post
if ($action == 'builddoc') // GET or POST
{
$depl = new ExpenseReport($db, 0, $_GET['id']);
$depl->fetch($id);
@ -1370,7 +1371,7 @@ else
if ($action == 'delete_line')
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&amp;rowid=".$_GET['rowid'],$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid'),$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1);
if ($ret == 'html') print '<br>';
}
@ -1528,7 +1529,7 @@ else
// Fetch Lines of current expense report
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
$sql.= ' fde.fk_c_tva as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
$sql.= ' fde.fk_c_tva as fk_c_tva, fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
@ -1636,10 +1637,10 @@ else
// Select project
print '<td>';
$formproject->select_projects(-1, $objp->fk_projet,'fk_projet', 0, 0, 0, 1);
$formproject->select_projects(-1, $objp->fk_projet,'fk_projet', 0, 0, 1, 1);
print '</td>';
// Sélect type
// Select type
print '<td style="text-align:center;">';
select_type_fees_id($objp->type_fees_code,'fk_c_type_fees');
print '</td>';
@ -1649,17 +1650,17 @@ else
print '<textarea class="flat_ndf" name="comments" class="centpercent">'.$objp->comments.'</textarea>';
print '</td>';
// Sélection TVA
// VAT
print '<td style="text-align:right;">';
print $form->load_tva('fk_c_tva', (isset($_POST["fk_c_tva"])?$_POST["fk_c_tva"]:$objp->tva_taux), $mysoc, '');
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$objp->vatrate), $mysoc, '');
print '</td>';
// Prix unitaire
// Unit price
print '<td style="text-align:right;">';
print '<input type="text" size="6" name="value_unit" value="'.$objp->value_unit.'" />';
print '</td>';
// Quantité
// Quantity
print '<td style="text-align:right;">';
print '<input type="text" size="4" name="qty" value="'.$objp->qty.'" />';
print '</td>';
@ -1712,7 +1713,7 @@ else
print '<td style="text-align:center;"></td>';
print '</tr>';
print '<tr>';
print '<tr '.$bc[true].'>';
// Select date
print '<td style="text-align:center;">';
@ -1744,7 +1745,7 @@ else
print '</select>';
print '</td>';
// Prix unitaire
// Unit price
print '<td style="text-align:right;">';
print '<input type="text" size="6" name="value_unit" value="'.GETPOST('value_unit').'">';
print '</td>';
@ -1805,7 +1806,7 @@ if ($action != 'create' && $action != 'edit')
{
if ($object->fk_user_author == $user->id)
{
// Modifier
// Modify
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
// Validate
@ -1816,7 +1817,7 @@ if ($action != 'create' && $action != 'edit')
if ($user->rights->expensereport->supprimer)
{
// Supprimer
// Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
}
}
@ -1831,7 +1832,7 @@ if ($action != 'create' && $action != 'edit')
{
if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid)
{
// Modifier
// Modify
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
// Brouillonner (le statut refusée est identique à brouillon)
@ -1841,7 +1842,7 @@ if ($action != 'create' && $action != 'edit')
if ($user->rights->expensereport->supprimer)
{
// Supprimer
// Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
}
}
@ -1874,9 +1875,9 @@ if ($action != 'create' && $action != 'edit')
{
//if($object->fk_user_validator==$user->id)
//{
// Valider
// Validate
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Approve').'</a>';
// Refuser
// Deny
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=refuse&id='.$id.'">'.$langs->trans('Deny').'</a>';
//}
@ -1888,7 +1889,7 @@ if ($action != 'create' && $action != 'edit')
if($user->rights->expensereport->supprimer)
{
// Supprimer
// Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
}
}
@ -1899,7 +1900,7 @@ if ($action != 'create' && $action != 'edit')
*/
if ($user->rights->expensereport->to_paid && $object->fk_statut == 5)
{
// Payer
// Pay
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=paid&id='.$id.'">'.$langs->trans('TO_PAID').'</a>';
// Cancel
@ -1910,7 +1911,7 @@ if ($action != 'create' && $action != 'edit')
if($user->rights->expensereport->supprimer)
{
// Supprimer
// Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
}
}
@ -1922,11 +1923,11 @@ if ($action != 'create' && $action != 'edit')
*/
if ($user->rights->expensereport->approve && $user->rights->expensereport->to_paid && $object->fk_statut==6)
{
// Annuler
// Cancel
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=cancel&id='.$id.'">'.$langs->trans('Cancel').'</a>';
if($user->rights->expensereport->supprimer)
{
// Supprimer
// Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
}
}
@ -1944,7 +1945,7 @@ if ($action != 'create' && $action != 'edit')
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=brouillonner&id='.$id.'">'.$langs->trans('ReOpen').'</a>';
}
// Supprimer
// Delete
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
}
@ -1959,7 +1960,7 @@ print '</div>';
print '<div style="width:50%">';
/*
* Documents generes
* Generate documents
*/
if($user->rights->expensereport->export && $object->fk_statut>0 && $action != 'edit')
{

138
htdocs/expensereport/class/expensereport.class.php Executable file → Normal file
View File

@ -282,7 +282,7 @@ class ExpenseReport extends CommonObject
*/
function fetch($id, $ref='')
{
global $conf,$db;
global $conf;
$sql = "SELECT d.rowid, d.ref, d.note_public, d.note_private,"; // DEFAULT
$sql.= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS
@ -298,10 +298,10 @@ class ExpenseReport extends CommonObject
$sql.= $restrict;
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
$result = $db->query($sql) ;
if ($result)
$resql = $this->db->query($sql) ;
if ($resql)
{
$obj = $db->fetch_object($result);
$obj = $this->db->fetch_object($resql);
if ($obj)
{
$this->id = $obj->rowid;
@ -367,7 +367,7 @@ class ExpenseReport extends CommonObject
$result=$this->fetch_lines();
return 1;
return $result;
}
else
{
@ -376,7 +376,7 @@ class ExpenseReport extends CommonObject
}
else
{
$this->error=$db->lasterror();
$this->error=$this->db->lasterror();
return -1;
}
}
@ -539,8 +539,7 @@ class ExpenseReport extends CommonObject
$line->total_tva=20;
$line->total_ttc=120;
$line->qty=1;
$line->fk_c_tva=20;
$line->tva_taux=20;
$line->vatrate=20;
$line->value_unit=120;
$line->fk_expensereport=0;
$line->type_fees_code='TRA';
@ -664,6 +663,7 @@ class ExpenseReport extends CommonObject
/**
* recalculer
* TODO Replace this with call to update_price if not already done
*
* @param int $id Id of expense report
* @return int <0 if KO, >0 if OK
@ -724,7 +724,7 @@ class ExpenseReport extends CommonObject
$this->lines=array();
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,';
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva,';
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva, de.tva_tx as vatrate,';
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
$sql.= ' p.ref as ref_projet, p.title as title_projet';
@ -734,14 +734,15 @@ class ExpenseReport extends CommonObject
$sql.= ' WHERE de.'.$this->fk_element.' = '.$this->id;
dol_syslog('ExpenseReport::fetch_lines sql='.$sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($result);
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$objp = $this->db->fetch_object($resql);
$deplig = new ExpenseReportLine($this->db);
$deplig->rowid = $objp->rowid;
@ -761,7 +762,7 @@ class ExpenseReport extends CommonObject
$deplig->type_fees_code = $objp->code_type_fees;
$deplig->type_fees_libelle = $objp->libelle_type_fees;
$deplig->tva_taux = $objp->taux_tva;
$deplig->vatrate = $objp->vatrate;
$deplig->projet_ref = $objp->ref_projet;
$deplig->projet_title = $objp->title_projet;
@ -770,13 +771,13 @@ class ExpenseReport extends CommonObject
$i++;
}
$this->db->free($result);
$this->db->free($resql);
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog('ExpenseReport::fetch_lines: Error '.$this->error,LOG_ERR);
dol_syslog('ExpenseReport::fetch_lines: Error '.$this->error, LOG_ERR);
return -3;
}
}
@ -1199,30 +1200,36 @@ class ExpenseReport extends CommonObject
}
function updateline($rowid, $type_fees_id, $projet_id, $c_tva, $comments, $qty, $value_unit, $date, $expensereport_id)
/**
* updateline
*
* @param int $rowid Line to edit
* @param int $type_fees_id Type payment
* @param int $projet_id Project id
* @param double $vatrate Vat rate
* @param string $comments Description
* @param real $qty Qty
* @param double $value_unit Value init
* @param int $date Date
* @param int $expensereport_id Expense report id
* @return int <0 if KO, >0 if OK
*/
function updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $expensereport_id)
{
global $user;
if ($this->fk_statut==0 || $this->fk_statut==99)
{
$this->db->begin();
// Select du taux de tva par rapport au code
$sql = "SELECT t.taux as taux_tva";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
$sql.= " WHERE t.rowid = ".$c_tva;
$result = $this->db->query($sql);
$objp_tva = $this->db->fetch_object($result);
// calcul de tous les totaux de la ligne
$total_ttc = $qty*$value_unit;
$total_ttc = number_format($total_ttc,2,'.','');
$total_ttc = price2num($qty*$value_unit, 'MT');
$tx_tva = $objp_tva->taux_tva/100;
$tx_tva = $vatrate / 100;
$tx_tva = $tx_tva + 1;
$total_ht = $total_ttc/$tx_tva;
$total_ht = number_format($total_ht,2,'.','');
$total_ht = price2num($total_ttc/$tx_tva, 'MT');
$total_tva = $total_ttc - $total_ht;
$total_tva = price2num($total_ttc - $total_ht, 'MT');
// fin calculs
$ligne = new ExpenseReportLine($this->db);
@ -1231,15 +1238,14 @@ class ExpenseReport extends CommonObject
$ligne->value_unit = $value_unit;
$ligne->date = $date;
$ligne->fk_expensereport = $expensereport_id;
$ligne->fk_expensereport= $expensereport_id;
$ligne->fk_c_type_fees = $type_fees_id;
$ligne->fk_projet = $projet_id;
$ligne->fk_c_tva = $c_tva;
$ligne->total_ht = $total_ht;
$ligne->total_tva = $total_tva;
$ligne->total_ttc = $total_ttc;
$ligne->tva_taux = $objp_tva->taux_tva;
$ligne->vatrate = price2num($vatrate);
$ligne->rowid = $rowid;
// Select des infos sur le type fees
@ -1260,16 +1266,19 @@ class ExpenseReport extends CommonObject
$ligne->projet_ref = $objp_projet->ref_projet;
$ligne->projet_title = $objp_projet->title_projet;
$result = $ligne->update();
if ($result > 0):
$this->db->commit();
return 1;
else:
$this->error=$ligne->error;
$this->db->rollback();
return -2;
endif;
$result = $ligne->update($user);
if ($result > 0)
{
$this->db->commit();
return 1;
}
else
{
$this->error=$ligne->error;
$this->errors=$ligne->errors;
$this->db->rollback();
return -2;
}
}
}
@ -1487,8 +1496,7 @@ class ExpenseReportLine
var $projet_ref;
var $projet_title;
var $tva_taux;
var $vatrate;
var $total_ht;
var $total_tva;
var $total_ttc;
@ -1512,7 +1520,7 @@ class ExpenseReportLine
function fetch($rowid)
{
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
$sql.= ' fde.fk_c_tva as tva_taux, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
$sql.= ' fde.fk_c_tva as fk_c_tva, fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
@ -1539,7 +1547,7 @@ class ExpenseReportLine
$this->type_fees_libelle = $objp->type_fees_libelle;
$this->projet_ref = $objp->projet_ref;
$this->projet_title = $objp->projet_title;
$this->tva_taux = $objp->tva_taux;
$this->vatrate = $objp->vatrate;
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
@ -1568,15 +1576,17 @@ class ExpenseReportLine
$this->comments=trim($this->comments);
if (!$this->value_unit_HT) $this->value_unit_HT=0;
$this->qty = price2num($this->qty);
$this->vatrate = price2num($this->vatrate);
$this->db->begin();
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
$sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
$sql.= ' fk_c_tva, comments, qty, value_unit, total_ht, total_tva, total_ttc, date)';
$sql.= ' fk_c_tva, tva_tx, comments, qty, value_unit, total_ht, total_tva, total_ttc, date)';
$sql.= " VALUES (".$this->fk_expensereport.",";
$sql.= " ".$this->fk_c_type_fees.",";
$sql.= " ".($this->fk_projet>0?$this->fk_projet:'null').",";
$sql.= " ".($this->fk_c_tva?$this->fk_c_tva:"null").",";
$sql.= " ".$this->vatrate.",";
$sql.= " '".$this->db->escape($this->comments)."',";
$sql.= " ".$this->qty.",";
@ -1633,6 +1643,7 @@ class ExpenseReportLine
// Clean parameters
$this->comments=trim($this->comments);
$this->vatrate = price2num($this->vatrate);
$this->db->begin();
@ -1641,14 +1652,11 @@ class ExpenseReportLine
$sql.= " comments='".$this->db->escape($this->comments)."'";
$sql.= ",value_unit=".$this->value_unit."";
$sql.= ",qty=".$this->qty."";
if ($this->date) {
$sql.= ",date='".$this->date."'";
}
else { $sql.=',date=null';
}
$sql.= ",date='".$this->db->idate($this->date)."'";
$sql.= ",total_ht=".$this->total_ht."";
$sql.= ",total_tva=".$this->total_tva."";
$sql.= ",total_ttc=".$this->total_ttc."";
$sql.= ",tva_tx=".$this->vatrate;
if ($this->fk_c_type_fees) $sql.= ",fk_c_type_fees=".$this->fk_c_type_fees;
else $sql.= ",fk_c_type_fees=null";
if ($this->fk_projet) $sql.= ",fk_projet=".$this->fk_projet;
@ -1662,16 +1670,30 @@ class ExpenseReportLine
$resql=$this->db->query($sql);
if ($resql)
{
$tmpparent=new ExpenseReport($db);
$tmpparent->fetch($this->fk_expensereport);
$result = $tmpparent->update_price();
if ($result < 0)
$tmpparent=new ExpenseReport($this->db);
$result = $tmpparent->fetch($this->fk_expensereport);
if ($result > 0)
{
$result = $tmpparent->update_price();
if ($result < 0)
{
$error++;
$this->error = $tmpparent->error;
$this->errors = $tmpparent->errors;
}
}
else
{
$error++;
$this->error = $tmpparent->error;
$this->errors = $tmpparent->errors;
}
}
else
{
$error++;
dol_print_error($this->db);
}
if (! $error)
{

0
htdocs/expensereport/export_csv.php Executable file → Normal file
View File

8
htdocs/expensereport/list.php Executable file → Normal file
View File

@ -177,7 +177,7 @@ if ($resql)
if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht;
if ($search_amount_ttc) $param.="&search_amount_ttc=".$search_amount_ttc;
if ($search_status >= 0) $param.="&search_status=".$search_status;
print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
print '<table class="noborder" width="100%">';
@ -221,9 +221,9 @@ if ($resql)
// Amount with no taxe
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_amount_ht" value="'.$search_amount_ht.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
// Amount with all taxes
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_amount_ttc" value="'.$search_amount_ttc.'"></td>';
@ -288,7 +288,7 @@ if ($resql)
}
else
{
print '<td colspan="9">'.$langs->trans("NoRecordFound").'</td>';
print '<tr '.$bc[false].'>'.'<td colspan="9">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print "</table>";

0
htdocs/expensereport/stats/index.php Executable file → Normal file
View File

0
htdocs/expensereport/synchro_compta.php Executable file → Normal file
View File

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,7 +52,7 @@ print $langs->trans("FormatedExportDesc3").'<br>';
print '<br>';
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<div class="fichecenter"><div class="fichehalfleft">';
// List export set
@ -110,7 +110,7 @@ if (count($export->array_export_code))
print '</div>';
print '<br>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of available export format

View File

@ -1018,6 +1018,8 @@ if ($action == 'create')
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
dol_fiche_head('');
print '<table class="border" width="100%">';
print '<input type="hidden" name="socid" value='.$soc->id.'>';
@ -1122,7 +1124,9 @@ if ($action == 'create')
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
}
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
print '</div>';
@ -1130,6 +1134,8 @@ if ($action == 'create')
}
else
{
dol_fiche_head('');
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<table class="border" width="100%">';
print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
@ -1137,7 +1143,9 @@ if ($action == 'create')
print '</td></tr>';
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input type="hidden" name="action" value="create">';
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
print '</div>';

0
htdocs/fourn/class/fournisseur.product.class.php Executable file → Normal file
View File

View File

@ -1478,6 +1478,8 @@ if ($action=='create')
print '<input type="hidden" name="origin" value="' . $origin . '">';
print '<input type="hidden" name="originid" value="' . $originid . '">';
dol_fiche_head('');
print '<table class="border" width="100%">';
// Ref
@ -1600,7 +1602,9 @@ if ($action=='create')
// Bouton "Create Draft"
print "</table>\n";
print '<br><div class="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></div>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></div>';
print "</form>\n";

View File

@ -386,10 +386,10 @@ if (($action != 'create' && $action != 'add') && !$error) {
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#checkall").click(function() {
jQuery(".checkformerge").attr('checked', true);
jQuery(".checkformerge").prop('checked', true);
});
jQuery("#checknone").click(function() {
jQuery(".checkformerge").attr('checked', false);
jQuery(".checkformerge").prop('checked', false);
});
});
</script>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
@ -1318,6 +1318,8 @@ if ($action == 'create')
$datedue=($datetmp==''?-1:$datetmp);
}
dol_fiche_head();
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
@ -1572,7 +1574,9 @@ if ($action == 'create')
// Bouton "Create Draft"
print "</table>\n";
print '<br><div class="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></div>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></div>';
print "</form>\n";

View File

@ -7,7 +7,8 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 juanjo Menent <jmenent@2byte.es>
*
* Copyright (C) 2015 Abbes Bahfir <bafbes@gmail.com>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or

View File

@ -88,8 +88,8 @@ foreach($cp->logs as $logs_CP)
print '<td>'.$user_action->getNomUrl(1).'</td>';
print '<td>'.$user_update->getNomUrl(1).'</td>';
print '<td>'.$logs_CP['type_action'].'</td>';
print '<td style="text-align: right;">'.$logs_CP['prev_solde'].' '.$langs->trans('days').'</td>';
print '<td style="text-align: right;">'.$logs_CP['new_solde'].' '.$langs->trans('days').'</td>';
print '<td style="text-align: right;">'.price2num($logs_CP['prev_solde'],8).' '.$langs->trans('days').'</td>';
print '<td style="text-align: right;">'.price2num($logs_CP['new_solde'],8).' '.$langs->trans('days').'</td>';
print '</tr>'."\n";
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -48,7 +48,7 @@ print $langs->trans("FormatedImportDesc2").'<br>';
print '<br>';
print '<div class="fichecenter"><div class="fichethirdleft">';
print '<div class="fichecenter"><div class="fichehalfleft">';
// List of import set
@ -101,7 +101,7 @@ print '</div>';
print '<br>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of available import format

0
htdocs/includes/restler/iCache.php Executable file → Normal file
View File

View File

@ -296,9 +296,9 @@ else
$conf->db->user = $dolibarr_main_db_user;
$conf->db->pass = $dolibarr_main_db_pass;
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
if ($db->connected == 1 && $db->database_selected == 1)
if ($db->connected && $db->database_selected)
{
$ok=1;
$ok=true;
}
}
}

View File

@ -637,7 +637,7 @@ if (! $error && $db->connected && $action == "set")
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
if ($db->connected == 1)
if ($db->connected)
{
dolibarr_install_syslog("etape1: connexion to server by user ".$conf->db->user." is ok", LOG_DEBUG);
print "<tr><td>";
@ -648,7 +648,7 @@ if (! $error && $db->connected && $action == "set")
print "</td></tr>";
// si acces serveur ok et acces base ok, tout est ok, on ne va pas plus loin, on a meme pas utilise le compte root.
if ($db->database_selected == 1)
if ($db->database_selected)
{
dolibarr_install_syslog("etape1: connexion to database : ".$conf->db->name.", by user : ".$conf->db->user." is ok", LOG_DEBUG);
print "<tr><td>";

View File

@ -88,7 +88,7 @@ if ($action == "set")
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
if ($db->connected == 1)
if ($db->connected)
{
print "<tr><td>";
print $langs->trans("ServerConnection")." : ".$conf->db->host.'</td><td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
@ -101,7 +101,7 @@ if ($action == "set")
if ($ok)
{
if($db->database_selected == 1)
if($db->database_selected)
{
dolibarr_install_syslog("etape2: Connexion successful to database : ".$conf->db->name);
}
@ -139,7 +139,7 @@ if ($action == "set")
// To say sql requests are escaped for mysql so we need to unescape them
$db->unescapeslashquot=1;
$db->unescapeslashquot=true;
/**************************************************************************************

View File

@ -71,7 +71,7 @@ print '<table cellspacing="0" cellpadding="2" width="100%">';
$db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
if ($db->ok == 1)
if ($db->ok)
{
print '<tr><td>'.$langs->trans("DolibarrAdminLogin").' :</td><td>';
print '<input name="login" type="text" value="'.(! empty($_GET["login"])?$_GET["login"]:(isset($force_install_dolibarrlogin)?$force_install_dolibarrlogin:'')).'"></td></tr>';

View File

@ -159,7 +159,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
$result=$objMod->init();
if (! $result) print 'ERROR in activating module file='.$file;
if ($db->connected == 1)
if ($db->connected)
{
$conf->setValues($db);
@ -255,7 +255,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
// If upgrade
elseif (empty($action) || preg_match('/upgrade/i',$action))
{
if ($db->connected == 1)
if ($db->connected)
{
$conf->setValues($db);

Some files were not shown because too many files have changed in this diff Show More