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("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("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 "</tr>\n";
|
||||
|
||||
$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.= " 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.= " ".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."c_paiement as pct ON pc.fk_typepaiement = pct.id";
|
||||
$sql.= " WHERE cs.fk_type = c.id";
|
||||
$sql.= " AND cs.entity = ".$conf->entity;
|
||||
if ($year > 0)
|
||||
@ -241,19 +244,27 @@ if ($conf->tax->enabled)
|
||||
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
|
||||
// Date payment
|
||||
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
|
||||
print '<td align="right">'.price($obj->totalpaye).'</td>';
|
||||
print '<td align="right">';
|
||||
if ($obj->totalpaye) print price($obj->totalpaye);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$total = $total + $obj->total;
|
||||
$totalnb = $totalnb + $obj->nb;
|
||||
$totalpaye = $totalpaye + $obj->totalpaye;
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($totalpaye)."</td>";
|
||||
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right" class="liste_total">'.price($total)."</td>";
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="right" class="liste_total">'.price($totalpaye)."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
else
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/compta/deplacement/stats/index.php
|
||||
* \ingroup deplacement
|
||||
* \brief Page des stats deplacement et notes de frais
|
||||
* \brief Page for statistics of module trips and expenses
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
|
||||
@ -336,7 +336,8 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
|
||||
}
|
||||
|
||||
// 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');
|
||||
|
||||
$object->fetch($id);
|
||||
@ -345,8 +346,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
||||
// Check parameters
|
||||
|
||||
// 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 = 'idprof' . $i;
|
||||
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);
|
||||
if ($result >= 0) {
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$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);
|
||||
}
|
||||
} 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();
|
||||
|
||||
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_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("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.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
@ -197,8 +197,8 @@ if ($_GET["action"] == 'create')
|
||||
$sumpaid = $obj->total;
|
||||
$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 valign=\"top\">".$langs->trans("RemainderToPay")."</td><td colspan=\"3\"><b>".price($total - $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\">".price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
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
|
||||
print '</td></tr>';
|
||||
|
||||
// Number
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
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
|
||||
@ -238,7 +239,7 @@ if ($_GET["action"] == 'create')
|
||||
print '<tr class="liste_titre">';
|
||||
//print '<td>'.$langs->trans("SocialContribution").'</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("RemainderToPay").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Amount").'</td>';
|
||||
@ -296,7 +297,7 @@ if ($_GET["action"] == 'create')
|
||||
{
|
||||
// Print total
|
||||
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($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 "</table></td></tr>\n";
|
||||
// }
|
||||
// $db->free();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// print $sql ."<br>".$db->error();
|
||||
// }
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br><center>';
|
||||
//print '<tr><td colspan="3" align="center">';
|
||||
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
print '</center>';
|
||||
//print '</td></tr>';
|
||||
|
||||
print "</form>\n";
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
@ -37,13 +37,19 @@ $langs->load('banks');
|
||||
$langs->load('companies');
|
||||
|
||||
// Security check
|
||||
$id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
|
||||
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
||||
$id=GETPOST("id");
|
||||
$action=GETPOST("action");
|
||||
$confirm=GETPOST('confirm');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
// TODO ajouter regle pour restreindre acces paiement
|
||||
//$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
|
||||
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();
|
||||
|
||||
$paiement = new PaymentSocialContribution($db);
|
||||
$paiement->fetch($_REQUEST['id']);
|
||||
$result = $paiement->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -66,19 +70,19 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
setEventMessage($paiement->error, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
$paiement = new PaymentSocialContribution($db);
|
||||
$paiement->id = $_REQUEST['id'];
|
||||
if ($paiement->valide() > 0)
|
||||
$result=$paiement->valide();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
@ -102,7 +106,7 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
||||
setEventMessage($paiement->error);
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
@ -115,14 +119,6 @@ if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' &&
|
||||
llxHeader();
|
||||
|
||||
$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);
|
||||
|
||||
@ -144,7 +140,7 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0,
|
||||
/*
|
||||
* 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);
|
||||
|
||||
@ -153,7 +149,7 @@ if ($_GET['action'] == 'delete')
|
||||
/*
|
||||
* Confirmation de la validation du paiement
|
||||
*/
|
||||
if ($_GET['action'] == 'valide')
|
||||
if ($action == 'valide')
|
||||
{
|
||||
$facid = $_GET['facid'];
|
||||
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%">';
|
||||
|
||||
// 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>';
|
||||
|
||||
// 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
|
||||
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
|
||||
print '<td align="right">'.price($objp->sc_amount).'</td>';
|
||||
// Status
|
||||
print '<td align="center">'.$socialcontrib->getLibStatut(4).'</td>';
|
||||
print '<td align="center">'.$socialcontrib->getLibStatut(4,$objp->amount).'</td>';
|
||||
// Amount payed
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
print "</tr>\n";
|
||||
@ -323,7 +315,8 @@ if ($_GET['action'] == '')
|
||||
print '</div>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/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
|
||||
{
|
||||
//public $element='payment_salary'; //!< Id that identify managed objects
|
||||
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
var $id;
|
||||
var $ref;
|
||||
|
||||
var $tms;
|
||||
var $fk_user;
|
||||
var $datep;
|
||||
var $datep;
|
||||
var $datev;
|
||||
var $amount;
|
||||
var $type_payment;
|
||||
var $num_payment;
|
||||
var $label;
|
||||
var $datesp;
|
||||
var $dateep;
|
||||
var $datesp;
|
||||
var $dateep;
|
||||
var $note;
|
||||
var $fk_bank;
|
||||
var $fk_user_creat;
|
||||
var $fk_user_modif;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->element = 'payment_salary';
|
||||
$this->table_element = 'payment_salary';
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->element = 'payment_salary';
|
||||
$this->table_element = 'payment_salary';
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
$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
|
||||
$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;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary(";
|
||||
$sql.= "tms,";
|
||||
$sql.= "fk_user,";
|
||||
$sql.= "datep,";
|
||||
$sql.= "datev,";
|
||||
$sql.= "amount,";
|
||||
$sql.= "label,";
|
||||
$sql.= "datesp,";
|
||||
$sql.= "dateep,";
|
||||
$sql.= "note,";
|
||||
$sql.= "fk_bank,";
|
||||
$sql.= "fk_user_creat,";
|
||||
$sql.= "fk_user_modif";
|
||||
$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.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||
$sql.= " num_payment='".$this->num_payment."',";
|
||||
$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 > 0 ? "'".$this->fk_bank."'":"null").",";
|
||||
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
|
||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$sql.= " '".$this->db->idate($this->tms).",";
|
||||
$sql.= " '".$this->fk_user."',";
|
||||
$sql.= " '".$this->db->idate($this->datep)."',";
|
||||
$sql.= " '".$this->db->idate($this->datev)."',";
|
||||
$sql.= " '".$this->amount."',";
|
||||
$sql.= " '".$this->label."',";
|
||||
$sql.= " '".$this->db->idate($this->datesp)."',";
|
||||
$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;
|
||||
}
|
||||
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)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
}
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id id object
|
||||
* @param User $user User that load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $user=0)
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " s.rowid,";
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id id object
|
||||
* @param User $user User that load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $user=0)
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " s.rowid,";
|
||||
|
||||
$sql.= " s.tms,";
|
||||
$sql.= " s.fk_user,";
|
||||
$sql.= " s.datep,";
|
||||
$sql.= " s.datev,";
|
||||
$sql.= " s.amount,";
|
||||
$sql.= " s.label,";
|
||||
$sql.= " s.datesp,";
|
||||
$sql.= " s.dateep,";
|
||||
$sql.= " s.note,";
|
||||
$sql.= " s.fk_bank,";
|
||||
$sql.= " s.fk_user_creat,";
|
||||
$sql.= " s.fk_user_modif,";
|
||||
$sql.= " b.fk_account,";
|
||||
$sql.= " b.fk_type,";
|
||||
$sql.= " b.rappro";
|
||||
$sql.= " s.tms,";
|
||||
$sql.= " s.fk_user,";
|
||||
$sql.= " s.datep,";
|
||||
$sql.= " s.datev,";
|
||||
$sql.= " s.amount,";
|
||||
$sql.= " s.fk_typepayment,";
|
||||
$sql.= " s.num_payment,";
|
||||
$sql.= " s.label,";
|
||||
$sql.= " s.datesp,";
|
||||
$sql.= " s.dateep,";
|
||||
$sql.= " s.note,";
|
||||
$sql.= " s.fk_bank,";
|
||||
$sql.= " s.fk_user_creat,";
|
||||
$sql.= " s.fk_user_modif,";
|
||||
$sql.= " b.fk_account,";
|
||||
$sql.= " b.fk_type,";
|
||||
$sql.= " b.rappro";
|
||||
|
||||
$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.= " WHERE s.rowid = ".$id;
|
||||
$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.= " WHERE s.rowid = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->datep = $this->db->jdate($obj->datep);
|
||||
$this->datev = $this->db->jdate($obj->datev);
|
||||
$this->amount = $obj->amount;
|
||||
$this->label = $obj->label;
|
||||
$this->datesp = $this->db->jdate($obj->datesp);
|
||||
$this->dateep = $this->db->jdate($obj->dateep);
|
||||
$this->note = $obj->note;
|
||||
$this->fk_bank = $obj->fk_bank;
|
||||
$this->fk_user_creat = $obj->fk_user_creat;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->fk_type = $obj->fk_type;
|
||||
$this->rappro = $obj->rappro;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->fk_user = $obj->fk_user;
|
||||
$this->datep = $this->db->jdate($obj->datep);
|
||||
$this->datev = $this->db->jdate($obj->datev);
|
||||
$this->amount = $obj->amount;
|
||||
$this->type_payement = $obj->fk_typepayment;
|
||||
$this->num_payment = $obj->num_payment;
|
||||
$this->label = $obj->label;
|
||||
$this->datesp = $this->db->jdate($obj->datesp);
|
||||
$this->dateep = $this->db->jdate($obj->dateep);
|
||||
$this->note = $obj->note;
|
||||
$this->fk_bank = $obj->fk_bank;
|
||||
$this->fk_user_creat = $obj->fk_user_creat;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->fk_account = $obj->fk_account;
|
||||
$this->fk_type = $obj->fk_type;
|
||||
$this->rappro = $obj->rappro;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that delete
|
||||
* @param User $user User that delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user)
|
||||
@ -301,32 +230,34 @@ class PaymentSalary extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
|
||||
$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);
|
||||
if (! $resql)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
@ -334,7 +265,7 @@ class PaymentSalary extends CommonObject
|
||||
|
||||
$this->tms='';
|
||||
$this->fk_user='';
|
||||
$this->datep='';
|
||||
$this->datep='';
|
||||
$this->datev='';
|
||||
$this->amount='';
|
||||
$this->label='';
|
||||
@ -346,192 +277,198 @@ class PaymentSalary extends CommonObject
|
||||
$this->fk_user_modif='';
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajoute un paiement de salaire
|
||||
*
|
||||
/**
|
||||
* Ajoute un paiement de salaire
|
||||
*
|
||||
* @param User $user Object user that insert
|
||||
* @return int <0 if KO, rowid in tva table if OK
|
||||
*/
|
||||
function addPayment($user)
|
||||
{
|
||||
global $conf,$langs;
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$this->db->begin();
|
||||
// Clean parameters
|
||||
$this->amount=price2num(trim($this->amount));
|
||||
|
||||
// Clean parameters
|
||||
$this->amount=price2num(trim($this->amount));
|
||||
// Check parameters
|
||||
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
|
||||
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;
|
||||
}
|
||||
$this->db->begin();
|
||||
|
||||
// Insertion dans table des paiement salaires
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user";
|
||||
$sql.= ", datep";
|
||||
$sql.= ", datev";
|
||||
$sql.= ", amount";
|
||||
if ($this->note) $sql.=", note";
|
||||
if ($this->label) $sql.=", label";
|
||||
$sql.= ", datesp";
|
||||
$sql.= ", dateep";
|
||||
$sql.= ", fk_user_creat";
|
||||
$sql.= ", fk_bank";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'".$this->fk_user."'";
|
||||
$sql.= ", '".$this->db->idate($this->datep)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||
$sql.= ", ".$this->amount;
|
||||
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
||||
if ($this->label) $sql.= ", '".$this->db->escape($this->label)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datesp)."'";
|
||||
$sql.= ", '".$this->db->idate($this->dateep)."'";
|
||||
$sql.= ", '".$user->id."'";
|
||||
$sql.= ", NULL";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
// Insertion dans table des paiement salaires
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user";
|
||||
$sql.= ", datep";
|
||||
$sql.= ", datev";
|
||||
$sql.= ", amount";
|
||||
$sql.= ", fk_typepayment";
|
||||
$sql.= ", num_payment";
|
||||
$sql.=", note";
|
||||
$sql.=", label";
|
||||
$sql.= ", datesp";
|
||||
$sql.= ", dateep";
|
||||
$sql.= ", fk_user_creat";
|
||||
$sql.= ", fk_bank";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'".$this->fk_user."'";
|
||||
$sql.= ", '".$this->db->idate($this->datep)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||
$sql.= ", ".$this->amount;
|
||||
$sql.= ", ".$this->type_payment;
|
||||
$sql.= ", ".$this->num_payment;
|
||||
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", '".$this->db->escape($this->label)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datesp)."'";
|
||||
$sql.= ", '".$this->db->idate($this->dateep)."'";
|
||||
$sql.= ", '".$user->id."'";
|
||||
$sql.= ", NULL";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::addPayment sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO devrait s'appeler payment_salary
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO devrait s'appeler 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_ADDPAYMENT',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
// 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
|
||||
|
||||
if ($this->id > 0)
|
||||
{
|
||||
$ok=1;
|
||||
if (! empty($conf->banque->enabled) && ! empty($this->amount))
|
||||
{
|
||||
// Insertion dans llx_bank
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if ($this->id > 0)
|
||||
{
|
||||
$ok=1;
|
||||
if (! empty($conf->banque->enabled) && ! empty($this->amount))
|
||||
{
|
||||
// Insertion dans llx_bank
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$acc = new Account($this->db);
|
||||
$result=$acc->fetch($this->accountid);
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
$acc = new Account($this->db);
|
||||
$result=$acc->fetch($this->accountid);
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
|
||||
// Insert payment into llx_bank
|
||||
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
||||
$bank_line_id = $acc->addline(
|
||||
$this->datep,
|
||||
$this->paymenttype,
|
||||
$this->label,
|
||||
-abs($this->amount),
|
||||
'',
|
||||
'',
|
||||
$user
|
||||
);
|
||||
// Insert payment into llx_bank
|
||||
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
||||
$bank_line_id = $acc->addline(
|
||||
$this->datep,
|
||||
$this->type_payment,
|
||||
$this->label,
|
||||
-abs($this->amount),
|
||||
$this->num_payment,
|
||||
'',
|
||||
$user
|
||||
);
|
||||
|
||||
// Mise a jour fk_bank dans llx_paiement.
|
||||
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
||||
if ($bank_line_id > 0)
|
||||
{
|
||||
$this->update_fk_bank($bank_line_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$acc->error;
|
||||
$ok=0;
|
||||
}
|
||||
// Mise a jour fk_bank dans llx_paiement.
|
||||
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
||||
if ($bank_line_id > 0)
|
||||
{
|
||||
$this->update_fk_bank($bank_line_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$acc->error;
|
||||
$ok=0;
|
||||
}
|
||||
|
||||
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
||||
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
|
||||
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
||||
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
|
||||
|
||||
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->error=$acc->error;
|
||||
$ok=0;
|
||||
}
|
||||
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->error=$acc->error;
|
||||
$ok=0;
|
||||
}
|
||||
|
||||
// Add link 'user' in bank_url between operation and bank transaction
|
||||
$linkaddedforthirdparty=array();
|
||||
foreach ($this->amounts as $key => $value)
|
||||
{
|
||||
$sal = new PaymentSalary($this->db);
|
||||
// Add link 'user' in bank_url between operation and bank transaction
|
||||
$linkaddedforthirdparty=array();
|
||||
foreach ($this->amounts as $key => $value)
|
||||
{
|
||||
$sal = new PaymentSalary($this->db);
|
||||
|
||||
$sal->fetch($key);
|
||||
$sal->fetch_user($this->fk_user);
|
||||
$sal->fetch($key);
|
||||
$sal->fetch_user($this->fk_user);
|
||||
|
||||
if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
|
||||
{
|
||||
$result=$acc->add_url_line(
|
||||
$bank_line_id,
|
||||
$sal->user->id,
|
||||
DOL_URL_ROOT.'/user/fiche.php?id=',
|
||||
$sal->user->lastname,
|
||||
'user'
|
||||
);
|
||||
if (! in_array($sal->user->id,$linkaddedforthirdparty)) // Not yet done for this thirdparty
|
||||
{
|
||||
$result=$acc->add_url_line(
|
||||
$bank_line_id,
|
||||
$sal->user->id,
|
||||
DOL_URL_ROOT.'/user/fiche.php?id=',
|
||||
$sal->user->lastname,
|
||||
'user'
|
||||
);
|
||||
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
$linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty
|
||||
}
|
||||
if ($result <= 0) dol_print_error($this->db);
|
||||
$linkaddedforthirdparty[$sal->user->id]=$sal->user->id; // Mark as done for this thirdparty
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ok)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if ($ok)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
/**
|
||||
* 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
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
*/
|
||||
function update_fk_bank($id_bank)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -17,7 +18,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/salaries/fiche.php
|
||||
* \ingroup tax
|
||||
* \ingroup salaries
|
||||
* \brief Page of salaries payments
|
||||
*/
|
||||
|
||||
@ -59,50 +60,73 @@ if ($_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"]);
|
||||
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
|
||||
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
|
||||
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
|
||||
$datev=dol_mktime(12,0,0, $_POST["datevmonth"], $_POST["datevday"], $_POST["datevyear"]);
|
||||
$datep=dol_mktime(12,0,0, $_POST["datepmonth"], $_POST["datepday"], $_POST["datepyear"]);
|
||||
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
|
||||
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
|
||||
|
||||
$sal->accountid=GETPOST("accountid");
|
||||
$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"];
|
||||
$sal->paymenttype=$_POST["paiementtype"];
|
||||
$sal->fk_user=$_POST["fk_user"];
|
||||
$sal->datev=$datev;
|
||||
$sal->datep=$datep;
|
||||
$sal->amount=$_POST["amount"];
|
||||
$sal->label=$_POST["label"];
|
||||
$sal->datesp=$datesp;
|
||||
$sal->dateep=$dateep;
|
||||
if (empty($sal->fk_user) || $sal->fk_user < 0)
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Employee")),'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($sal->type_payment) || $sal->type_payment < 0)
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($sal->amount))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")),'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
$ret=$sal->addPayment($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($sal->error, 'errors');
|
||||
$action="create";
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$ret=$sal->create($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($sal->error, 'errors');
|
||||
$action="create";
|
||||
}
|
||||
}
|
||||
|
||||
$action='create';
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$result=$sal->fetch($id);
|
||||
$result=$sal->fetch($id);
|
||||
|
||||
if ($sal->rappro == 0)
|
||||
{
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$ret=$sal->delete($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret=$sal->delete($user);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($sal->fk_bank)
|
||||
{
|
||||
$accountline=new AccountLine($db);
|
||||
@ -122,23 +146,23 @@ if ($action == 'delete')
|
||||
$db->rollback();
|
||||
setEventMessage($sal->error,'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($sal->error,'errors');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($sal->error,'errors');
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
||||
@ -146,7 +170,7 @@ $form = new Form($db);
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$salpayment = new PaymentSalary($db);
|
||||
$salpayment = new PaymentSalary($db);
|
||||
$result = $salpayment->fetch($id);
|
||||
if ($result <= 0)
|
||||
{
|
||||
@ -158,86 +182,93 @@ if ($id)
|
||||
// Formulaire saisie salaire
|
||||
if ($action == 'create')
|
||||
{
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
$pastmonth = strftime("%m",dol_now()) - 1;
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0)
|
||||
{
|
||||
$pastmonth = 12;
|
||||
$pastmonthyear--;
|
||||
}
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
$pastmonth = strftime("%m",dol_now()) - 1;
|
||||
$pastmonthyear = $year_current;
|
||||
if ($pastmonth == 0)
|
||||
{
|
||||
$pastmonth = 12;
|
||||
$pastmonthyear--;
|
||||
}
|
||||
|
||||
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
|
||||
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
|
||||
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
|
||||
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print "<form name='add' action=\"fiche.php\" method=\"post\">\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
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 '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
|
||||
print $form->select_date($datep,"datep",'','','','add');
|
||||
print '</td></tr>';
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
|
||||
print $form->select_date($datep,"datep",'','','','add');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
|
||||
print $form->select_date($datev,"datev",'','','','add');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("DateValue").'</td><td>';
|
||||
print $form->select_date($datev,"datev",'','','','add');
|
||||
print '</td></tr>';
|
||||
|
||||
// Employee
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Employee").'</td><td>';
|
||||
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
|
||||
print '</td></tr>';
|
||||
// Employee
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Employee").'</td><td>';
|
||||
print $form->select_dolusers(GETPOST('fk_user','int'),'fk_user',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// 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>';
|
||||
// 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>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
|
||||
print $form->select_date($datesp,"datesp",'','','','add');
|
||||
print '</td></tr>';
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
|
||||
print $form->select_date($datesp,"datesp",'','','','add');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("DateEndPeriod").'</td><td>';
|
||||
print $form->select_date($dateep,"dateep",'','','','add');
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("DateEndPeriod").'</td><td>';
|
||||
print $form->select_date($dateep,"dateep",'','','','add');
|
||||
print '</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.$_POST["amount"].'"></td></tr>';
|
||||
// Amount
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.GETPOST("amount").'"></td></tr>';
|
||||
|
||||
// Bank
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
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
|
||||
print '</td></tr>';
|
||||
// Bank
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
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
|
||||
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
|
||||
$parameters=array('colspan' => ' colspan="1"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
// TYpe payment
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$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 '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||
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 '</form>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
@ -265,17 +296,17 @@ if ($id)
|
||||
print $salpayment->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
// Person
|
||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||
$usersal=new User($db);
|
||||
$usersal->fetch($salpayment->fk_user);
|
||||
print $usersal->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
// Person
|
||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||
$usersal=new User($db);
|
||||
$usersal->fetch($salpayment->fk_user);
|
||||
print $usersal->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
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 dol_print_date($salpayment->datesp,'day');
|
||||
print '</td></tr>';
|
||||
@ -293,34 +324,34 @@ if ($id)
|
||||
print dol_print_date($salpayment->datev,'day');
|
||||
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 ($salpayment->fk_account > 0)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($salpayment->fk_bank);
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($salpayment->fk_bank);
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $bankline->getNomUrl(1,0,'showall');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $bankline->getNomUrl(1,0,'showall');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$salpayment,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Boutons d'actions
|
||||
* Boutons d'actions
|
||||
*/
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
if ($salpayment->rappro == 0)
|
||||
@ -342,7 +373,8 @@ if ($id)
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -17,8 +17,8 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/salaries/index.php
|
||||
* \ingroup tax
|
||||
* \brief List of salaries payments
|
||||
* \ingroup salaries
|
||||
* \brief List of salaries payments
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -26,6 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("salaries");
|
||||
$langs->load("bills");
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
@ -46,8 +47,11 @@ $userstatic = new User($db);
|
||||
|
||||
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.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
|
||||
$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.= " 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.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY dm DESC";
|
||||
@ -65,6 +69,7 @@ if ($result)
|
||||
print "<td>".$langs->trans("Person")."</td>";
|
||||
print "<td>".$langs->trans("Label")."</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 "</tr>\n";
|
||||
$var=1;
|
||||
@ -78,20 +83,23 @@ if ($result)
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$salstatic->id=$obj->rowid;
|
||||
$salstatic->ref=$obj->rowid;
|
||||
$salstatic->ref=$obj->rowid;
|
||||
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 align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||
// Amount
|
||||
print "<td align=\"right\">".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
|
||||
print "<td align=\"right\"><b>".price($total)."</b></td></tr>";
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -32,6 +32,7 @@ $langs->load("bills");
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$action=GETPOST("action");
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
@ -47,20 +48,16 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||
/* */
|
||||
/* *************************************************************************** */
|
||||
|
||||
/*
|
||||
* Classify paid
|
||||
*/
|
||||
if ($action == 'confirm_paid' && $_REQUEST["confirm"] == 'yes')
|
||||
// Classify paid
|
||||
if ($action == 'confirm_paid' && $confirm == 'yes')
|
||||
{
|
||||
$chargesociales = new ChargeSociales($db);
|
||||
$chargesociales->fetch($id);
|
||||
$result = $chargesociales->set_paid($user);
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete social contribution
|
||||
*/
|
||||
if ($action == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
|
||||
// Delete social contribution
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
$chargesociales=new ChargeSociales($db);
|
||||
$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)
|
||||
{
|
||||
$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 '</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 $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">';
|
||||
|
||||
/*
|
||||
* Paiements
|
||||
*/
|
||||
* Paiements
|
||||
*/
|
||||
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
|
||||
$sql.= "c.libelle as paiement_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
@ -325,7 +319,7 @@ if ($id > 0)
|
||||
echo '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
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;
|
||||
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 dol_print_date($db->jdate($objp->dp),'day')."</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>";
|
||||
$totalpaye += $objp->amount;
|
||||
$i++;
|
||||
@ -363,7 +357,7 @@ if ($id > 0)
|
||||
|
||||
print "</tr>";
|
||||
|
||||
// Period end date
|
||||
// Period end date
|
||||
print "<tr><td>".$langs->trans("PeriodEndDate")."</td>";
|
||||
print "<td>";
|
||||
if ($action == 'edit')
|
||||
@ -388,10 +382,10 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// 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
|
||||
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>';
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ class ChargeSociales extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
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
|
||||
* @return string Label
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @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 $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 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 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;
|
||||
$langs->load('customers');
|
||||
|
||||
$langs->load('bills');
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpaid");
|
||||
@ -361,12 +364,14 @@ class ChargeSociales extends CommonObject
|
||||
}
|
||||
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 ($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');
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
@ -63,7 +63,7 @@ if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$object = new ChargeSociales($db);
|
||||
$object->fetch($id);
|
||||
if ($id > 0) $object->fetch($id);
|
||||
|
||||
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$modulepart='tax';
|
||||
@ -87,6 +87,8 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$alreadypayed=$object->getSommePaiement();
|
||||
|
||||
$head=tax_prepare_head($object, $user);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill');
|
||||
@ -149,10 +151,10 @@ if ($object->id)
|
||||
}
|
||||
|
||||
// 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
|
||||
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("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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>
|
||||
*
|
||||
* 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.= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
|
||||
$sql.= " c.libelle as type_lib";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql.= " c.libelle as type_lib,";
|
||||
$sql.= " SUM(pc.amount) as alreadypayed";
|
||||
$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.= " 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)
|
||||
{
|
||||
$sql .= " AND (";
|
||||
@ -100,6 +102,7 @@ if ($filtre) {
|
||||
if ($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->plimit($limit+1,$offset);
|
||||
|
||||
@ -207,7 +210,7 @@ if ($resql)
|
||||
// Due date
|
||||
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>';
|
||||
$i++;
|
||||
|
||||
@ -72,8 +72,10 @@ class box_ficheinter extends ModeleBoxes
|
||||
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid ";
|
||||
$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;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
|
||||
$sql.= " ORDER BY f.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
|
||||
@ -674,6 +674,7 @@ class ExtraFields
|
||||
$out = '';
|
||||
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);
|
||||
}
|
||||
|
||||
@ -693,6 +694,7 @@ class ExtraFields
|
||||
$out = '';
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -732,9 +732,9 @@ class Form
|
||||
* @return string HTML string with
|
||||
* @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
|
||||
* @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;
|
||||
|
||||
@ -774,33 +774,33 @@ class Form
|
||||
$sql.=" AND (";
|
||||
if (! empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index
|
||||
{
|
||||
$sql.="(s.name LIKE '".$filterkey."%'";
|
||||
$sql.=")";
|
||||
$sql.="(s.name LIKE '".$this->db->escape($filterkey)."%')";
|
||||
}
|
||||
else
|
||||
{
|
||||
// For natural search
|
||||
$scrit = explode(' ', $filterkey);
|
||||
foreach ($scrit as $crit) {
|
||||
$sql.=" AND (s.name LIKE '%".$crit."%'";
|
||||
$sql.=")";
|
||||
$sql.=" AND (s.name LIKE '%".$this->db->escape($crit)."%')";
|
||||
}
|
||||
}
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
$sql .= " OR s.barcode LIKE '".$filterkey."'";
|
||||
$sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'";
|
||||
}
|
||||
$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);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
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
|
||||
|
||||
@ -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 int $cid Id of contact 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 $showinvalid Show warning if syntax email is wrong
|
||||
* @return string HTML Link
|
||||
|
||||
@ -342,12 +342,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
// Date start
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_start,'day');
|
||||
print dol_print_date($lines[$i]->date_start,'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Date end
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_end,'day');
|
||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Planned Workload (in working hours)
|
||||
@ -500,12 +500,12 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
|
||||
// Date start
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_start,'day');
|
||||
print dol_print_date($lines[$i]->date_start,'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Date end
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_end,'day');
|
||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Planned Workload
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -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->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->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
|
||||
$this->const = array(); // List of parameters
|
||||
@ -121,7 +121,7 @@ class modOpenSurvey extends DolibarrModules
|
||||
// Main menu entries
|
||||
$this->menus = array(); // List of menus to add
|
||||
$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
|
||||
'type'=>'top',
|
||||
'titre'=>'Surveys',
|
||||
@ -133,14 +133,14 @@ class modOpenSurvey extends DolibarrModules
|
||||
'perms'=>'$user->rights->opensurvey->read',
|
||||
'target'=>'',
|
||||
'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',
|
||||
'titre'=>'Survey',
|
||||
'mainmenu'=>'opensurvey',
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'opensurvey',
|
||||
'url'=>'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey',
|
||||
'url'=>'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey',
|
||||
'langs'=>'opensurvey',
|
||||
'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.
|
||||
@ -149,10 +149,10 @@ class modOpenSurvey extends DolibarrModules
|
||||
'user'=>0);
|
||||
$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',
|
||||
'titre'=>'NewSurvey',
|
||||
'mainmenu'=>'opensurvey',
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'opensurvey_new',
|
||||
'url'=>'/opensurvey/wizard/index.php',
|
||||
'langs'=>'opensurvey',
|
||||
@ -163,10 +163,10 @@ class modOpenSurvey extends DolibarrModules
|
||||
'user'=>0);
|
||||
$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',
|
||||
'titre'=>'List',
|
||||
'mainmenu'=>'opensurvey',
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'opensurvey_list',
|
||||
'url'=>'/opensurvey/list.php',
|
||||
'langs'=>'opensurvey',
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file expedtion/class/productbatch.class.php
|
||||
* \file expedition/class/productbatch.class.php
|
||||
* \ingroup productbatch
|
||||
* \brief This file implements CRUD method for managing product's shipment
|
||||
* 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 (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
|
||||
print '<td align="center">';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
@ -897,27 +897,27 @@ if ($action == 'create')
|
||||
print "</tr>\n";
|
||||
|
||||
// Show subproducts of product
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0)
|
||||
{
|
||||
$product->get_sousproduits_arbo();
|
||||
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
|
||||
if(count($prods_arbo) > 0)
|
||||
{
|
||||
foreach($prods_arbo as $key => $value)
|
||||
{
|
||||
//print $value[0];
|
||||
$img='';
|
||||
if ($value['stock'] < $value['stock_alert'])
|
||||
{
|
||||
$img=img_warning($langs->trans("StockTooLow"));
|
||||
}
|
||||
print "<tr ".$bc[$var]."><td> ->
|
||||
<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>
|
||||
<td align=\"center\">".$value['stock']." ".$img."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0)
|
||||
{
|
||||
$product->get_sousproduits_arbo();
|
||||
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
|
||||
if(count($prods_arbo) > 0)
|
||||
{
|
||||
foreach($prods_arbo as $key => $value)
|
||||
{
|
||||
//print $value[0];
|
||||
$img='';
|
||||
if ($value['stock'] < $value['stock_alert'])
|
||||
{
|
||||
$img=img_warning($langs->trans("StockTooLow"));
|
||||
}
|
||||
print "<tr ".$bc[$var]."><td> ->
|
||||
<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>
|
||||
<td align=\"center\">".$value['stock']." ".$img."</td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print '<td></td><td></td></tr>';
|
||||
$subj=0;
|
||||
|
||||
@ -24,10 +24,6 @@
|
||||
* \brief Note card expedition
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', true);
|
||||
ini_set('html_errors', false);
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
|
||||
|
||||
@ -28,10 +28,6 @@
|
||||
* \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_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
|
||||
@ -1056,6 +1056,7 @@ CREATE TABLE llx_expeditiondet_batch (
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--Salary payment in tax module
|
||||
--DROP TABLE llx_payment_salary
|
||||
CREATE TABLE llx_payment_salary (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
@ -1063,6 +1064,8 @@ CREATE TABLE llx_payment_salary (
|
||||
datep date,
|
||||
datev date,
|
||||
amount real NOT NULL DEFAULT 0,
|
||||
fk_typepayment integer NOT NULL,
|
||||
num_payment varchar(50),
|
||||
label varchar(255),
|
||||
datesp date, -- date de début 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_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
|
||||
datev date, -- date de valeur
|
||||
amount real NOT NULL DEFAULT 0,
|
||||
fk_typepayment integer NOT NULL,
|
||||
num_payment varchar(50),
|
||||
label varchar(255),
|
||||
datesp date, -- date de début 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,
|
||||
fk_user_author integer,
|
||||
label varchar(128)
|
||||
fk_origin integer,
|
||||
origintype varchar(32)
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -24,6 +24,8 @@ create table llx_tva
|
||||
datep date, -- date de paiement
|
||||
datev date, -- date de valeur
|
||||
amount real NOT NULL DEFAULT 0,
|
||||
fk_typepayment integer NULL,
|
||||
num_payment varchar(50),
|
||||
label varchar(255),
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
note text,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Dolibarr language file - fr_BE - main
|
||||
SeparatorDecimal=,
|
||||
SeparatorThousand=None
|
||||
SeparatorThousand=
|
||||
FormatDateShort=%d/%m/%Y
|
||||
FormatDateShortInput=%d/%m/%Y
|
||||
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.'">';
|
||||
}
|
||||
else print dol_print_email($object->mail_admin);
|
||||
else print dol_print_email($object->mail_admin, 0, 0, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -382,6 +382,8 @@ if ($object->allow_comments) {
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
llxFooterSurvey();
|
||||
|
||||
$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="action" value="add">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
|
||||
@ -784,8 +784,9 @@ else
|
||||
print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy'));
|
||||
print '</td></tr>';
|
||||
|
||||
// batch number management
|
||||
if ($conf->productbatch->enabled) {
|
||||
// Batch number management
|
||||
if ($conf->productbatch->enabled)
|
||||
{
|
||||
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"));
|
||||
print $form->selectarray('status_batch',$statutarray,GETPOST('status_batch'));
|
||||
@ -891,14 +892,17 @@ else
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Customs code
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.GETPOST('customcode').'"></td>';
|
||||
// Origin country
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||
print $form->select_country(GETPOST('country_id','int'),'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Custom code
|
||||
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.GETPOST('customcode').'"></td>';
|
||||
// Origin country
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||
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
|
||||
$parameters=array('colspan' => 3);
|
||||
$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>';
|
||||
}
|
||||
|
||||
// Customs code
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$object->customcode.'"></td>';
|
||||
// Origin country
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||
print $form->select_country($object->country_id,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Custom code
|
||||
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" size="10" value="'.$object->customcode.'"></td>';
|
||||
// Origin country
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td><td>';
|
||||
print $form->select_country($object->country_id,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="2"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -1236,10 +1243,11 @@ else
|
||||
// Label
|
||||
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 ($showbarcode) $nblignes+=2;
|
||||
if ($object->type!=1) $nblignes++;
|
||||
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) $nblignes+=2;
|
||||
if ($object->isservice()) $nblignes++;
|
||||
else $nblignes+=4;
|
||||
|
||||
@ -1425,12 +1433,15 @@ else
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Customs code
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$object->customcode.'</td>';
|
||||
|
||||
// Origin country code
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>';
|
||||
|
||||
// Custom code
|
||||
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$object->customcode.'</td>';
|
||||
|
||||
// Origin country code
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$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
|
||||
|
||||
@ -537,8 +537,8 @@ if ($resql)
|
||||
$productidselected=$key;
|
||||
$productlabelselected=$val;
|
||||
}
|
||||
$datebefore=dol_get_first_day($year, $month?$month:1, true);
|
||||
$dateafter=dol_get_last_day($year, $month?$month:12, true);
|
||||
$datebefore=dol_get_first_day($year?$year:strftime("%Y",time()), $month?$month:1, true);
|
||||
$dateafter=dol_get_last_day($year?$year:strftime("%Y",time()), $month?$month:12, true);
|
||||
$balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore);
|
||||
$balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter);
|
||||
|
||||
|
||||
@ -83,8 +83,8 @@ if ($action == 'createtask' && $user->rights->projet->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$date_start = dol_mktime(0,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']);
|
||||
$date_end = dol_mktime(0,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']);
|
||||
$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyeassskr'],'user');
|
||||
$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
|
||||
|
||||
if (empty($_POST["cancel"]))
|
||||
{
|
||||
@ -232,12 +232,12 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Date start
|
||||
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>';
|
||||
|
||||
// Date end
|
||||
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>';
|
||||
|
||||
// Other options
|
||||
@ -302,12 +302,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->socie
|
||||
|
||||
// Date start
|
||||
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>';
|
||||
|
||||
// Date end
|
||||
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>';
|
||||
|
||||
// planned workload
|
||||
|
||||
@ -23,10 +23,6 @@
|
||||
* \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_once DOL_DOCUMENT_ROOT.'/projet/class/project.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->fk_task_parent = $task_parent;
|
||||
$object->planned_workload = $planned_workload;
|
||||
$object->date_start = dol_mktime(0,0,0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']);
|
||||
$object->date_end = dol_mktime(0,0,0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']);
|
||||
$object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user');
|
||||
$object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
|
||||
$object->progress = $_POST['progress'];
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
@ -326,12 +322,12 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Date start
|
||||
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>';
|
||||
|
||||
// Date end
|
||||
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>';
|
||||
|
||||
// Planned workload
|
||||
@ -415,12 +411,12 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Date start
|
||||
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>';
|
||||
|
||||
// Date end
|
||||
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>';
|
||||
|
||||
// Planned workload
|
||||
|
||||
Loading…
Reference in New Issue
Block a user