mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-05 16:42:53 +01:00
Merge branch 'develop' into prod-attr
# Conflicts: # htdocs/compta/facture.php
This commit is contained in:
@@ -54,6 +54,7 @@ $langs->load("loan");
|
||||
$langs->load("donations");
|
||||
$langs->load("trips");
|
||||
$langs->load("members");
|
||||
$langs->load("compta");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
|
||||
@@ -449,7 +449,7 @@ foreach ($accounts as $key=>$type)
|
||||
// Ref
|
||||
if (! empty($arrayfields['b.ref']['checked']))
|
||||
{
|
||||
print '<td class="titlefield">'.$acc->getNomUrl(1).'</td>';
|
||||
print '<td>'.$acc->getNomUrl(1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1350,8 +1350,16 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
if (!$prod_entry_mode)
|
||||
{
|
||||
if (GETPOST('type') < 0 && ! GETPOST('search_idprod'))
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorChooseBetweenFreeAntryOrPredefinedProduct'), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
|
||||
@@ -3278,7 +3286,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
if($object->statut == 0) {
|
||||
if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) {
|
||||
print '<div class="inline-block"> ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
|
||||
print '</div>';
|
||||
|
||||
@@ -39,10 +39,6 @@ class Cpaiement
|
||||
*/
|
||||
public $table_element = 'c_paiement';
|
||||
|
||||
/**
|
||||
* @var CpaiementLine[] Lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -227,84 +223,6 @@ class Cpaiement
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
@@ -30,14 +30,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
$langs->load("companies");
|
||||
if (! empty($conf->facture->enabled)) $langs->load("bills");
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid",'int');
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$id = GETPOST('id')?GETPOST('id','int'):GETPOST('socid','int');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $id=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $id, '&societe');
|
||||
|
||||
$object = new Societe($db);
|
||||
if ($id > 0) $object->fetch($id);
|
||||
|
||||
|
||||
/*
|
||||
@@ -47,20 +47,21 @@ if ($user->societe_id > 0)
|
||||
$form = new Form($db);
|
||||
$userstatic=new User($db);
|
||||
|
||||
llxHeader();
|
||||
$title=$langs->trans("ThirdParty").' - '.$langs->trans("Summary");
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary");
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
|
||||
if ($socid > 0)
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($societe);
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), 0, 'company');
|
||||
dol_banner_tab($societe, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 1);
|
||||
dol_fiche_end();
|
||||
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
@@ -86,7 +87,7 @@ if ($socid > 0)
|
||||
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
|
||||
$sql.= " u.login, u.rowid as userid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
|
||||
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_user_valid = u.rowid";
|
||||
$sql.= " ORDER BY f.datef ASC";
|
||||
|
||||
@@ -646,7 +646,7 @@ print '<tr class="liste_titre"><td class="liste_titre"> </td>';
|
||||
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
print '<td align="center" colspan="2" class="borderrightlight">';
|
||||
print '<td align="center" colspan="2" class="liste_titre borderrightlight">';
|
||||
print '<a href="clientfourn.php?year='.$annee.'">';
|
||||
print $annee;
|
||||
if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1);
|
||||
@@ -656,8 +656,8 @@ print '</tr>';
|
||||
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
print '<td align="center">'.$langs->trans("Outcome").'</td>';
|
||||
print '<td align="center" class="borderrightlight">'.$langs->trans("Income").'</td>';
|
||||
print '<td class="liste_titre" align="center">'.$langs->trans("Outcome").'</td>';
|
||||
print '<td class="liste_titre" align="center" class="borderrightlight">'.$langs->trans("Income").'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
@@ -678,7 +678,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
|
||||
if($mois>12) {$annee_decalage=$annee+1;}
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois_modulo,1,$annee_decalage));
|
||||
|
||||
print '<td align="right"> ';
|
||||
print '<td class="liste_titre" align="right"> ';
|
||||
if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0)
|
||||
{
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($decaiss_ttc[$case],'MT')).'</a>';
|
||||
@@ -687,7 +687,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
print '<td align="right" class="borderrightlight"> ';
|
||||
print '<td align="right" class="liste_titre borderrightlight"> ';
|
||||
//if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0)
|
||||
if (isset($encaiss_ttc[$case]))
|
||||
{
|
||||
@@ -704,7 +704,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
|
||||
// Total
|
||||
$var=!$var;
|
||||
$nbcols=0;
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<tr class="liste_total impair"><td>'.$langs->trans("TotalTTC").'</td>';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
$nbcols+=2;
|
||||
@@ -714,7 +714,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
print "</tr>\n";
|
||||
|
||||
// Empty line
|
||||
print '<tr><td> </td>';
|
||||
print '<tr class="impair"><td> </td>';
|
||||
print '<td colspan="'.$nbcols.'"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@@ -43,11 +43,6 @@ class Cchargesociales
|
||||
*/
|
||||
public $table_element = 'c_chargesociales';
|
||||
|
||||
/**
|
||||
* @var CchargesocialesLine[] Lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
@@ -237,83 +232,6 @@ class Cchargesociales
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.libelle,";
|
||||
$sql .= " t.deductible,";
|
||||
$sql .= " t.active,";
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.fk_pays,";
|
||||
$sql .= " t.module,";
|
||||
$sql .= " t.accountancy_code";
|
||||
|
||||
|
||||
$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 CchargesocialesLine();
|
||||
|
||||
$line->id = $obj->id;
|
||||
$line->libelle = $obj->libelle;
|
||||
$line->deductible = $obj->deductible;
|
||||
$line->active = $obj->active;
|
||||
$line->code = $obj->code;
|
||||
$line->fk_pays = $obj->fk_pays;
|
||||
$line->module = $obj->module;
|
||||
$line->accountancy_code = $obj->accountancy_code;
|
||||
|
||||
$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
|
||||
*
|
||||
|
||||
@@ -456,10 +456,10 @@ print '<td class="liste_titre" align="left">';
|
||||
print $form->select_country($search_country, 'search_country');
|
||||
//print '<input class="flat" size="6" type="text" name="search_country" value="'.$search_country.'">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
|
||||
@@ -197,13 +197,13 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Month").'</td>';
|
||||
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right" class="borderrightlight">'.$langs->trans("Delta").'</td>';
|
||||
if ($annee != $year_end) print '<td width="15"> </td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') print '<td class="liste_titre" align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td class="liste_titre" align="right" class="borderrightlight">'.$langs->trans("Delta").'</td>';
|
||||
if ($annee != $year_end) print '<td class="liste_titre" width="15"> </td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user