Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop_add_restrictions_on_exports
This commit is contained in:
commit
ff605a4cff
@ -1737,7 +1737,7 @@ class Adherent extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
|
||||
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1';
|
||||
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
$response->img=img_object($langs->trans("Members"),"user");
|
||||
|
||||
$adherentstatic = new Adherent($this->db);
|
||||
@ -2006,14 +2006,18 @@ class Adherent extends CommonObject
|
||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a member is late (subscription late) or not
|
||||
*
|
||||
* @return boolean True if late, False if not late
|
||||
*/
|
||||
public function hasDelay()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//Only valid members
|
||||
if ($this->statut <= 0) {
|
||||
return false;
|
||||
}
|
||||
if ($this->statut <= 0) return false;
|
||||
if (! $this->datefin) return false;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
@ -932,6 +932,7 @@ class ActionComm extends CommonObject
|
||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||
$response->label = $langs->trans("ActionsToDo");
|
||||
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda';
|
||||
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||
$response->img = img_object($langs->trans("Actions"),"action");
|
||||
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
|
||||
@ -937,7 +937,7 @@ if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($even
|
||||
|
||||
|
||||
|
||||
$maxnbofchar=18;
|
||||
$maxnbofchar=0;
|
||||
$cachethirdparties=array();
|
||||
$cachecontacts=array();
|
||||
$cacheusers=array();
|
||||
@ -1242,20 +1242,20 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
}
|
||||
else
|
||||
{
|
||||
$numother++;
|
||||
$color=($event->icalcolor?$event->icalcolor:-1);
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
|
||||
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
|
||||
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
|
||||
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
|
||||
$numother++;
|
||||
$color=($event->icalcolor?$event->icalcolor:-1);
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
|
||||
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
|
||||
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
|
||||
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
|
||||
}
|
||||
if ($color == -1) // Color was not forced. Set color according to color index.
|
||||
{
|
||||
@ -1272,7 +1272,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color
|
||||
}
|
||||
//print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>';
|
||||
// Define color
|
||||
// Define color
|
||||
$color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||
@ -1316,7 +1316,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
//if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));';
|
||||
//else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;';
|
||||
print ' -moz-border-radius:4px;" width="100%"><tr>';
|
||||
print '<td class="'.($nowrapontd?'nowrap ':'').'cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
|
||||
print '<td class="tdoverflow centpercent '.($nowrapontd?'nowrap ':'').'cal_event'.($event->type_code == 'BIRTHDAY'?' cal_event_birthday':'').'">';
|
||||
if ($event->type_code == 'BIRTHDAY') // It's a birthday
|
||||
{
|
||||
print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact');
|
||||
@ -1397,8 +1397,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
if ($event->type_code == 'ICALEVENT') print '<br>('.dol_trunc($event->icalname,$maxnbofchar).')';
|
||||
|
||||
// If action related to company / contact
|
||||
$linerelatedto='';$length=16;
|
||||
if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2);
|
||||
$linerelatedto='';
|
||||
if (! empty($event->societe->id) && $event->societe->id > 0)
|
||||
{
|
||||
if (! isset($cachethirdparties[$event->societe->id]) || ! is_object($cachethirdparties[$event->societe->id]))
|
||||
@ -1408,7 +1407,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$cachethirdparties[$event->societe->id]=$thirdparty;
|
||||
}
|
||||
else $thirdparty=$cachethirdparties[$event->societe->id];
|
||||
if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',$length);
|
||||
if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',0);
|
||||
}
|
||||
if (! empty($event->contact->id) && $event->contact->id > 0)
|
||||
{
|
||||
@ -1420,7 +1419,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
}
|
||||
else $contact=$cachecontacts[$event->contact->id];
|
||||
if ($linerelatedto) $linerelatedto.=' / ';
|
||||
if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',$length);
|
||||
if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',0);
|
||||
}
|
||||
if ($linerelatedto) print '<br>'.$linerelatedto;
|
||||
}
|
||||
|
||||
@ -283,12 +283,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre" height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NbOfProposals").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="right">'.$langs->trans("NbOfProposals").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
|
||||
@ -1102,6 +1102,7 @@ class Account extends CommonObject
|
||||
$sql.= " AND b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
||||
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
|
||||
$sql.= " AND clos = 0";
|
||||
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -105,7 +105,7 @@ foreach ($accounts as $key=>$type)
|
||||
$solde = $acc->solde(1);
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td width="30%">'.$acc->getNomUrl(1).'</td>';
|
||||
print '<td class="titlefield">'.$acc->getNomUrl(1).'</td>';
|
||||
print '<td>'.$acc->bank.'</td>';
|
||||
print '<td>'.$acc->number.'</td>';
|
||||
print '<td align="center">';
|
||||
@ -116,7 +116,7 @@ foreach ($accounts as $key=>$type)
|
||||
setEventMessages($acc->error, $acc->errors, 'errors');
|
||||
} else {
|
||||
print $result->nbtodo;
|
||||
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
||||
if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')';
|
||||
}
|
||||
}
|
||||
else print $langs->trans("FeatureDisabled");
|
||||
|
||||
@ -262,12 +262,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre" height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NumberOfBills").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="right">'.$langs->trans("NumberOfBills").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
|
||||
463
htdocs/compta/paiement/class/cpaiement.class.php
Normal file
463
htdocs/compta/paiement/class/cpaiement.class.php
Normal file
@ -0,0 +1,463 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/compat/paiement/class/cpaiement.class.php
|
||||
* \ingroup facture
|
||||
* \brief This file is to manage CRUD function of type of payments
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class Cpaiement
|
||||
*/
|
||||
class Cpaiement
|
||||
{
|
||||
/**
|
||||
* @var string Id to identify managed objects
|
||||
*/
|
||||
public $element = 'cpaiement';
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'c_paiement';
|
||||
|
||||
/**
|
||||
* @var CpaiementLine[] Lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
public $code;
|
||||
public $libelle;
|
||||
public $type;
|
||||
public $active;
|
||||
public $accountancy_code;
|
||||
public $module;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
}
|
||||
if (isset($this->libelle)) {
|
||||
$this->libelle = trim($this->libelle);
|
||||
}
|
||||
if (isset($this->type)) {
|
||||
$this->type = trim($this->type);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
if (isset($this->accountancy_code)) {
|
||||
$this->accountancy_code = trim($this->accountancy_code);
|
||||
}
|
||||
if (isset($this->module)) {
|
||||
$this->module = trim($this->module);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||
|
||||
$sql.= 'id,';
|
||||
$sql.= 'code,';
|
||||
$sql.= 'libelle,';
|
||||
$sql.= 'type,';
|
||||
$sql.= 'active,';
|
||||
$sql.= 'accountancy_code,';
|
||||
$sql.= 'module';
|
||||
|
||||
|
||||
$sql .= ') VALUES (';
|
||||
|
||||
$sql .= ' '.(! isset($this->id)?'NULL':$this->id).',';
|
||||
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
|
||||
$sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").',';
|
||||
$sql .= ' '.(! isset($this->type)?'NULL':$this->type).',';
|
||||
$sql .= ' '.(! isset($this->active)?'NULL':$this->active).',';
|
||||
$sql .= ' '.(! isset($this->accountancy_code)?'NULL':"'".$this->db->escape($this->accountancy_code)."'").',';
|
||||
$sql .= ' '.(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'");
|
||||
|
||||
|
||||
$sql .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action to call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||
//if ($result < 0) $error++;
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.id,';
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.libelle,";
|
||||
$sql .= " t.type,";
|
||||
$sql .= " t.active,";
|
||||
$sql .= " t.accountancy_code,";
|
||||
$sql .= " t.module";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
if (null !== $ref) {
|
||||
$sql .= ' WHERE t.code = ' . '\'' . $ref . '\'';
|
||||
} else {
|
||||
$sql .= ' WHERE t.id = ' . $id;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
if ($numrows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->id;
|
||||
|
||||
$this->code = $obj->code;
|
||||
$this->libelle = $obj->libelle;
|
||||
$this->type = $obj->type;
|
||||
$this->active = $obj->active;
|
||||
$this->accountancy_code = $obj->accountancy_code;
|
||||
$this->module = $obj->module;
|
||||
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($numrows) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.id,';
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.libelle,";
|
||||
$sql .= " t.type,";
|
||||
$sql .= " t.active,";
|
||||
$sql .= " t.accountancy_code,";
|
||||
$sql .= " t.module";
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new CpaiementLine();
|
||||
|
||||
$line->id = $obj->id;
|
||||
|
||||
$line->code = $obj->code;
|
||||
$line->libelle = $obj->libelle;
|
||||
$line->type = $obj->type;
|
||||
$line->active = $obj->active;
|
||||
$line->accountancy_code = $obj->accountancy_code;
|
||||
$line->module = $obj->module;
|
||||
|
||||
|
||||
|
||||
$this->lines[$line->id] = $line;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
}
|
||||
if (isset($this->libelle)) {
|
||||
$this->libelle = trim($this->libelle);
|
||||
}
|
||||
if (isset($this->type)) {
|
||||
$this->type = trim($this->type);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
if (isset($this->accountancy_code)) {
|
||||
$this->accountancy_code = trim($this->accountancy_code);
|
||||
}
|
||||
if (isset($this->module)) {
|
||||
$this->module = trim($this->module);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||
$sql .= ' id = '.(isset($this->id)?$this->id:"null").',';
|
||||
$sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").',';
|
||||
$sql .= ' libelle = '.(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").',';
|
||||
$sql .= ' type = '.(isset($this->type)?$this->type:"null").',';
|
||||
$sql .= ' active = '.(isset($this->active)?$this->active:"null").',';
|
||||
$sql .= ' accountancy_code = '.(isset($this->accountancy_code)?"'".$this->db->escape($this->accountancy_code)."'":"null").',';
|
||||
$sql .= ' module = '.(isset($this->module)?"'".$this->db->escape($this->module)."'":"null");
|
||||
$sql .= ' WHERE id=' . $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= ' WHERE id=' . $this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id = 0;
|
||||
|
||||
$this->code = '';
|
||||
$this->libelle = '';
|
||||
$this->type = '';
|
||||
$this->active = '';
|
||||
$this->accountancy_code = '';
|
||||
$this->module = '';
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -62,8 +62,9 @@ class Paiement extends CommonObject
|
||||
var $bank_line; // Id de la ligne d'ecriture bancaire
|
||||
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
||||
// fk_paiement dans llx_paiement_facture est le rowid du paiement
|
||||
var $fk_paiement; // Type of paiment
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@ -2220,18 +2220,18 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
class ContratLigne extends CommonObjectLine
|
||||
{
|
||||
|
||||
public $element='contratdet';
|
||||
public $table_element='contratdet';
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
var $tms;
|
||||
|
||||
var $fk_contrat;
|
||||
var $fk_product;
|
||||
var $statut; // 0 inactive, 4 active, 5 closed
|
||||
var $type; // 0 for product, 1 for service
|
||||
var $label;
|
||||
|
||||
public $element='contratdet';
|
||||
public $table_element='contratdet';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @deprecated Use $label instead
|
||||
@ -2240,6 +2240,10 @@ class ContratLigne extends CommonObjectLine
|
||||
public $libelle;
|
||||
|
||||
var $description;
|
||||
|
||||
var $product_ref;
|
||||
var $product_label;
|
||||
|
||||
var $date_commande;
|
||||
var $date_ouverture_prevue; // date start planned
|
||||
var $date_ouverture; // date start real
|
||||
@ -2379,16 +2383,17 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowContractOfService").': '.$this->label;
|
||||
|
||||
if (empty($label)) $label=$this->description;
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='contract';
|
||||
|
||||
$picto='service';
|
||||
if ($this->type == 0) $picto='product';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.$this->label.$linkend;
|
||||
if ($withpicto != 2) $result.=$link.($this->product_ref?$this->product_ref.' ':'').($this->label?$this->label:$this->description).$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -2417,6 +2422,7 @@ class ContratLigne extends CommonObjectLine
|
||||
$sql.= " p.ref as product_ref,";
|
||||
$sql.= " p.label as product_label,";
|
||||
$sql.= " p.description as product_desc,";
|
||||
$sql.= " p.type as product_type,";
|
||||
$sql.= " t.description,";
|
||||
$sql.= " t.date_commande,";
|
||||
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
|
||||
@ -2467,6 +2473,7 @@ class ContratLigne extends CommonObjectLine
|
||||
$this->product_ref = $obj->product_ref;
|
||||
$this->product_label = $obj->product_label;
|
||||
$this->product_description = $obj->product_description;
|
||||
$this->product_type = $obj->product_type;
|
||||
$this->label = $obj->label; // deprecated. We do not use this field. Only ref and label of product, and description of contract line
|
||||
$this->description = $obj->description;
|
||||
$this->date_commande = $this->db->jdate($obj->date_commande);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
@ -267,14 +267,14 @@ if ($resql)
|
||||
$productstatic->type=$obj->ptype;
|
||||
$productstatic->ref=$obj->pref;
|
||||
$productstatic->entity=$obj->pentity;
|
||||
print $productstatic->getNomUrl(1,'',20);
|
||||
print $productstatic->getNomUrl(1,'',24);
|
||||
print $obj->label?' - '.dol_trunc($obj->label,16):'';
|
||||
if (! empty($obj->description) && ! empty($conf->global->PRODUCT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($obj->type == 0) print img_object($obj->description,'product').dol_trunc($obj->description,20);
|
||||
if ($obj->type == 1) print img_object($obj->description,'service').dol_trunc($obj->description,20);
|
||||
if ($obj->type == 0) print img_object($obj->description,'product').' '.dol_trunc($obj->description,24);
|
||||
if ($obj->type == 1) print img_object($obj->description,'service').' '.dol_trunc($obj->description,24);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -291,7 +291,7 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' ');
|
||||
if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay)))
|
||||
print img_picto($langs->trans("Late"),"warning");
|
||||
print ' '.img_picto($langs->trans("Late"),"warning");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -55,13 +55,15 @@ class box_contracts extends ModeleBoxes
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
$contractstatic=new Contrat($db);
|
||||
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts",$max));
|
||||
|
||||
if ($user->rights->contrat->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||
$contractstatic=new Contrat($db);
|
||||
$thirdpartytmp=new Societe($db);
|
||||
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||
$sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -80,7 +82,10 @@ class box_contracts extends ModeleBoxes
|
||||
|
||||
$line = 0;
|
||||
|
||||
while ($line < $num) {
|
||||
$langs->load("contracts");
|
||||
|
||||
while ($line < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$datec=$db->jdate($objp->datec);
|
||||
$dateterm=$db->jdate($objp->fin_validite);
|
||||
@ -89,38 +94,26 @@ class box_contracts extends ModeleBoxes
|
||||
|
||||
$contractstatic->statut=$objp->fk_statut;
|
||||
$contractstatic->id=$objp->rowid;
|
||||
$contractstatic->ref=$objp->ref;
|
||||
$result=$contractstatic->fetch_lines();
|
||||
|
||||
$thirdpartytmp->name = $objp->name;
|
||||
$thirdpartytmp->id = $objp->socid;
|
||||
|
||||
// fin_validite is no more on contract but on services
|
||||
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
|
||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
|
||||
'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid),
|
||||
'text' => $contractstatic->getNomUrl(1),
|
||||
'text2'=> $late,
|
||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
'asis'=>1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'align="left"',
|
||||
'text' => dol_trunc($objp->name,40),
|
||||
'tooltip' => $langs->trans('Customer').': '.$objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid,
|
||||
'text' => $thirdpartytmp->getNomUrl(1),
|
||||
'asis'=>1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
|
||||
@ -56,26 +56,28 @@ class box_services_contracts extends ModeleBoxes
|
||||
$this->max=$max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
$contratlignestatic=new ContratLigne($db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max));
|
||||
|
||||
if ($user->rights->service->lire && $user->rights->contrat->lire)
|
||||
{
|
||||
$contractstatic=new Contrat($db);
|
||||
$contratlignestatic=new ContratLigne($db);
|
||||
$thirdpartytmp = new Societe($db);
|
||||
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||
$sql.= " c.rowid,";
|
||||
$sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut,";
|
||||
$sql.= " p.rowid as pid, p.label, p.fk_product_type";
|
||||
$sql.= " c.rowid, c.ref, c.statut as contract_status,";
|
||||
$sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ")";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
$sql.= " AND s.rowid = c.fk_soc";
|
||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||
$sql.= " AND cd.fk_product = p.rowid";
|
||||
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.= $db->order("c.tms","DESC");
|
||||
@ -94,12 +96,27 @@ class box_services_contracts extends ModeleBoxes
|
||||
$objp = $db->fetch_object($result);
|
||||
$datem=$db->jdate($objp->datem);
|
||||
|
||||
$contratlignestatic->id=$objp->cdid;
|
||||
$contratlignestatic->fk_contrat=$objp->rowid;
|
||||
$contratlignestatic->label=$objp->label;
|
||||
$contratlignestatic->description=$objp->description;
|
||||
$contratlignestatic->type=$objp->type;
|
||||
$contratlignestatic->product_id=$objp->product_id;
|
||||
$contratlignestatic->product_ref=$objp->product_ref;
|
||||
|
||||
$contractstatic->statut=$objp->contract_status;
|
||||
$contractstatic->id=$objp->rowid;
|
||||
$contractstatic->ref=$objp->ref;
|
||||
|
||||
$thirdpartytmp->name = $objp->name;
|
||||
$thirdpartytmp->id = $objp->socid;
|
||||
|
||||
// Multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||
{
|
||||
$sqld = "SELECT label";
|
||||
$sqld.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sqld.= " WHERE fk_product=".$objp->pid;
|
||||
$sqld.= " WHERE fk_product=".$objp->product_id;
|
||||
$sqld.= " AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sqld.= " LIMIT 1";
|
||||
|
||||
@ -107,32 +124,29 @@ class box_services_contracts extends ModeleBoxes
|
||||
if ($resultd)
|
||||
{
|
||||
$objtp = $db->fetch_object($resultd);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
if ($objtp->label != '') $contratlignestatic->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => ($objp->fk_product_type==1?'object_service':'object_product'),
|
||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
||||
'text' => $contratlignestatic->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
||||
'text' => $contractstatic->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][1] = array('td' => 'align="left"',
|
||||
'text' => $objp->label,
|
||||
'maxlength' => 16,
|
||||
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="left"',
|
||||
'text' => $thirdpartytmp->getNomUrl(1),
|
||||
'asis' => 1
|
||||
);
|
||||
|
||||
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
|
||||
'logo' => 'company',
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'align="left"',
|
||||
'text' => $objp->name,
|
||||
'maxlength' => 28,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][4] = array('td' => 'align="right"',
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="right"',
|
||||
'text' => dol_print_date($datem,'day'));
|
||||
|
||||
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
|
||||
$this->info_box_contents[$i][] = array('td' => 'align="right" width="18"',
|
||||
'text' => $contratlignestatic->LibStatut($objp->statut,3)
|
||||
);
|
||||
|
||||
|
||||
@ -135,10 +135,10 @@ class modTax extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' WHERE c.fk_type = cc.id';
|
||||
$this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('tax',1).')';
|
||||
|
||||
// Import Taxes
|
||||
// Import social contributions
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]="ImportDataset_tax_1"; // Translation key
|
||||
$this->import_label[$r]="ImportDataset_tax_contrib"; // Translation key
|
||||
$this->import_icon[$r]='tax';
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'chargesociales');
|
||||
@ -152,6 +152,25 @@ class modTax extends DolibarrModules
|
||||
$this->import_examplevalues_array[$r]=array('t.libelle'=>"Social/fiscal contribution",'t.fk_type'=>"TAXPRO (must be id or code found into dictionary)",
|
||||
't.date_ech'=>"2016-01-01", 't.periode'=>"2016-01-01"
|
||||
);
|
||||
|
||||
// Import Taxes
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]="ImportDataset_tax_vat"; // Translation key
|
||||
$this->import_icon[$r]='tax';
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'tva');
|
||||
$this->import_fields_array[$r]=array('t.datep'=>"DatePayment*",'t.datev'=>"DateValue*",'t.label'=>"Label*",'t.fk_typepayment'=>"PaymentMode*",
|
||||
't.amount'=>"Amount*",'t.num_payment'=>'Numero'
|
||||
);
|
||||
|
||||
$this->import_convertvalue_array[$r]=array(
|
||||
't.fk_typepayment'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/paiement/class/cpaiement.class.php','class'=>'Cpaiement','method'=>'fetch','element'=>'Cpaiement')
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array('t.label'=>"VAT Payment 1st quarter 2016",'t.fk_typepayment'=>"CHQ (must be id or code found into dictionary)",
|
||||
't.datep'=>"2016-04-02", 't.datev'=>"2016-03-31", 't.amount'=>1000, 't.num_payment'=>'123456'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1401,6 +1401,7 @@ else
|
||||
print '<td>'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td colspan="2">'.$object->note_private.'</td>';
|
||||
print '</tr>';
|
||||
// Amount
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td>'.price($object->total_ht).'</td>';
|
||||
@ -1412,9 +1413,8 @@ else
|
||||
if($object->fk_statut==6) $rowspan+=2;
|
||||
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
/*
|
||||
* Payments
|
||||
*/
|
||||
|
||||
// List of payments
|
||||
$sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,";
|
||||
$sql.= "c.code as type_code,c.libelle as payment_type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p";
|
||||
@ -1499,9 +1499,13 @@ else
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Validation date
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DATE_SAVE").'</td>';
|
||||
print '<td>'.dol_print_date($object->date_create,'dayhour').'</td></tr>';
|
||||
print '<td>'.dol_print_date($object->date_create,'dayhour');
|
||||
if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late"));
|
||||
if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late"));
|
||||
print '</td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
// User to inform
|
||||
@ -1515,7 +1519,11 @@ else
|
||||
$userfee=new User($db);
|
||||
$userfee->fetch($object->fk_user_validator);
|
||||
print $userfee->getNomUrl(1);
|
||||
if (empty($userfee->email) || ! isValidEmail($userfee->email)) print img_warning($langs->trans("EmailNotValid"));
|
||||
if (empty($userfee->email) || ! isValidEmail($userfee->email))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print img_warning($langs->trans("ErrorBadEMail", $userfee->email));
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1613,6 +1613,28 @@ class ExpenseReport extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if an expense report is late or not
|
||||
*
|
||||
* @param string $option 'topay' or 'toapprove'
|
||||
* @return boolean True if late, False if not late
|
||||
*/
|
||||
public function hasDelay($option)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
//Only valid members
|
||||
if ($option == 'toapprove' && $this->status != 2) return false;
|
||||
if ($option == 'topay' && $this->status != 5) return false;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
if ($option == 'toapprove')
|
||||
return $this->datevalid < ($now - $conf->expensereport->approve->warning_delay);
|
||||
else
|
||||
return $this->datevalid < ($now - $conf->expensereport->payment->warning_delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -81,7 +81,6 @@ $fieldstosearchall = array(
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$expensereporttmp=new ExpenseReport($db);
|
||||
|
||||
llxHeader('', $langs->trans("ListOfTrips"));
|
||||
|
||||
@ -104,7 +103,7 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
|
||||
$sql.= " d.date_debut, d.date_fin,";
|
||||
$sql.= " d.date_debut, d.date_fin, d.date_valid,";
|
||||
$sql.= " u.rowid as id_user, u.firstname, u.lastname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid";
|
||||
@ -244,7 +243,8 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
// User
|
||||
if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous){
|
||||
if ($user->rights->expensereport->readall || $user->rights->expensereport->lire_tous)
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td>';
|
||||
@ -280,7 +280,7 @@ if ($resql)
|
||||
|
||||
$expensereportstatic=new ExpenseReport($db);
|
||||
|
||||
if($num > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
@ -288,21 +288,27 @@ if ($resql)
|
||||
|
||||
$expensereportstatic->id=$objp->rowid;
|
||||
$expensereportstatic->ref=$objp->ref;
|
||||
$expensereportstatic->status=$objp->status;
|
||||
$expensereportstatic->valid=$objp->date_valid;
|
||||
$expensereportstatic->date_debut=$objp->date_debut;
|
||||
$expensereportstatic->date_fin=$objp->date_fin;
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
|
||||
print '<td>';
|
||||
print $expensereportstatic->getNomUrl(1);
|
||||
print $expensereportstatic->status;
|
||||
if ($expensereportstatic->status == 2 && $expensereportstatic->hasDelay('toappove')) print img_warning($langs->trans("Late"));
|
||||
if ($expensereportstatic->status == 5 && $expensereportstatic->hasDelay('topay')) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td align="center">'.($objp->date_debut > 0 ? dol_print_date($objp->date_debut, 'day') : '').'</td>';
|
||||
print '<td align="center">'.($objp->date_fin > 0 ? dol_print_date($objp->date_fin, 'day') : '').'</td>';
|
||||
print '<td align="left"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$objp->id_user.'">'.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($objp->firstname, $objp->lastname).'</a></td>';
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
print '<td align="right">'.price($objp->total_tva).'</td>';
|
||||
print '<td align="right">'.price($objp->total_ttc).'</td>';
|
||||
|
||||
$expensereporttmp->status=$objp->status;
|
||||
print '<td align="right">';
|
||||
//print $objp->status;
|
||||
print $expensereporttmp->getLibStatut(5);
|
||||
print $expensereportstatic->getLibStatut(5);
|
||||
print '</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
@ -241,9 +241,9 @@ print '<br><br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre" height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Number").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Number").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
@ -473,7 +473,7 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$board=new Account($db);
|
||||
$nb = $board::countAccountToReconcile();
|
||||
$nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
|
||||
if ($nb > 0)
|
||||
{
|
||||
$dashboardlines[] = $board->load_board($user);
|
||||
|
||||
@ -119,6 +119,7 @@ ALTER TABLE llx_facturedet ADD COLUMN fk_contract_line integer NULL AFTER rang;
|
||||
ALTER TABLE llx_facturedet_rec ADD COLUMN import_key varchar(14);
|
||||
|
||||
ALTER TABLE llx_chargesociales ADD COLUMN import_key varchar(14);
|
||||
ALTER TABLE llx_tva ADD COLUMN import_key varchar(14);
|
||||
|
||||
--DROP TABLE llx_website_page;
|
||||
--DROP TABLE llx_website;
|
||||
|
||||
@ -30,14 +30,7 @@ create table llx_tva
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
note text,
|
||||
fk_bank integer,
|
||||
fk_user_creat integer, -- utilisateur qui a cree l'info
|
||||
fk_user_modif integer -- utilisateur qui a modifi<66> l'info
|
||||
fk_user_creat integer, -- utilisateur who create record
|
||||
fk_user_modif integer, -- utilisateur who modify record
|
||||
import_key varchar(14)
|
||||
)ENGINE=innodb;
|
||||
|
||||
--
|
||||
-- List of codes for the field entity
|
||||
--
|
||||
-- 1 : first company vat
|
||||
-- 2 : second company vat
|
||||
-- 3 : etc...
|
||||
--
|
||||
@ -225,5 +225,6 @@ BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry=Based on t
|
||||
SameCountryCustomersWithVAT=National customers report
|
||||
BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Based on the two first letters of the VAT number being the same as your own company's country code
|
||||
LinkedFichinter=Link to an intervention
|
||||
ImportDataset_tax_1=Import social/fiscal taxes
|
||||
ImportDataset_tax_contrib=Import social/fiscal taxes
|
||||
ImportDataset_tax_vat=Import vat payments
|
||||
ErrorBankAccountNotFound=Error: Bank account not found
|
||||
|
||||
@ -1627,8 +1627,8 @@ class Project extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay = $conf->projet->warning_delay/60/60/24;
|
||||
$response->label = $langs->trans("OpenedProjects");
|
||||
if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/index.php?search_status=1&mainmenu=project';
|
||||
else $response->url = DOL_URL_ROOT.'/projet/index.php?mode=mine&search_status=1&mainmenu=project';
|
||||
if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/list.php?search_status=1&mainmenu=project';
|
||||
else $response->url = DOL_URL_ROOT.'/projet/list.php?mode=mine&search_status=1&mainmenu=project';
|
||||
$response->img = img_object($langs->trans("Projects"),"project");
|
||||
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
@ -1719,9 +1719,8 @@ class Project extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! ($this->statut == 1)) {
|
||||
return false;
|
||||
}
|
||||
if (! ($this->statut == 1)) return false;
|
||||
if (! $this->datee) return false;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
@ -558,6 +558,9 @@ if ($resql)
|
||||
$projectstatic->user_author_id = $obj->fk_user_creat;
|
||||
$projectstatic->public = $obj->public;
|
||||
$projectstatic->ref = $obj->ref;
|
||||
$projectstatic->datee = $obj->date_end;
|
||||
$projectstatic->statut = $obj->fk_statut;
|
||||
$projectstatic->opp_status = $obj->fk_opp_status;
|
||||
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
|
||||
if ($userAccess >= 0)
|
||||
@ -570,6 +573,7 @@ if ($resql)
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
print $projectstatic->getNomUrl(1);
|
||||
if ($projectstatic->hasDelay()) print img_warning($langs->trans('Late'));
|
||||
print '</td>';
|
||||
}
|
||||
// Title
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -213,7 +213,7 @@ else dol_print_error($db);
|
||||
if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found
|
||||
|
||||
$distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
|
||||
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate";
|
||||
$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate";
|
||||
$sql.= ", s.nom as name, s.rowid as socid";
|
||||
$sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update";
|
||||
$sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut";
|
||||
@ -550,12 +550,14 @@ if ($resql)
|
||||
$projectstatic->title = $obj->projecttitle;
|
||||
$projectstatic->public = $obj->public;
|
||||
$projectstatic->statut = $obj->projectstatus;
|
||||
$projectstatic->datee = $obj->projectdatee;
|
||||
|
||||
$taskstatic->id = $obj->id;
|
||||
$taskstatic->ref = $obj->ref;
|
||||
$taskstatic->label = $obj->label;
|
||||
$taskstatic->fk_statut = $obj->fk_statut;
|
||||
$taskstatic->progress = $obj->progress;
|
||||
$taskstatic->datee = $obj->date_end;
|
||||
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
|
||||
if ($userAccess >= 0)
|
||||
@ -568,6 +570,7 @@ if ($resql)
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
print $projectstatic->getNomUrl(1, 'task');
|
||||
if ($projectstatic->hasDelay()) print img_warning("Late");
|
||||
print '</td>';
|
||||
}
|
||||
// Title
|
||||
@ -605,6 +608,7 @@ if ($resql)
|
||||
{
|
||||
print '<td>';
|
||||
print $taskstatic->getNomUrl(1,'withproject');
|
||||
if ($taskstatic->hasDelay()) print img_warning("Late");
|
||||
print '</td>';
|
||||
}
|
||||
// Label
|
||||
|
||||
Loading…
Reference in New Issue
Block a user