Merge branch 'upstream/develop'
This commit is contained in:
commit
e0dc01fe85
@ -180,15 +180,18 @@ if ($conf->tax->enabled)
|
|||||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$sql = "SELECT c.id, c.libelle as lib,";
|
$sql = "SELECT c.id, c.libelle as lib,";
|
||||||
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
|
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
|
||||||
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye";
|
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment,";
|
||||||
|
$sql.= " pct.code as payment_code";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= " WHERE cs.fk_type = c.id";
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
@ -241,19 +244,27 @@ if ($conf->tax->enabled)
|
|||||||
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
|
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day').'</td>';
|
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day').'</td>';
|
||||||
|
// Type payment
|
||||||
|
print '<td>';
|
||||||
|
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
|
||||||
|
print $obj->num_payment.'</td>';
|
||||||
// Paid
|
// Paid
|
||||||
print '<td align="right">'.price($obj->totalpaye).'</td>';
|
print '<td align="right">';
|
||||||
|
if ($obj->totalpaye) print price($obj->totalpaye);
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$total = $total + $obj->total;
|
$total = $total + $obj->total;
|
||||||
$totalnb = $totalnb + $obj->nb;
|
$totalnb = $totalnb + $obj->nb;
|
||||||
$totalpaye = $totalpaye + $obj->totalpaye;
|
$totalpaye = $totalpaye + $obj->totalpaye;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").'</td>';
|
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||||
print '<td align="right">'.price($total)."</td>";
|
print '<td align="right" class="liste_total">'.price($total)."</td>";
|
||||||
print '<td align="center"> </td>';
|
print '<td align="center" class="liste_total"> </td>';
|
||||||
print '<td align="center"> </td>';
|
print '<td align="center" class="liste_total"> </td>';
|
||||||
print '<td align="right">'.price($totalpaye)."</td>";
|
print '<td align="center" class="liste_total"> </td>';
|
||||||
|
print '<td align="right" class="liste_total">'.price($totalpaye)."</td>";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/compta/deplacement/stats/index.php
|
* \file htdocs/compta/deplacement/stats/index.php
|
||||||
* \ingroup deplacement
|
* \ingroup deplacement
|
||||||
* \brief Page des stats deplacement et notes de frais
|
* \brief Page for statistics of module trips and expenses
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../../main.inc.php';
|
require '../../../main.inc.php';
|
||||||
|
|||||||
@ -336,7 +336,8 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Classify to validated
|
// Classify to validated
|
||||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider) {
|
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->facture->valider)
|
||||||
|
{
|
||||||
$idwarehouse = GETPOST('idwarehouse');
|
$idwarehouse = GETPOST('idwarehouse');
|
||||||
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -345,8 +346,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
|
|
||||||
// Check for mandatory prof id
|
// Check for mandatory prof id
|
||||||
for($i = 1; $i < 5; $i ++) {
|
for($i = 1; $i < 6; $i ++)
|
||||||
|
{
|
||||||
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
|
$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
|
||||||
$idprof = 'idprof' . $i;
|
$idprof = 'idprof' . $i;
|
||||||
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) {
|
if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) {
|
||||||
@ -374,9 +375,11 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error)
|
||||||
|
{
|
||||||
$result = $object->validate($user, '', $idwarehouse);
|
$result = $object->validate($user, '', $idwarehouse);
|
||||||
if ($result >= 0) {
|
if ($result >= 0)
|
||||||
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
@ -393,7 +396,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
|||||||
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($object->error, 'errors');
|
if (count($object->errors)) setEventMessage($object->errors, 'errors');
|
||||||
|
else setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1878,7 +1882,9 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
$absolute_discount = $soc->getAvailableDiscounts();
|
$absolute_discount = $soc->getAvailableDiscounts();
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax)) {
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
print ajax_combobox('fac_replacement');
|
print ajax_combobox('fac_replacement');
|
||||||
print ajax_combobox('fac_avoir');
|
print ajax_combobox('fac_avoir');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -185,7 +185,7 @@ if ($_GET["action"] == 'create')
|
|||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$charge->lib."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$charge->lib."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("DateDue")."</td><td colspan=\"2\">".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("DateDue")."</td><td colspan=\"2\">".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("AmountTTC")."</td><td colspan=\"2\"><b>".price($charge->amount).'</b> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount")."</td><td colspan=\"2\">".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT sum(p.amount) as total";
|
$sql = "SELECT sum(p.amount) as total";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
@ -197,8 +197,8 @@ if ($_GET["action"] == 'create')
|
|||||||
$sumpaid = $obj->total;
|
$sumpaid = $obj->total;
|
||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td colspan="2"><b>'.price($sumpaid).'</b> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td colspan="2">'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
print "<tr><td valign=\"top\">".$langs->trans("RemainderToPay")."</td><td colspan=\"3\"><b>".price($total - $sumpaid).'</b> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
print "<tr><td valign=\"top\">".$langs->trans("RemainderToPay")."</td><td colspan=\"3\">".price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\"><td colspan=\"3\">".$langs->trans("Payment").'</td>';
|
print "<tr class=\"liste_titre\"><td colspan=\"3\">".$langs->trans("Payment").'</td>';
|
||||||
|
|
||||||
@ -223,9 +223,10 @@ if ($_GET["action"] == 'create')
|
|||||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '',1); // Show opend bank account list
|
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$charge->accountid, "accountid", 0, '',1); // Show opend bank account list
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Number
|
||||||
print '<tr><td>'.$langs->trans('Numero');
|
print '<tr><td>'.$langs->trans('Numero');
|
||||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||||
print "<td><input name=\"num_paiement\" type=\"text\"></td></tr>\n";
|
print '<td><input name="num_paiement" type="text" value="'.GETPOST('num_paiement').'"></td></tr>'."\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Autres charges impayees
|
* Autres charges impayees
|
||||||
@ -238,7 +239,7 @@ if ($_GET["action"] == 'create')
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
//print '<td>'.$langs->trans("SocialContribution").'</td>';
|
//print '<td>'.$langs->trans("SocialContribution").'</td>';
|
||||||
print '<td align="left">'.$langs->trans("DateDue").'</td>';
|
print '<td align="left">'.$langs->trans("DateDue").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
print '<td align="right">'.$langs->trans("Amount").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("AlreadyPaid").'</td>';
|
print '<td align="right">'.$langs->trans("AlreadyPaid").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
|
print '<td align="right">'.$langs->trans("RemainderToPay").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||||
@ -296,7 +297,7 @@ if ($_GET["action"] == 'create')
|
|||||||
{
|
{
|
||||||
// Print total
|
// Print total
|
||||||
print "<tr ".$bc[!$var].">";
|
print "<tr ".$bc[!$var].">";
|
||||||
print '<td colspan="2" align="left">'.$langs->trans("TotalTTC").':</td>';
|
print '<td colspan="2" align="left">'.$langs->trans("Total").':</td>';
|
||||||
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>";
|
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>";
|
||||||
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>";
|
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>";
|
||||||
print "<td align=\"right\"><b>".price($total_ttc - $totalrecu)."</b></td>";
|
print "<td align=\"right\"><b>".price($total_ttc - $totalrecu)."</b></td>";
|
||||||
@ -304,29 +305,18 @@ if ($_GET["action"] == 'create')
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
print "</table></td></tr>\n";
|
print "</table></td></tr>\n";
|
||||||
// }
|
|
||||||
// $db->free();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// print $sql ."<br>".$db->error();
|
|
||||||
// }
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '<br><center>';
|
print '<br><center>';
|
||||||
//print '<tr><td colspan="3" align="center">';
|
|
||||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
|
|
||||||
print '</center>';
|
print '</center>';
|
||||||
//print '</td></tr>';
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
@ -37,13 +37,19 @@ $langs->load('banks');
|
|||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
|
$id=GETPOST("id");
|
||||||
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
$action=GETPOST("action");
|
||||||
|
$confirm=GETPOST('confirm');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
// TODO ajouter regle pour restreindre acces paiement
|
// TODO ajouter regle pour restreindre acces paiement
|
||||||
//$result = restrictedArea($user, 'facture', $id,'');
|
//$result = restrictedArea($user, 'facture', $id,'');
|
||||||
|
|
||||||
$mesg='';
|
$paiement = new PaymentSocialContribution($db);
|
||||||
|
if ($id > 0)
|
||||||
|
{
|
||||||
|
$result=$paiement->fetch($id);
|
||||||
|
if (! $result) dol_print_error($db,'Failed to get payment id '.$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -51,12 +57,10 @@ $mesg='';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Delete payment
|
// Delete payment
|
||||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->tax->charges->supprimer)
|
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->charges->supprimer)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$paiement = new PaymentSocialContribution($db);
|
|
||||||
$paiement->fetch($_REQUEST['id']);
|
|
||||||
$result = $paiement->delete($user);
|
$result = $paiement->delete($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -66,19 +70,19 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
setEventMessage($paiement->error, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create payment
|
// Create payment
|
||||||
if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->tax->charges->creer)
|
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$paiement = new PaymentSocialContribution($db);
|
$result=$paiement->valide();
|
||||||
$paiement->id = $_REQUEST['id'];
|
|
||||||
if ($paiement->valide() > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
@ -102,7 +106,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
setEventMessage($paiement->error);
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,14 +119,6 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$socialcontrib=new ChargeSociales($db);
|
$socialcontrib=new ChargeSociales($db);
|
||||||
$paiement = new PaymentSocialContribution($db);
|
|
||||||
|
|
||||||
$result=$paiement->fetch($_GET['id']);
|
|
||||||
if ($result <= 0)
|
|
||||||
{
|
|
||||||
dol_print_error($db,'Payment '.$_GET['id'].' not found in database');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
@ -144,7 +140,7 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0,
|
|||||||
/*
|
/*
|
||||||
* Confirmation de la suppression du paiement
|
* Confirmation de la suppression du paiement
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
print $form->formconfirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
||||||
|
|
||||||
@ -153,7 +149,7 @@ if ($_GET['action'] == 'delete')
|
|||||||
/*
|
/*
|
||||||
* Confirmation de la validation du paiement
|
* Confirmation de la validation du paiement
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'valide')
|
if ($action == 'valide')
|
||||||
{
|
{
|
||||||
$facid = $_GET['facid'];
|
$facid = $_GET['facid'];
|
||||||
print $form->formconfirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
print $form->formconfirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
||||||
@ -161,9 +157,6 @@ if ($_GET['action'] == 'valide')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($mesg) print $mesg.'<br>';
|
|
||||||
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -182,8 +175,7 @@ print '<tr><td valign="top">'.$langs->trans('Mode').'</td><td colspan="3">'.$lan
|
|||||||
print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
|
||||||
|
|
||||||
// Montant
|
// Montant
|
||||||
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount).' '.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
|
||||||
@ -262,7 +254,7 @@ if ($resql)
|
|||||||
// Expected to pay
|
// Expected to pay
|
||||||
print '<td align="right">'.price($objp->sc_amount).'</td>';
|
print '<td align="right">'.price($objp->sc_amount).'</td>';
|
||||||
// Status
|
// Status
|
||||||
print '<td align="center">'.$socialcontrib->getLibStatut(4).'</td>';
|
print '<td align="center">'.$socialcontrib->getLibStatut(4,$objp->amount).'</td>';
|
||||||
// Amount payed
|
// Amount payed
|
||||||
print '<td align="right">'.price($objp->amount).'</td>';
|
print '<td align="right">'.price($objp->amount).'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -323,7 +315,8 @@ if ($_GET['action'] == '')
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,19 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/salaries/class/paymentsalary.class.php
|
* \file htdocs/compta/salaries/class/paymentsalary.class.php
|
||||||
@ -26,270 +26,199 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put here description of your class
|
* Class to manage salary payments
|
||||||
*/
|
*/
|
||||||
class PaymentSalary extends CommonObject
|
class PaymentSalary extends CommonObject
|
||||||
{
|
{
|
||||||
//public $element='payment_salary'; //!< Id that identify managed objects
|
//public $element='payment_salary'; //!< Id that identify managed objects
|
||||||
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
|
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
|
||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
var $ref;
|
var $ref;
|
||||||
|
|
||||||
var $tms;
|
var $tms;
|
||||||
var $fk_user;
|
var $fk_user;
|
||||||
var $datep;
|
var $datep;
|
||||||
var $datev;
|
var $datev;
|
||||||
var $amount;
|
var $amount;
|
||||||
|
var $type_payment;
|
||||||
|
var $num_payment;
|
||||||
var $label;
|
var $label;
|
||||||
var $datesp;
|
var $datesp;
|
||||||
var $dateep;
|
var $dateep;
|
||||||
var $note;
|
var $note;
|
||||||
var $fk_bank;
|
var $fk_bank;
|
||||||
var $fk_user_creat;
|
var $fk_user_creat;
|
||||||
var $fk_user_modif;
|
var $fk_user_modif;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function __construct($db)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->element = 'payment_salary';
|
$this->element = 'payment_salary';
|
||||||
$this->table_element = 'payment_salary';
|
$this->table_element = 'payment_salary';
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update database
|
||||||
|
*
|
||||||
|
* @param User $user User that modify
|
||||||
|
* @param int $notrigger 0=no, 1=yes (no update trigger)
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function update($user=0, $notrigger=0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
/**
|
$error=0;
|
||||||
* Create in database
|
|
||||||
*
|
|
||||||
* @param User $user User that create
|
|
||||||
* @return int <0 if KO, >0 if OK
|
|
||||||
*/
|
|
||||||
function create($user)
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$error=0;
|
// Clean parameters
|
||||||
|
$this->fk_user=trim($this->fk_user);
|
||||||
|
$this->amount=trim($this->amount);
|
||||||
|
$this->label=trim($this->label);
|
||||||
|
$this->note=trim($this->note);
|
||||||
|
$this->fk_bank=trim($this->fk_bank);
|
||||||
|
$this->fk_user_creat=trim($this->fk_user_creat);
|
||||||
|
$this->fk_user_modif=trim($this->fk_user_modif);
|
||||||
|
|
||||||
// Clean parameters
|
// Check parameters
|
||||||
$this->fk_user=trim($this->fk_user);
|
if (empty($this->fk_user) || $this->fk_user < 0)
|
||||||
$this->amount=trim($this->amount);
|
{
|
||||||
$this->label=trim($this->label);
|
$this->error='ErrorBadParameter';
|
||||||
$this->note=trim($this->note);
|
return -1;
|
||||||
$this->fk_bank=trim($this->fk_bank);
|
}
|
||||||
$this->fk_user_creat=trim($this->fk_user_creat);
|
|
||||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
|
||||||
|
|
||||||
// Check parameters
|
// Update request
|
||||||
// Put here code to add control on parameters values
|
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
||||||
|
|
||||||
// Insert request
|
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary(";
|
$sql.= " fk_user='".$this->fk_user."',";
|
||||||
$sql.= "tms,";
|
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||||
$sql.= "fk_user,";
|
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||||
$sql.= "datep,";
|
$sql.= " amount='".$this->amount."',";
|
||||||
$sql.= "datev,";
|
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||||
$sql.= "amount,";
|
$sql.= " num_payment='".$this->num_payment."',";
|
||||||
$sql.= "label,";
|
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||||
$sql.= "datesp,";
|
$sql.= " datesp=".$this->db->idate($this->datesp).",";
|
||||||
$sql.= "dateep,";
|
$sql.= " dateep=".$this->db->idate($this->dateep).",";
|
||||||
$sql.= "note,";
|
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||||
$sql.= "fk_bank,";
|
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
|
||||||
$sql.= "fk_user_creat,";
|
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
|
||||||
$sql.= "fk_user_modif";
|
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||||
|
|
||||||
$sql.= ") VALUES (";
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$sql.= " '".$this->db->idate($this->tms).",";
|
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||||
$sql.= " '".$this->fk_user."',";
|
$resql = $this->db->query($sql);
|
||||||
$sql.= " '".$this->db->idate($this->datep)."',";
|
if (! $resql)
|
||||||
$sql.= " '".$this->db->idate($this->datev)."',";
|
{
|
||||||
$sql.= " '".$this->amount."',";
|
$this->error="Error ".$this->db->lasterror();
|
||||||
$sql.= " '".$this->label."',";
|
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||||
$sql.= " '".$this->db->idate($this->datesp)."',";
|
return -1;
|
||||||
$sql.= " '".$this->db->idate($this->dateep)."',";
|
}
|
||||||
$sql.= " '".$this->note."',";
|
|
||||||
$sql.= " ".($this->fk_bank <= 0 ? "NULL" : "'".$this->fk_bank."'").",";
|
|
||||||
$sql.= " '".$this->fk_user_creat."',";
|
|
||||||
$sql.= " '".$this->fk_user_modif."'";
|
|
||||||
|
|
||||||
$sql.= ")";
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
|
|
||||||
|
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error="Error ".$this->db->lasterror();
|
|
||||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update database
|
|
||||||
*
|
|
||||||
* @param User $user User that modify
|
|
||||||
* @param int $notrigger 0=no, 1=yes (no update trigger)
|
|
||||||
* @return int <0 if KO, >0 if OK
|
|
||||||
*/
|
|
||||||
function update($user=0, $notrigger=0)
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
// Clean parameters
|
|
||||||
$this->fk_user=trim($this->fk_user);
|
|
||||||
$this->amount=trim($this->amount);
|
|
||||||
$this->label=trim($this->label);
|
|
||||||
$this->note=trim($this->note);
|
|
||||||
$this->fk_bank=trim($this->fk_bank);
|
|
||||||
$this->fk_user_creat=trim($this->fk_user_creat);
|
|
||||||
$this->fk_user_modif=trim($this->fk_user_modif);
|
|
||||||
|
|
||||||
// Check parameters
|
|
||||||
if (empty($this->fk_user) || $this->fk_user < 0)
|
|
||||||
{
|
|
||||||
$this->error='ErrorBadParameter';
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update request
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
|
||||||
|
|
||||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
|
||||||
$sql.= " fk_user='".$this->fk_user."',";
|
|
||||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
|
||||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
|
||||||
$sql.= " amount='".$this->amount."',";
|
|
||||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
|
||||||
$sql.= " datesp=".$this->db->idate($this->datesp).",";
|
|
||||||
$sql.= " dateep=".$this->db->idate($this->dateep).",";
|
|
||||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
|
||||||
$sql.= " fk_bank='".$this->fk_bank."',";
|
|
||||||
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
|
|
||||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
|
||||||
|
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if (! $resql)
|
|
||||||
{
|
|
||||||
$this->error="Error ".$this->db->lasterror();
|
|
||||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
|
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
if ($result < 0) {
|
||||||
// Fin appel triggers
|
$error++; $this->errors=$interface->errors;
|
||||||
}
|
}
|
||||||
|
// Fin appel triggers
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load object in memory from database
|
* Load object in memory from database
|
||||||
*
|
*
|
||||||
* @param int $id id object
|
* @param int $id id object
|
||||||
* @param User $user User that load
|
* @param User $user User that load
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($id, $user=0)
|
function fetch($id, $user=0)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " s.rowid,";
|
$sql.= " s.rowid,";
|
||||||
|
|
||||||
$sql.= " s.tms,";
|
$sql.= " s.tms,";
|
||||||
$sql.= " s.fk_user,";
|
$sql.= " s.fk_user,";
|
||||||
$sql.= " s.datep,";
|
$sql.= " s.datep,";
|
||||||
$sql.= " s.datev,";
|
$sql.= " s.datev,";
|
||||||
$sql.= " s.amount,";
|
$sql.= " s.amount,";
|
||||||
$sql.= " s.label,";
|
$sql.= " s.fk_typepayment,";
|
||||||
$sql.= " s.datesp,";
|
$sql.= " s.num_payment,";
|
||||||
$sql.= " s.dateep,";
|
$sql.= " s.label,";
|
||||||
$sql.= " s.note,";
|
$sql.= " s.datesp,";
|
||||||
$sql.= " s.fk_bank,";
|
$sql.= " s.dateep,";
|
||||||
$sql.= " s.fk_user_creat,";
|
$sql.= " s.note,";
|
||||||
$sql.= " s.fk_user_modif,";
|
$sql.= " s.fk_bank,";
|
||||||
$sql.= " b.fk_account,";
|
$sql.= " s.fk_user_creat,";
|
||||||
$sql.= " b.fk_type,";
|
$sql.= " s.fk_user_modif,";
|
||||||
$sql.= " b.rappro";
|
$sql.= " b.fk_account,";
|
||||||
|
$sql.= " b.fk_type,";
|
||||||
|
$sql.= " b.rappro";
|
||||||
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
||||||
$sql.= " WHERE s.rowid = ".$id;
|
$sql.= " WHERE s.rowid = ".$id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($resql))
|
if ($this->db->num_rows($resql))
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->ref = $obj->rowid;
|
$this->ref = $obj->rowid;
|
||||||
$this->tms = $this->db->jdate($obj->tms);
|
$this->tms = $this->db->jdate($obj->tms);
|
||||||
$this->fk_user = $obj->fk_user;
|
$this->fk_user = $obj->fk_user;
|
||||||
$this->datep = $this->db->jdate($obj->datep);
|
$this->datep = $this->db->jdate($obj->datep);
|
||||||
$this->datev = $this->db->jdate($obj->datev);
|
$this->datev = $this->db->jdate($obj->datev);
|
||||||
$this->amount = $obj->amount;
|
$this->amount = $obj->amount;
|
||||||
$this->label = $obj->label;
|
$this->type_payement = $obj->fk_typepayment;
|
||||||
$this->datesp = $this->db->jdate($obj->datesp);
|
$this->num_payment = $obj->num_payment;
|
||||||
$this->dateep = $this->db->jdate($obj->dateep);
|
$this->label = $obj->label;
|
||||||
$this->note = $obj->note;
|
$this->datesp = $this->db->jdate($obj->datesp);
|
||||||
$this->fk_bank = $obj->fk_bank;
|
$this->dateep = $this->db->jdate($obj->dateep);
|
||||||
$this->fk_user_creat = $obj->fk_user_creat;
|
$this->note = $obj->note;
|
||||||
$this->fk_user_modif = $obj->fk_user_modif;
|
$this->fk_bank = $obj->fk_bank;
|
||||||
$this->fk_account = $obj->fk_account;
|
$this->fk_user_creat = $obj->fk_user_creat;
|
||||||
$this->fk_type = $obj->fk_type;
|
$this->fk_user_modif = $obj->fk_user_modif;
|
||||||
$this->rappro = $obj->rappro;
|
$this->fk_account = $obj->fk_account;
|
||||||
}
|
$this->fk_type = $obj->fk_type;
|
||||||
$this->db->free($resql);
|
$this->rappro = $obj->rappro;
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete object in database
|
* Delete object in database
|
||||||
*
|
*
|
||||||
* @param User $user User that delete
|
* @param User $user User that delete
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user)
|
function delete($user)
|
||||||
@ -301,32 +230,34 @@ class PaymentSalary extends CommonObject
|
|||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
|
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
if ($result < 0) {
|
||||||
// Fin appel triggers
|
$error++; $this->errors=$interface->errors;
|
||||||
|
}
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise an instance with random values.
|
* Initialise an instance with random values.
|
||||||
* Used to build previews or test instances.
|
* Used to build previews or test instances.
|
||||||
* id must be 0 if object instance is a specimen.
|
* id must be 0 if object instance is a specimen.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initAsSpecimen()
|
function initAsSpecimen()
|
||||||
{
|
{
|
||||||
@ -334,7 +265,7 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
$this->tms='';
|
$this->tms='';
|
||||||
$this->fk_user='';
|
$this->fk_user='';
|
||||||
$this->datep='';
|
$this->datep='';
|
||||||
$this->datev='';
|
$this->datev='';
|
||||||
$this->amount='';
|
$this->amount='';
|
||||||
$this->label='';
|
$this->label='';
|
||||||
@ -346,192 +277,198 @@ class PaymentSalary extends CommonObject
|
|||||||
$this->fk_user_modif='';
|
$this->fk_user_modif='';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute un paiement de salaire
|
* Ajoute un paiement de salaire
|
||||||
*
|
*
|
||||||
* @param User $user Object user that insert
|
* @param User $user Object user that insert
|
||||||
* @return int <0 if KO, rowid in tva table if OK
|
* @return int <0 if KO, rowid in tva table if OK
|
||||||
*/
|
*/
|
||||||
function addPayment($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$this->db->begin();
|
// Clean parameters
|
||||||
|
$this->amount=price2num(trim($this->amount));
|
||||||
|
|
||||||
// Clean parameters
|
// Check parameters
|
||||||
$this->amount=price2num(trim($this->amount));
|
if (! $this->label)
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
if ($this->fk_user < 0 || $this->fk_user == '')
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Employee"));
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
if ($this->amount < 0 || $this->amount == '')
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
||||||
|
return -5;
|
||||||
|
}
|
||||||
|
if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
if (! empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
|
||||||
// Check parameters
|
$this->db->begin();
|
||||||
if (! $this->label)
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
|
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
if ($this->fk_user < 0 || $this->fk_user == '')
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Employee"));
|
|
||||||
return -4;
|
|
||||||
}
|
|
||||||
if ($this->amount < 0 || $this->amount == '')
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
|
|
||||||
return -5;
|
|
||||||
}
|
|
||||||
if (! empty($conf->banque->enabled) && (empty($this->accountid) || $this->accountid <= 0))
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Account"));
|
|
||||||
return -6;
|
|
||||||
}
|
|
||||||
if (! empty($conf->banque->enabled) && (empty($this->paymenttype) || $this->paymenttype <= 0))
|
|
||||||
{
|
|
||||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
|
|
||||||
return -6;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insertion dans table des paiement salaires
|
// Insertion dans table des paiement salaires
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user";
|
||||||
$sql.= ", datep";
|
$sql.= ", datep";
|
||||||
$sql.= ", datev";
|
$sql.= ", datev";
|
||||||
$sql.= ", amount";
|
$sql.= ", amount";
|
||||||
if ($this->note) $sql.=", note";
|
$sql.= ", fk_typepayment";
|
||||||
if ($this->label) $sql.=", label";
|
$sql.= ", num_payment";
|
||||||
$sql.= ", datesp";
|
$sql.=", note";
|
||||||
$sql.= ", dateep";
|
$sql.=", label";
|
||||||
$sql.= ", fk_user_creat";
|
$sql.= ", datesp";
|
||||||
$sql.= ", fk_bank";
|
$sql.= ", dateep";
|
||||||
$sql.= ", entity";
|
$sql.= ", fk_user_creat";
|
||||||
$sql.= ") ";
|
$sql.= ", fk_bank";
|
||||||
$sql.= " VALUES (";
|
$sql.= ", entity";
|
||||||
$sql.= "'".$this->fk_user."'";
|
$sql.= ") ";
|
||||||
$sql.= ", '".$this->db->idate($this->datep)."'";
|
$sql.= " VALUES (";
|
||||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
$sql.= "'".$this->fk_user."'";
|
||||||
$sql.= ", ".$this->amount;
|
$sql.= ", '".$this->db->idate($this->datep)."'";
|
||||||
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||||
if ($this->label) $sql.= ", '".$this->db->escape($this->label)."'";
|
$sql.= ", ".$this->amount;
|
||||||
$sql.= ", '".$this->db->idate($this->datesp)."'";
|
$sql.= ", ".$this->type_payment;
|
||||||
$sql.= ", '".$this->db->idate($this->dateep)."'";
|
$sql.= ", ".$this->num_payment;
|
||||||
$sql.= ", '".$user->id."'";
|
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||||
$sql.= ", NULL";
|
$sql.= ", '".$this->db->escape($this->label)."'";
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", '".$this->db->idate($this->datesp)."'";
|
||||||
$sql.= ")";
|
$sql.= ", '".$this->db->idate($this->dateep)."'";
|
||||||
|
$sql.= ", '".$user->id."'";
|
||||||
|
$sql.= ", NULL";
|
||||||
|
$sql.= ", ".$conf->entity;
|
||||||
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addPayment sql=".$sql);
|
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO devrait s'appeler payment_salary
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO devrait s'appeler payment_salary
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
$result=$interface->run_triggers('PAYMENT_SALARY_ADDPAYMENT',$this,$user,$langs,$conf);
|
$result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf);
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
if ($result < 0) {
|
||||||
// Fin appel triggers
|
$error++; $this->errors=$interface->errors;
|
||||||
|
}
|
||||||
|
// Fin appel triggers
|
||||||
|
|
||||||
if ($this->id > 0)
|
if ($this->id > 0)
|
||||||
{
|
{
|
||||||
$ok=1;
|
$ok=1;
|
||||||
if (! empty($conf->banque->enabled) && ! empty($this->amount))
|
if (! empty($conf->banque->enabled) && ! empty($this->amount))
|
||||||
{
|
{
|
||||||
// Insertion dans llx_bank
|
// Insertion dans llx_bank
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
$acc = new Account($this->db);
|
$acc = new Account($this->db);
|
||||||
$result=$acc->fetch($this->accountid);
|
$result=$acc->fetch($this->accountid);
|
||||||
if ($result <= 0) dol_print_error($this->db);
|
if ($result <= 0) dol_print_error($this->db);
|
||||||
|
|
||||||
// Insert payment into llx_bank
|
// Insert payment into llx_bank
|
||||||
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
||||||
$bank_line_id = $acc->addline(
|
$bank_line_id = $acc->addline(
|
||||||
$this->datep,
|
$this->datep,
|
||||||
$this->paymenttype,
|
$this->type_payment,
|
||||||
$this->label,
|
$this->label,
|
||||||
-abs($this->amount),
|
-abs($this->amount),
|
||||||
'',
|
$this->num_payment,
|
||||||
'',
|
'',
|
||||||
$user
|
$user
|
||||||
);
|
);
|
||||||
|
|
||||||
// Mise a jour fk_bank dans llx_paiement.
|
// Mise a jour fk_bank dans llx_paiement.
|
||||||
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
||||||
if ($bank_line_id > 0)
|
if ($bank_line_id > 0)
|
||||||
{
|
{
|
||||||
$this->update_fk_bank($bank_line_id);
|
$this->update_fk_bank($bank_line_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$acc->error;
|
$this->error=$acc->error;
|
||||||
$ok=0;
|
$ok=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
||||||
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
|
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
|
||||||
|
|
||||||
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
|
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
$this->error=$acc->error;
|
$this->error=$acc->error;
|
||||||
$ok=0;
|
$ok=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add link 'user' in bank_url between operation and bank transaction
|
// Add link 'user' in bank_url between operation and bank transaction
|
||||||
$linkaddedforthirdparty=array();
|
$linkaddedforthirdparty=array();
|
||||||
foreach ($this->amounts as $key => $value)
|
foreach ($this->amounts as $key => $value)
|
||||||
{
|
{
|
||||||
$sal = new PaymentSalary($this->db);
|
$sal = new PaymentSalary($this->db);
|
||||||
|
|
||||||
$sal->fetch($key);
|
$sal->fetch($key);
|
||||||
$sal->fetch_user($this->fk_user);
|
$sal->fetch_user($this->fk_user);
|
||||||
|
|
||||||
if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
|
if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
|
||||||
{
|
{
|
||||||
$result=$acc->add_url_line(
|
$result=$acc->add_url_line(
|
||||||
$bank_line_id,
|
$bank_line_id,
|
||||||
$sal->user->id,
|
$sal->user->id,
|
||||||
DOL_URL_ROOT.'/user/fiche.php?id=',
|
DOL_URL_ROOT.'/user/fiche.php?id=',
|
||||||
$sal->user->lastname,
|
$sal->user->lastname,
|
||||||
'user'
|
'user'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result <= 0) dol_print_error($this->db);
|
if ($result <= 0) dol_print_error($this->db);
|
||||||
$linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty
|
$linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ok)
|
if ($ok)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mise a jour du lien entre le paiement salaire et la ligne générée dans llx_bank
|
* Mise a jour du lien entre le paiement salaire et la ligne générée dans llx_bank
|
||||||
*
|
*
|
||||||
* @param int $id_bank Id compte bancaire
|
* @param int $id_bank Id compte bancaire
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update_fk_bank($id_bank)
|
function update_fk_bank($id_bank)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
|
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,7 +18,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/salaries/fiche.php
|
* \file htdocs/compta/salaries/fiche.php
|
||||||
* \ingroup tax
|
* \ingroup salaries
|
||||||
* \brief Page of salaries payments
|
* \brief Page of salaries payments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -59,50 +60,73 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
|
|||||||
|
|
||||||
if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||||
{
|
{
|
||||||
$db->begin();
|
$error=0;
|
||||||
|
|
||||||
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
|
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
|
||||||
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
|
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
|
||||||
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
|
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
|
||||||
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
|
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
|
||||||
|
|
||||||
|
$sal->accountid=GETPOST("accountid");
|
||||||
|
$sal->fk_user=GETPOST("fk_user");
|
||||||
|
$sal->datev=$datev;
|
||||||
|
$sal->datep=$datep;
|
||||||
|
$sal->amount=price2num(GETPOST("amount"));
|
||||||
|
$sal->label=GETPOST("label");
|
||||||
|
$sal->datesp=$datesp;
|
||||||
|
$sal->dateep=$dateep;
|
||||||
|
$sal->type_payment=GETPOST("paymenttype");
|
||||||
|
$sal->num_payment=GETPOST('num_payment');
|
||||||
|
|
||||||
$sal->accountid=$_POST["accountid"];
|
if (empty($sal->fk_user) || $sal->fk_user < 0)
|
||||||
$sal->paymenttype=$_POST["paiementtype"];
|
{
|
||||||
$sal->fk_user=$_POST["fk_user"];
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Employee")),'errors');
|
||||||
$sal->datev=$datev;
|
$error++;
|
||||||
$sal->datep=$datep;
|
}
|
||||||
$sal->amount=$_POST["amount"];
|
if (empty($sal->type_payment) || $sal->type_payment < 0)
|
||||||
$sal->label=$_POST["label"];
|
{
|
||||||
$sal->datesp=$datesp;
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');
|
||||||
$sal->dateep=$dateep;
|
$error++;
|
||||||
|
}
|
||||||
|
if (empty($sal->amount))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")),'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
$ret=$sal->addPayment($user);
|
if (! $error)
|
||||||
if ($ret > 0)
|
{
|
||||||
{
|
$db->begin();
|
||||||
$db->commit();
|
|
||||||
header("Location: index.php");
|
$ret=$sal->create($user);
|
||||||
exit;
|
if ($ret > 0)
|
||||||
}
|
{
|
||||||
else
|
$db->commit();
|
||||||
{
|
header("Location: index.php");
|
||||||
$db->rollback();
|
exit;
|
||||||
setEventMessage($sal->error, 'errors');
|
}
|
||||||
$action="create";
|
else
|
||||||
}
|
{
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($sal->error, 'errors');
|
||||||
|
$action="create";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$action='create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$result=$sal->fetch($id);
|
$result=$sal->fetch($id);
|
||||||
|
|
||||||
if ($sal->rappro == 0)
|
if ($sal->rappro == 0)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$ret=$sal->delete($user);
|
$ret=$sal->delete($user);
|
||||||
if ($ret > 0)
|
if ($ret > 0)
|
||||||
{
|
{
|
||||||
if ($sal->fk_bank)
|
if ($sal->fk_bank)
|
||||||
{
|
{
|
||||||
$accountline=new AccountLine($db);
|
$accountline=new AccountLine($db);
|
||||||
@ -122,23 +146,23 @@ if ($action == 'delete')
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
setEventMessage($sal->error,'errors');
|
setEventMessage($sal->error,'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
setEventMessage($sal->error,'errors');
|
setEventMessage($sal->error,'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage('Error try do delete a line linked to a conciliated bank transaction','errors');
|
setEventMessage('Error try do delete a line linked to a conciliated bank transaction','errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
@ -146,7 +170,7 @@ $form = new Form($db);
|
|||||||
|
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$salpayment = new PaymentSalary($db);
|
$salpayment = new PaymentSalary($db);
|
||||||
$result = $salpayment->fetch($id);
|
$result = $salpayment->fetch($id);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
@ -158,86 +182,93 @@ if ($id)
|
|||||||
// Formulaire saisie salaire
|
// Formulaire saisie salaire
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
$year_current = strftime("%Y",dol_now());
|
$year_current = strftime("%Y",dol_now());
|
||||||
$pastmonth = strftime("%m",dol_now()) - 1;
|
$pastmonth = strftime("%m",dol_now()) - 1;
|
||||||
$pastmonthyear = $year_current;
|
$pastmonthyear = $year_current;
|
||||||
if ($pastmonth == 0)
|
if ($pastmonth == 0)
|
||||||
{
|
{
|
||||||
$pastmonth = 12;
|
$pastmonth = 12;
|
||||||
$pastmonthyear--;
|
$pastmonthyear--;
|
||||||
}
|
}
|
||||||
|
|
||||||
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
|
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
|
||||||
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
|
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
|
||||||
|
|
||||||
if (empty($datesp) || empty($dateep)) // We define date_start and date_end
|
if (empty($datesp) || empty($dateep)) // We define date_start and date_end
|
||||||
{
|
{
|
||||||
$datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false);
|
$datesp=dol_get_first_day($pastmonthyear,$pastmonth,false); $dateep=dol_get_last_day($pastmonthyear,$pastmonth,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
|
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("NewSalaryPayment"));
|
print_fiche_titre($langs->trans("NewSalaryPayment"));
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
|
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
|
||||||
print $form->select_date($datep,"datep",'','','','add');
|
print $form->select_date($datep,"datep",'','','','add');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
|
||||||
print $form->select_date($datev,"datev",'','','','add');
|
print $form->select_date($datev,"datev",'','','','add');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Employee
|
// Employee
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("Employee").'</td><td>';
|
print '<td class="fieldrequired">'.$langs->trans("Employee").'</td><td>';
|
||||||
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
|
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
|
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
|
||||||
print $form->select_date($datesp,"datesp",'','','','add');
|
print $form->select_date($datesp,"datesp",'','','','add');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("DateEndPeriod").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("DateEndPeriod").'</td><td>';
|
||||||
print $form->select_date($dateep,"dateep",'','','','add');
|
print $form->select_date($dateep,"dateep",'','','','add');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';
|
||||||
|
|
||||||
// Bank
|
// Bank
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
||||||
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
|
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
}
|
||||||
$form->select_types_paiements($_POST["paiementtype"], "paiementtype");
|
|
||||||
print "</td>\n";
|
|
||||||
print "</tr>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Other attributes
|
// TYpe payment
|
||||||
$parameters=array('colspan' => ' colspan="1"');
|
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype");
|
||||||
|
print "</td>\n";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
// Number
|
||||||
|
print '<tr><td>'.$langs->trans('Numero');
|
||||||
|
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||||
|
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||||
|
|
||||||
|
// Other attributes
|
||||||
|
$parameters=array('colspan' => ' colspan="1"');
|
||||||
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
|
||||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -265,17 +296,17 @@ if ($id)
|
|||||||
print $salpayment->ref;
|
print $salpayment->ref;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Person
|
// Person
|
||||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||||
$usersal=new User($db);
|
$usersal=new User($db);
|
||||||
$usersal->fetch($salpayment->fk_user);
|
$usersal->fetch($salpayment->fk_user);
|
||||||
print $usersal->getNomUrl(1);
|
print $usersal->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$salpayment->label.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$salpayment->label.'</td></tr>';
|
||||||
|
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("DateStartPeriod").'</td><td colspan="3">';
|
print '<td>'.$langs->trans("DateStartPeriod").'</td><td colspan="3">';
|
||||||
print dol_print_date($salpayment->datesp,'day');
|
print dol_print_date($salpayment->datesp,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -293,34 +324,34 @@ if ($id)
|
|||||||
print dol_print_date($salpayment->datev,'day');
|
print dol_print_date($salpayment->datev,'day');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($salpayment->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td colspan="3">'.price($salpayment->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
if (! empty($conf->banque->enabled))
|
if (! empty($conf->banque->enabled))
|
||||||
{
|
{
|
||||||
if ($salpayment->fk_account > 0)
|
if ($salpayment->fk_account > 0)
|
||||||
{
|
{
|
||||||
$bankline=new AccountLine($db);
|
$bankline=new AccountLine($db);
|
||||||
$bankline->fetch($salpayment->fk_bank);
|
$bankline->fetch($salpayment->fk_bank);
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print $bankline->getNomUrl(1,0,'showall');
|
print $bankline->getNomUrl(1,0,'showall');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="3"');
|
$parameters=array('colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons d'actions
|
* Boutons d'actions
|
||||||
*/
|
*/
|
||||||
print "<div class=\"tabsAction\">\n";
|
print "<div class=\"tabsAction\">\n";
|
||||||
if ($salpayment->rappro == 0)
|
if ($salpayment->rappro == 0)
|
||||||
@ -342,7 +373,8 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
?>
|
|
||||||
|
$db->close();
|
||||||
|
?>
|
||||||
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/salaries/index.php
|
* \file htdocs/compta/salaries/index.php
|
||||||
* \ingroup tax
|
* \ingroup salaries
|
||||||
* \brief List of salaries payments
|
* \brief List of salaries payments
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
@ -26,6 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
|||||||
|
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
$langs->load("salaries");
|
$langs->load("salaries");
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||||
@ -46,8 +47,11 @@ $userstatic = new User($db);
|
|||||||
|
|
||||||
print_fiche_titre($langs->trans("SalariesPayments"));
|
print_fiche_titre($langs->trans("SalariesPayments"));
|
||||||
|
|
||||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm";
|
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.num_payment,";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
|
$sql.= " pst.code as payment_code";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE u.rowid = s.fk_user";
|
$sql.= " WHERE u.rowid = s.fk_user";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
$sql.= " ORDER BY dm DESC";
|
$sql.= " ORDER BY dm DESC";
|
||||||
@ -65,6 +69,7 @@ if ($result)
|
|||||||
print "<td>".$langs->trans("Person")."</td>";
|
print "<td>".$langs->trans("Person")."</td>";
|
||||||
print "<td>".$langs->trans("Label")."</td>";
|
print "<td>".$langs->trans("Label")."</td>";
|
||||||
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
|
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
|
||||||
|
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$paramlist,"",$sortfield,$sortorder);
|
||||||
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
|
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$var=1;
|
$var=1;
|
||||||
@ -78,20 +83,23 @@ if ($result)
|
|||||||
$userstatic->lastname=$obj->lastname;
|
$userstatic->lastname=$obj->lastname;
|
||||||
$userstatic->firstname=$obj->firstname;
|
$userstatic->firstname=$obj->firstname;
|
||||||
$salstatic->id=$obj->rowid;
|
$salstatic->id=$obj->rowid;
|
||||||
$salstatic->ref=$obj->rowid;
|
$salstatic->ref=$obj->rowid;
|
||||||
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
||||||
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
||||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||||
$total = $total + $obj->amount;
|
// Type
|
||||||
|
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
// Amount
|
||||||
|
print "<td align=\"right\">".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$total = $total + $obj->amount;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
|
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||||
print "<td align=\"right\"><b>".price($total)."</b></td></tr>";
|
print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td></tr>";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -32,6 +32,7 @@ $langs->load("bills");
|
|||||||
|
|
||||||
$id=GETPOST('id','int');
|
$id=GETPOST('id','int');
|
||||||
$action=GETPOST("action");
|
$action=GETPOST("action");
|
||||||
|
$confirm=GETPOST('confirm');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
@ -47,20 +48,16 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
|||||||
/* */
|
/* */
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
|
|
||||||
/*
|
// Classify paid
|
||||||
* Classify paid
|
if ($action == 'confirm_paid' && $confirm == 'yes')
|
||||||
*/
|
|
||||||
if ($action == 'confirm_paid' && $_REQUEST["confirm"] == 'yes')
|
|
||||||
{
|
{
|
||||||
$chargesociales = new ChargeSociales($db);
|
$chargesociales = new ChargeSociales($db);
|
||||||
$chargesociales->fetch($id);
|
$chargesociales->fetch($id);
|
||||||
$result = $chargesociales->set_paid($user);
|
$result = $chargesociales->set_paid($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Delete social contribution
|
||||||
* Delete social contribution
|
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||||
*/
|
|
||||||
if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
|
|
||||||
{
|
{
|
||||||
$chargesociales=new ChargeSociales($db);
|
$chargesociales=new ChargeSociales($db);
|
||||||
$chargesociales->fetch($id);
|
$chargesociales->fetch($id);
|
||||||
@ -77,10 +74,7 @@ if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
// Add social contribution
|
||||||
* Add social contribution
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($action == 'add' && $user->rights->tax->charges->creer)
|
if ($action == 'add' && $user->rights->tax->charges->creer)
|
||||||
{
|
{
|
||||||
$dateech=@dol_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]);
|
$dateech=@dol_mktime($_POST["echhour"],$_POST["echmin"],$_POST["echsec"],$_POST["echmonth"],$_POST["echday"],$_POST["echyear"]);
|
||||||
@ -226,7 +220,7 @@ if ($action == 'create')
|
|||||||
print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1);
|
print $form->select_date(! empty($dateperiod)?$dateperiod:'-1', 'period', 0, 0, 0, 'charge', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right"><input type="text" size="6" name="amount" class="flat"></td>';
|
print '<td align="right"><input type="text" size="6" name="amount" class="flat" value="'.GETPOST('amount').'"></td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print $form->select_date(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1);
|
print $form->select_date(! empty($dateech)?$dateech:'-1', 'ech', 0, 0, 0, 'charge', 1);
|
||||||
@ -303,8 +297,8 @@ if ($id > 0)
|
|||||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Paiements
|
* Paiements
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
||||||
$sql.= "c.libelle as paiement_type";
|
$sql.= "c.libelle as paiement_type";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
@ -325,7 +319,7 @@ if ($id > 0)
|
|||||||
echo '<table class="nobordernopadding" width="100%">';
|
echo '<table class="nobordernopadding" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Payments").'</td><td>'.$langs->trans("Type").'</td>';
|
print '<td>'.$langs->trans("Payments").'</td><td>'.$langs->trans("Type").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
print '<td align="right">'.$langs->trans("Amount").'</td><td> </td></tr>';
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
@ -336,7 +330,7 @@ if ($id > 0)
|
|||||||
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").'</a> ';
|
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").'</a> ';
|
||||||
print dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
print dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
|
||||||
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
|
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
|
||||||
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
print '<td align="right">'.price($objp->amount)."</td><td> ".$langs->trans("Currency".$conf->currency)."</td>\n";
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
$totalpaye += $objp->amount;
|
$totalpaye += $objp->amount;
|
||||||
$i++;
|
$i++;
|
||||||
@ -363,7 +357,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
// Period end date
|
// Period end date
|
||||||
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
||||||
print "<td>";
|
print "<td>";
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
@ -388,10 +382,10 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class ChargeSociales extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,28 +317,31 @@ class ChargeSociales extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retourne le libelle du statut d'une charge (impaye, payee)
|
* Retourne le libelle du statut d'une charge (impaye, payee)
|
||||||
*
|
*
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||||
* @return string Label
|
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||||
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function getLibStatut($mode=0)
|
function getLibStatut($mode=0,$alreadypayed=-1)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->paye,$mode);
|
return $this->LibStatut($this->paye,$mode,$alreadypayed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
* @param int $statut Id statut
|
* @param int $statut Id statut
|
||||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
* @return string Label
|
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||||
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function LibStatut($statut,$mode=0)
|
function LibStatut($statut,$mode=0,$alreadypayed=-1)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
$langs->load('customers');
|
$langs->load('customers');
|
||||||
|
$langs->load('bills');
|
||||||
|
|
||||||
if ($mode == 0)
|
if ($mode == 0)
|
||||||
{
|
{
|
||||||
if ($statut == 0) return $langs->trans("Unpaid");
|
if ($statut == 0) return $langs->trans("Unpaid");
|
||||||
@ -361,12 +364,14 @@ class ChargeSociales extends CommonObject
|
|||||||
}
|
}
|
||||||
if ($mode == 4)
|
if ($mode == 4)
|
||||||
{
|
{
|
||||||
if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
if ($statut == 0 && $alreadypayed <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid");
|
||||||
|
if ($statut == 0 && $alreadypayed > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted");
|
||||||
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid");
|
||||||
}
|
}
|
||||||
if ($mode == 5)
|
if ($mode == 5)
|
||||||
{
|
{
|
||||||
if ($statut == 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
if ($statut == 0 && $alreadypayed <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1');
|
||||||
|
if ($statut == 0 && $alreadypayed > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3');
|
||||||
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
@ -63,7 +63,7 @@ if (! $sortfield) $sortfield="name";
|
|||||||
|
|
||||||
|
|
||||||
$object = new ChargeSociales($db);
|
$object = new ChargeSociales($db);
|
||||||
$object->fetch($id);
|
if ($id > 0) $object->fetch($id);
|
||||||
|
|
||||||
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
$modulepart='tax';
|
$modulepart='tax';
|
||||||
@ -87,6 +87,8 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url);
|
|||||||
|
|
||||||
if ($object->id)
|
if ($object->id)
|
||||||
{
|
{
|
||||||
|
$alreadypayed=$object->getSommePaiement();
|
||||||
|
|
||||||
$head=tax_prepare_head($object, $user);
|
$head=tax_prepare_head($object, $user);
|
||||||
|
|
||||||
dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
|
dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
|
||||||
@ -149,10 +151,10 @@ if ($object->id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("AmountTTC").'</td><td>'.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4,$alreadypayed).'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -78,12 +78,14 @@ llxHeader();
|
|||||||
|
|
||||||
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
|
$sql = "SELECT cs.rowid as id, cs.fk_type as type, ";
|
||||||
$sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
|
$sql.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
|
||||||
$sql.= " c.libelle as type_lib";
|
$sql.= " c.libelle as type_lib,";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
$sql.= " SUM(pc.amount) as alreadypayed";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
||||||
$sql.= " WHERE cs.fk_type = c.id";
|
$sql.= " WHERE cs.fk_type = c.id";
|
||||||
$sql.= " AND cs.entity = ".$conf->entity;
|
$sql.= " AND cs.entity = ".$conf->entity;
|
||||||
if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".GETPOST("search_label")."%'";
|
if (GETPOST("search_label")) $sql.=" AND cs.libelle LIKE '%".$db->escape(GETPOST("search_label"))."%'";
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
{
|
{
|
||||||
$sql .= " AND (";
|
$sql .= " AND (";
|
||||||
@ -100,6 +102,7 @@ if ($filtre) {
|
|||||||
if ($typeid) {
|
if ($typeid) {
|
||||||
$sql .= " AND cs.fk_type=".$typeid;
|
$sql .= " AND cs.fk_type=".$typeid;
|
||||||
}
|
}
|
||||||
|
$sql.= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle";
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit+1,$offset);
|
$sql.= $db->plimit($limit+1,$offset);
|
||||||
|
|
||||||
@ -207,7 +210,7 @@ if ($resql)
|
|||||||
// Due date
|
// Due date
|
||||||
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
print '<td width="110" align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||||
|
|
||||||
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5).'</a></td>';
|
print '<td align="right" class="nowrap">'.$chargesociale_static->LibStatut($obj->paye,5,$obj->alreadypayed).'</a></td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -72,8 +72,10 @@ class box_ficheinter extends ModeleBoxes
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
|
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid ";
|
$sql.= " WHERE f.fk_soc = s.rowid ";
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
if (! $user->rights->societe->client->voir)
|
if (! $user->rights->societe->client->voir && !$user->societe_id)
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||||
|
|
||||||
$sql.= " ORDER BY f.tms DESC";
|
$sql.= " ORDER BY f.tms DESC";
|
||||||
$sql.= $db->plimit($max, 0);
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
|||||||
@ -674,6 +674,7 @@ class ExtraFields
|
|||||||
$out = '';
|
$out = '';
|
||||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||||
{
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,6 +694,7 @@ class ExtraFields
|
|||||||
$out = '';
|
$out = '';
|
||||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||||
{
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
$out.= ajax_combobox('options_'.$key.$keyprefix, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -732,9 +732,9 @@ class Form
|
|||||||
* @return string HTML string with
|
* @return string HTML string with
|
||||||
* @deprecated Use select_thirdparty instead
|
* @deprecated Use select_thirdparty instead
|
||||||
*/
|
*/
|
||||||
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array())
|
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0)
|
||||||
{
|
{
|
||||||
return $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events);
|
return $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -752,7 +752,7 @@ class Form
|
|||||||
* @param int $limit Limit number of answers
|
* @param int $limit Limit number of answers
|
||||||
* @return string HTML string with
|
* @return string HTML string with
|
||||||
*/
|
*/
|
||||||
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=20)
|
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@ -774,33 +774,33 @@ class Form
|
|||||||
$sql.=" AND (";
|
$sql.=" AND (";
|
||||||
if (! empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index
|
if (! empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index
|
||||||
{
|
{
|
||||||
$sql.="(s.name LIKE '".$filterkey."%'";
|
$sql.="(s.name LIKE '".$this->db->escape($filterkey)."%')";
|
||||||
$sql.=")";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// For natural search
|
// For natural search
|
||||||
$scrit = explode(' ', $filterkey);
|
$scrit = explode(' ', $filterkey);
|
||||||
foreach ($scrit as $crit) {
|
foreach ($scrit as $crit) {
|
||||||
$sql.=" AND (s.name LIKE '%".$crit."%'";
|
$sql.=" AND (s.name LIKE '%".$this->db->escape($crit)."%')";
|
||||||
$sql.=")";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! empty($conf->barcode->enabled))
|
if (! empty($conf->barcode->enabled))
|
||||||
{
|
{
|
||||||
$sql .= " OR s.barcode LIKE '".$filterkey."'";
|
$sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'";
|
||||||
}
|
}
|
||||||
$sql.=")";
|
$sql.=")";
|
||||||
}
|
}
|
||||||
$sql.= " ORDER BY nom ASC";
|
$sql.=$this->db->order("nom","ASC");
|
||||||
|
if ($limit > 0) $sql.=$this->db->plimit($limit);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::select_thirdparty_list sql=".$sql);
|
dol_syslog(get_class($this)."::select_thirdparty_list sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
|
||||||
{
|
{
|
||||||
$out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
|
$out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct $out and $outarray
|
// Construct $out and $outarray
|
||||||
|
|||||||
@ -1162,7 +1162,7 @@ function dol_print_url($url,$target='_blank',$max=32)
|
|||||||
* @param string $email EMail to show (only email, without 'Name of recipient' before)
|
* @param string $email EMail to show (only email, without 'Name of recipient' before)
|
||||||
* @param int $cid Id of contact if known
|
* @param int $cid Id of contact if known
|
||||||
* @param int $socid Id of third party if known
|
* @param int $socid Id of third party if known
|
||||||
* @param int $addlink 0=no link to create action
|
* @param int $addlink 0=no link, 1=email has a html email link (+ link to create action if constant AGENDA_ADDACTIONFOREMAIL is on)
|
||||||
* @param int $max Max number of characters to show
|
* @param int $max Max number of characters to show
|
||||||
* @param int $showinvalid Show warning if syntax email is wrong
|
* @param int $showinvalid Show warning if syntax email is wrong
|
||||||
* @return string HTML Link
|
* @return string HTML Link
|
||||||
|
|||||||
@ -342,12 +342,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($lines[$i]->date_start,'day');
|
print dol_print_date($lines[$i]->date_start,'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Date end
|
// Date end
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($lines[$i]->date_end,'day');
|
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Planned Workload (in working hours)
|
// Planned Workload (in working hours)
|
||||||
@ -500,12 +500,12 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($lines[$i]->date_start,'day');
|
print dol_print_date($lines[$i]->date_start,'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Date end
|
// Date end
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print dol_print_date($lines[$i]->date_end,'day');
|
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Planned Workload
|
// Planned Workload
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -76,7 +76,7 @@ class modOpenSurvey extends DolibarrModules
|
|||||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||||
$this->phpmin = array(4,1); // Minimum version of PHP required by module
|
$this->phpmin = array(4,1); // Minimum version of PHP required by module
|
||||||
$this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module
|
$this->need_dolibarr_version = array(3,4,0); // Minimum version of Dolibarr required by module
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
$this->const = array(); // List of parameters
|
$this->const = array(); // List of parameters
|
||||||
@ -121,7 +121,7 @@ class modOpenSurvey extends DolibarrModules
|
|||||||
// Main menu entries
|
// Main menu entries
|
||||||
$this->menus = array(); // List of menus to add
|
$this->menus = array(); // List of menus to add
|
||||||
$r=0;
|
$r=0;
|
||||||
|
/*
|
||||||
$this->menu[$r]=array( 'fk_menu'=>0, // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
$this->menu[$r]=array( 'fk_menu'=>0, // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
'type'=>'top',
|
'type'=>'top',
|
||||||
'titre'=>'Surveys',
|
'titre'=>'Surveys',
|
||||||
@ -133,14 +133,14 @@ class modOpenSurvey extends DolibarrModules
|
|||||||
'perms'=>'$user->rights->opensurvey->read',
|
'perms'=>'$user->rights->opensurvey->read',
|
||||||
'target'=>'',
|
'target'=>'',
|
||||||
'user'=>0);
|
'user'=>0);
|
||||||
$r++;
|
$r++;*/
|
||||||
|
|
||||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'Survey',
|
'titre'=>'Survey',
|
||||||
'mainmenu'=>'opensurvey',
|
'mainmenu'=>'tools',
|
||||||
'leftmenu'=>'opensurvey',
|
'leftmenu'=>'opensurvey',
|
||||||
'url'=>'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey',
|
'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
|
||||||
'langs'=>'opensurvey',
|
'langs'=>'opensurvey',
|
||||||
'position'=>200,
|
'position'=>200,
|
||||||
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
|
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
|
||||||
@ -149,10 +149,10 @@ class modOpenSurvey extends DolibarrModules
|
|||||||
'user'=>0);
|
'user'=>0);
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'NewSurvey',
|
'titre'=>'NewSurvey',
|
||||||
'mainmenu'=>'opensurvey',
|
'mainmenu'=>'tools',
|
||||||
'leftmenu'=>'opensurvey_new',
|
'leftmenu'=>'opensurvey_new',
|
||||||
'url'=>'/opensurvey/wizard/index.php',
|
'url'=>'/opensurvey/wizard/index.php',
|
||||||
'langs'=>'opensurvey',
|
'langs'=>'opensurvey',
|
||||||
@ -163,10 +163,10 @@ class modOpenSurvey extends DolibarrModules
|
|||||||
'user'=>0);
|
'user'=>0);
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=opensurvey,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools,fk_leftmenu=opensurvey', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
'type'=>'left',
|
'type'=>'left',
|
||||||
'titre'=>'List',
|
'titre'=>'List',
|
||||||
'mainmenu'=>'opensurvey',
|
'mainmenu'=>'tools',
|
||||||
'leftmenu'=>'opensurvey_list',
|
'leftmenu'=>'opensurvey_list',
|
||||||
'url'=>'/opensurvey/list.php',
|
'url'=>'/opensurvey/list.php',
|
||||||
'langs'=>'opensurvey',
|
'langs'=>'opensurvey',
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file expedtion/class/productbatch.class.php
|
* \file expedition/class/productbatch.class.php
|
||||||
* \ingroup productbatch
|
* \ingroup productbatch
|
||||||
* \brief This file implements CRUD method for managing product's shipment
|
* \brief This file implements CRUD method for managing product's shipment
|
||||||
* with batch record
|
* with batch record
|
||||||
|
|||||||
@ -856,7 +856,7 @@ if ($action == 'create')
|
|||||||
if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;
|
if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) {
|
if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() and is_array($product->stock_warehouse[GETPOST('entrepot_id','int')] ))) {
|
||||||
// Quantity to send
|
// Quantity to send
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
@ -897,27 +897,27 @@ if ($action == 'create')
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Show subproducts of product
|
// Show subproducts of product
|
||||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0)
|
if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0)
|
||||||
{
|
{
|
||||||
$product->get_sousproduits_arbo();
|
$product->get_sousproduits_arbo();
|
||||||
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
|
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
|
||||||
if(count($prods_arbo) > 0)
|
if(count($prods_arbo) > 0)
|
||||||
{
|
{
|
||||||
foreach($prods_arbo as $key => $value)
|
foreach($prods_arbo as $key => $value)
|
||||||
{
|
{
|
||||||
//print $value[0];
|
//print $value[0];
|
||||||
$img='';
|
$img='';
|
||||||
if ($value['stock'] < $value['stock_alert'])
|
if ($value['stock'] < $value['stock_alert'])
|
||||||
{
|
{
|
||||||
$img=img_warning($langs->trans("StockTooLow"));
|
$img=img_warning($langs->trans("StockTooLow"));
|
||||||
}
|
}
|
||||||
print "<tr ".$bc[$var]."><td> ->
|
print "<tr ".$bc[$var]."><td> ->
|
||||||
<a href=\"".DOL_URL_ROOT."/product/fiche.php?id=".$value['id']."\">".$value['fullpath']."
|
<a href=\"".DOL_URL_ROOT."/product/fiche.php?id=".$value['id']."\">".$value['fullpath']."
|
||||||
</a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td> </td><td> </td>
|
</a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td> </td><td> </td>
|
||||||
<td align=\"center\">".$value['stock']." ".$img."</td></tr>";
|
<td align=\"center\">".$value['stock']." ".$img."</td></tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<td></td><td></td></tr>';
|
print '<td></td><td></td></tr>';
|
||||||
$subj=0;
|
$subj=0;
|
||||||
|
|||||||
@ -24,10 +24,6 @@
|
|||||||
* \brief Note card expedition
|
* \brief Note card expedition
|
||||||
*/
|
*/
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
ini_set('display_errors', true);
|
|
||||||
ini_set('html_errors', false);
|
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
|
||||||
|
|||||||
@ -28,10 +28,6 @@
|
|||||||
* \brief Page for supplier invoice card (view, edit, validate)
|
* \brief Page for supplier invoice card (view, edit, validate)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
ini_set('display_errors', true);
|
|
||||||
ini_set('html_errors', false);
|
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||||
|
|||||||
@ -1056,6 +1056,7 @@ CREATE TABLE llx_expeditiondet_batch (
|
|||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
--Salary payment in tax module
|
--Salary payment in tax module
|
||||||
|
--DROP TABLE llx_payment_salary
|
||||||
CREATE TABLE llx_payment_salary (
|
CREATE TABLE llx_payment_salary (
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
@ -1063,6 +1064,8 @@ CREATE TABLE llx_payment_salary (
|
|||||||
datep date,
|
datep date,
|
||||||
datev date,
|
datev date,
|
||||||
amount real NOT NULL DEFAULT 0,
|
amount real NOT NULL DEFAULT 0,
|
||||||
|
fk_typepayment integer NOT NULL,
|
||||||
|
num_payment varchar(50),
|
||||||
label varchar(255),
|
label varchar(255),
|
||||||
datesp date, -- date de début de la période
|
datesp date, -- date de début de la période
|
||||||
dateep date, -- date de fin de la période
|
dateep date, -- date de fin de la période
|
||||||
@ -1103,3 +1106,5 @@ ALTER TABLE llx_societe ADD INDEX idx_societe_barcode (barcode);
|
|||||||
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_barcode (barcode, fk_barcode_type, entity);
|
ALTER TABLE llx_societe ADD UNIQUE INDEX uk_societe_barcode (barcode, fk_barcode_type, entity);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_tva ADD COLUMN fk_typepayment integer NULL; -- table may already contains data
|
||||||
|
ALTER TABLE llx_tva ADD COLUMN num_payment varchar(50);
|
||||||
|
|||||||
@ -24,6 +24,8 @@ create table llx_payment_salary
|
|||||||
datep date, -- date de paiement
|
datep date, -- date de paiement
|
||||||
datev date, -- date de valeur
|
datev date, -- date de valeur
|
||||||
amount real NOT NULL DEFAULT 0,
|
amount real NOT NULL DEFAULT 0,
|
||||||
|
fk_typepayment integer NOT NULL,
|
||||||
|
num_payment varchar(50),
|
||||||
label varchar(255),
|
label varchar(255),
|
||||||
datesp date, -- date de début de la période
|
datesp date, -- date de début de la période
|
||||||
dateep date, -- date de fin de la période
|
dateep date, -- date de fin de la période
|
||||||
|
|||||||
@ -29,4 +29,6 @@ create table llx_stock_mouvement
|
|||||||
type_mouvement smallint,
|
type_mouvement smallint,
|
||||||
fk_user_author integer,
|
fk_user_author integer,
|
||||||
label varchar(128)
|
label varchar(128)
|
||||||
|
fk_origin integer,
|
||||||
|
origintype varchar(32)
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -24,6 +24,8 @@ create table llx_tva
|
|||||||
datep date, -- date de paiement
|
datep date, -- date de paiement
|
||||||
datev date, -- date de valeur
|
datev date, -- date de valeur
|
||||||
amount real NOT NULL DEFAULT 0,
|
amount real NOT NULL DEFAULT 0,
|
||||||
|
fk_typepayment integer NULL,
|
||||||
|
num_payment varchar(50),
|
||||||
label varchar(255),
|
label varchar(255),
|
||||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||||
note text,
|
note text,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
# Dolibarr language file - fr_BE - main
|
# Dolibarr language file - fr_BE - main
|
||||||
SeparatorDecimal=,
|
SeparatorDecimal=,
|
||||||
SeparatorThousand=None
|
SeparatorThousand=
|
||||||
FormatDateShort=%d/%m/%Y
|
FormatDateShort=%d/%m/%Y
|
||||||
FormatDateShortInput=%d/%m/%Y
|
FormatDateShortInput=%d/%m/%Y
|
||||||
FormatDateShortJava=dd/MM/yyyy
|
FormatDateShortJava=dd/MM/yyyy
|
||||||
|
|||||||
@ -243,7 +243,7 @@ if (!$object->fk_user_creat) {
|
|||||||
{
|
{
|
||||||
print '<input type="text" name="nouvelleadresse" size="40" value="'.$object->mail_admin.'">';
|
print '<input type="text" name="nouvelleadresse" size="40" value="'.$object->mail_admin.'">';
|
||||||
}
|
}
|
||||||
else print dol_print_email($object->mail_admin);
|
else print dol_print_email($object->mail_admin, 0, 0, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,6 +382,8 @@ if ($object->allow_comments) {
|
|||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
llxFooterSurvey();
|
llxFooterSurvey();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -745,7 +745,7 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="fiche.php" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
|
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
|
||||||
@ -784,8 +784,9 @@ else
|
|||||||
print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy'));
|
print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// batch number management
|
// Batch number management
|
||||||
if ($conf->productbatch->enabled) {
|
if ($conf->productbatch->enabled)
|
||||||
|
{
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Batch").')</td><td colspan="3">';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Batch").')</td><td colspan="3">';
|
||||||
$statutarray=array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
|
$statutarray=array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"));
|
||||||
print $form->selectarray('status_batch',$statutarray,GETPOST('status_batch'));
|
print $form->selectarray('status_batch',$statutarray,GETPOST('status_batch'));
|
||||||
@ -891,14 +892,17 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Customs code
|
// Custom code
|
||||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.GETPOST('customcode').'"></td>';
|
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
||||||
// Origin country
|
{
|
||||||
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.GETPOST('customcode').'"></td>';
|
||||||
print $form->select_country(GETPOST('country_id','int'),'country_id');
|
// Origin country
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||||
print '</td></tr>';
|
print $form->select_country(GETPOST('country_id','int'),'country_id');
|
||||||
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => 3);
|
$parameters=array('colspan' => 3);
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
@ -1156,14 +1160,17 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Customs code
|
// Custom code
|
||||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$object->customcode.'"></td>';
|
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
||||||
// Origin country
|
{
|
||||||
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$object->customcode.'"></td>';
|
||||||
print $form->select_country($object->country_id,'country_id');
|
// Origin country
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||||
print '</td></tr>';
|
print $form->select_country($object->country_id,'country_id');
|
||||||
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="2"');
|
$parameters=array('colspan' => ' colspan="2"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
@ -1236,10 +1243,11 @@ else
|
|||||||
// Label
|
// Label
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->libelle.'</td>';
|
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->libelle.'</td>';
|
||||||
|
|
||||||
$nblignes=8;
|
$nblignes=7;
|
||||||
if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) $nblignes++;
|
if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) $nblignes++;
|
||||||
if ($showbarcode) $nblignes+=2;
|
if ($showbarcode) $nblignes+=2;
|
||||||
if ($object->type!=1) $nblignes++;
|
if ($object->type!=1) $nblignes++;
|
||||||
|
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) $nblignes+=2;
|
||||||
if ($object->isservice()) $nblignes++;
|
if ($object->isservice()) $nblignes++;
|
||||||
else $nblignes+=4;
|
else $nblignes+=4;
|
||||||
|
|
||||||
@ -1425,12 +1433,15 @@ else
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Customs code
|
// Custom code
|
||||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$object->customcode.'</td>';
|
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
||||||
|
{
|
||||||
// Origin country code
|
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$object->customcode.'</td>';
|
||||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>';
|
|
||||||
|
// Origin country code
|
||||||
|
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'"');
|
$parameters=array('colspan' => ' colspan="'.(2+(($showphoto||$showbarcode)?1:0)).'"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
|||||||
@ -537,8 +537,8 @@ if ($resql)
|
|||||||
$productidselected=$key;
|
$productidselected=$key;
|
||||||
$productlabelselected=$val;
|
$productlabelselected=$val;
|
||||||
}
|
}
|
||||||
$datebefore=dol_get_first_day($year, $month?$month:1, true);
|
$datebefore=dol_get_first_day($year?$year:strftime("%Y",time()), $month?$month:1, true);
|
||||||
$dateafter=dol_get_last_day($year, $month?$month:12, true);
|
$dateafter=dol_get_last_day($year?$year:strftime("%Y",time()), $month?$month:12, true);
|
||||||
$balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore);
|
$balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore);
|
||||||
$balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter);
|
$balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter);
|
||||||
|
|
||||||
|
|||||||
@ -83,8 +83,8 @@ if ($action == 'createtask' && $user->rights->projet->creer)
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$date_start = dol_mktime(0,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']);
|
$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyeassskr'],'user');
|
||||||
$date_end = dol_mktime(0,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']);
|
$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
|
||||||
|
|
||||||
if (empty($_POST["cancel"]))
|
if (empty($_POST["cancel"]))
|
||||||
{
|
{
|
||||||
@ -232,12 +232,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||||
print dol_print_date($object->date_start,'day');
|
print dol_print_date($object->date_start,'dayhour');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date end
|
// Date end
|
||||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||||
print dol_print_date($object->date_end,'day');
|
print dol_print_date($object->date_end,'dayhour');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Other options
|
// Other options
|
||||||
@ -302,12 +302,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||||
print $form->select_date(($date_start?$date_start:''),'dateo',0,0,0,'',1,1);
|
print $form->select_date(($date_start?$date_start:''),'dateo',1,1,0,'',1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date end
|
// Date end
|
||||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||||
print $form->select_date(($date_end?$date_end:-1),'datee',0,0,0,'',1,1);
|
print $form->select_date(($date_end?$date_end:-1),'datee',1,1,0,'',1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// planned workload
|
// planned workload
|
||||||
|
|||||||
@ -23,10 +23,6 @@
|
|||||||
* \brief Page of a project task
|
* \brief Page of a project task
|
||||||
*/
|
*/
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
ini_set('display_errors', true);
|
|
||||||
ini_set('html_errors', false);
|
|
||||||
|
|
||||||
require ("../../main.inc.php");
|
require ("../../main.inc.php");
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
@ -87,8 +83,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
|
|||||||
$object->description = $_POST['description'];
|
$object->description = $_POST['description'];
|
||||||
$object->fk_task_parent = $task_parent;
|
$object->fk_task_parent = $task_parent;
|
||||||
$object->planned_workload = $planned_workload;
|
$object->planned_workload = $planned_workload;
|
||||||
$object->date_start = dol_mktime(0,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']);
|
$object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user');
|
||||||
$object->date_end = dol_mktime(0,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']);
|
$object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
|
||||||
$object->progress = $_POST['progress'];
|
$object->progress = $_POST['progress'];
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
@ -326,12 +322,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||||
print $form->select_date($object->date_start,'dateo');
|
print $form->select_date($object->date_start,'dateo',1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date end
|
// Date end
|
||||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||||
print $form->select_date($object->date_end?$object->date_end:-1,'datee');
|
print $form->select_date($object->date_end?$object->date_end:-1,'datee',1,1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Planned workload
|
// Planned workload
|
||||||
@ -415,12 +411,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
|
||||||
print dol_print_date($object->date_start,'day');
|
print dol_print_date($object->date_start,'dayhour');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date end
|
// Date end
|
||||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
|
||||||
print dol_print_date($object->date_end,'day');
|
print dol_print_date($object->date_end,'dayhour');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Planned workload
|
// Planned workload
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user