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

This commit is contained in:
Laurent Destailleur 2015-05-12 23:40:57 +02:00
commit 81d2d12035
56 changed files with 536 additions and 545 deletions

View File

@ -873,7 +873,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";
}

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

@ -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

@ -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

@ -254,7 +254,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

@ -512,10 +512,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>
@ -655,12 +655,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

@ -776,11 +776,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 +791,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 +844,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>';
}

View File

@ -489,15 +489,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

@ -134,13 +134,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 +330,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

@ -2099,7 +2099,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 +2154,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 +2200,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 +2229,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";
@ -3137,28 +3137,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 +3319,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 +3340,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 +3350,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

@ -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>

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

@ -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

@ -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

@ -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

@ -4356,7 +4356,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)
{
@ -4539,7 +4539,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);

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

@ -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

@ -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

@ -386,10 +386,10 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
<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

@ -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);

View File

@ -487,8 +487,8 @@ jQuery(document).ready(function() {
function init_needroot()
{
/*alert(jQuery("#db_create_database").attr("checked")); */
if (jQuery("#db_create_database").attr("checked") || jQuery("#db_create_user").attr("checked"))
/*alert(jQuery("#db_create_database").prop("checked")); */
if (jQuery("#db_create_database").is(":checked") || jQuery("#db_create_user").is(":checked"))
{
jQuery(".hideroot").show();
jQuery(".needroot").removeAttr('disabled');
@ -496,7 +496,7 @@ jQuery(document).ready(function() {
else
{
jQuery(".hideroot").hide();
jQuery(".needroot").attr('disabled','disabled');
jQuery(".needroot").prop('disabled', true);
}
}

View File

@ -101,7 +101,7 @@ $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey)?$doliba
$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 class="nowrap">';
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";
@ -117,7 +117,7 @@ else
if ($ok)
{
if($db->database_selected == 1)
if($db->database_selected)
{
print '<tr><td class="nowrap">';
print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";

View File

@ -141,7 +141,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
if ($db->connected == 1)
if ($db->connected)
{
print '<tr><td class="nowrap">';
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>\n";
@ -157,7 +157,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
if ($ok)
{
if($db->database_selected == 1)
if($db->database_selected)
{
print '<tr><td class="nowrap">';
print $langs->trans("DatabaseConnection")." : ".$dolibarr_main_db_name."</td><td align=\"right\">".$langs->trans("OK")."</td></tr>\n";

View File

@ -134,7 +134,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($db);
if ($db->connected != 1)
if (!$db->connected)
{
print '<tr><td colspan="4">'.$langs->trans("ErrorFailedToConnectToDatabase",$conf->db->name).'</td><td align="right">'.$langs->trans('Error').'</td></tr>';
dolibarr_install_syslog('upgrade2: Failed to connect to database : '.$conf->db->name.' on '.$conf->db->host.' for user '.$conf->db->user, LOG_ERR);
@ -143,7 +143,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
if (! $error)
{
if($db->database_selected == 1)
if($db->database_selected)
{
dolibarr_install_syslog('upgrade2: Database connection successfull : '.$dolibarr_main_db_name);
}

View File

@ -29,8 +29,8 @@ $langs->load("productbatch");
jQuery(document).ready(function() {
function init_price()
{
if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr(\'disabled\');
else jQuery("#unitprice").attr(\'disabled\',\'disabled\');
if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled");
else jQuery("#unitprice").prop("disabled", true);
}
init_price();
jQuery("#mouvement").change(function() {
@ -116,4 +116,4 @@ $langs->load("productbatch");
print '</form>';
?>
<!-- END PHP STOCKCORRECTION.TPL.PHP -->
<!-- END PHP STOCKCORRECTION.TPL.PHP -->

View File

@ -464,7 +464,7 @@ if ($id > 0 || ! empty($ref))
print '</td>';
// Icon update et delete
print '<td align="center" nowrap>';
print '<td align="center" class="nowrap">';
if ($user->rights->projet->creer)
{
print '&nbsp;';

View File

@ -821,22 +821,22 @@ if (($action == 'create') || ($action == 'adduserldap'))
$("select[name=admin]").change(function() {
if ( $(this).val() == 0 ) {
$("input[name=superadmin]")
.attr("disabled", true)
.attr("checked", false);
.prop("disabled", true)
.prop("checked", false);
$("select[name=entity]")
.attr("disabled", false);
.prop("disabled", false);
} else {
$("input[name=superadmin]")
.attr("disabled", false);
.prop("disabled", false);
}
});
$("input[name=superadmin]").change(function() {
if ( $(this).attr("checked") == "checked" ) {
if ( $(this).is(":checked") ) {
$("select[name=entity]")
.attr("disabled", true);
.prop("disabled", true);
} else {
$("select[name=entity]")
.attr("disabled", false);
.prop("disabled", false);
}
});
});
@ -1822,32 +1822,32 @@ else
var admin = $("select[name=admin]").val();
if (admin == 0) {
$("input[name=superadmin]")
.attr("disabled", true)
.attr("checked", false);
.prop("disabled", true)
.prop("checked", false);
}
if ($("input[name=superadmin]").attr("checked") == "checked") {
if ($("input[name=superadmin]").is(":checked")) {
$("select[name=entity]")
.attr("disabled", true);
.prop("disabled", true);
}
$("select[name=admin]").change(function() {
if ( $(this).val() == 0 ) {
$("input[name=superadmin]")
.attr("disabled", true)
.attr("checked", false);
.prop("disabled", true)
.prop("checked", false);
$("select[name=entity]")
.attr("disabled", false);
.prop("disabled", false);
} else {
$("input[name=superadmin]")
.attr("disabled", false);
.prop("disabled", false);
}
});
$("input[name=superadmin]").change(function() {
if ( $(this).attr("checked") == "checked" ) {
if ( $(this).is(":checked")) {
$("select[name=entity]")
.attr("disabled", true);
.prop("disabled", true);
} else {
$("select[name=entity]")
.attr("disabled", false);
.prop("disabled", false);
}
});
});

View File

@ -155,11 +155,11 @@ if ($action == 'edit')
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
$("#main_lang_default").change(function() {
$("#check_MAIN_LANG_DEFAULT").attr(\'checked\', true);
$("#check_MAIN_LANG_DEFAULT").prop("checked", true);
});
$("#main_size_liste_limit").keyup(function() {
if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").attr(\'checked\', true);
else $("#check_SIZE_LISTE_LIMIT").attr(\'checked\', false);
if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").prop("checked", true);
else $("#check_SIZE_LISTE_LIMIT").prop("checked", false);
});
});
</script>';