Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
0a8ab84b1d
@ -45,6 +45,7 @@ For users:
|
||||
- New: Can filter on status for supplier order.
|
||||
- Fix: Project Task numbering customs rule works.
|
||||
- Fix: Add actions events not implemented.
|
||||
- New: Add filter date in bank writing list page
|
||||
|
||||
TODO
|
||||
- New: Predefined product and free product use same form.
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
|
||||
*
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
|
||||
*
|
||||
* 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
|
||||
@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
@ -43,14 +45,20 @@ $credit=GETPOST("credit");
|
||||
$type=GETPOST("type");
|
||||
$account=GETPOST("account");
|
||||
$bid=GETPOST("bid","int");
|
||||
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||
|
||||
$param='';
|
||||
if ($description) $param.='&description='.$description;
|
||||
if ($type) $param.='&type='.$type;
|
||||
if ($debit) $param.='&debit='.$debit;
|
||||
if ($credit) $param.='&credit='.$credit;
|
||||
if ($account) $param.='&account='.$account;
|
||||
if ($bid) $param.='&bid='.$bid;
|
||||
if (!empty($description)) $param.='&description='.$description;
|
||||
if (!empty($type)) $param.='&type='.$type;
|
||||
if (!empty($debit)) $param.='&debit='.$debit;
|
||||
if (!empty($credit)) $param.='&credit='.$credit;
|
||||
if (!empty($account)) $param.='&account='.$account;
|
||||
if (!empty($bid)) $param.='&bid='.$bid;
|
||||
if (dol_strlen($search_dt_start) > 0)
|
||||
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||
if (dol_strlen($search_dt_end) > 0)
|
||||
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -74,6 +82,7 @@ $bankaccountstatic=new Account($db);
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if ($vline) $viewline = $vline;
|
||||
else $viewline = 50;
|
||||
@ -108,6 +117,13 @@ if (! empty($type))
|
||||
{
|
||||
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
||||
}
|
||||
//Search period criteria
|
||||
if (dol_strlen($search_dt_start)>0) {
|
||||
$sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
|
||||
}
|
||||
if (dol_strlen($search_dt_end)>0) {
|
||||
$sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'";
|
||||
}
|
||||
// Search criteria amount
|
||||
$si=0;
|
||||
$debit = price2num(str_replace('-','',$debit));
|
||||
@ -128,6 +144,7 @@ $sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog('compta/bank/search.php:: sql='.$sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -147,6 +164,19 @@ if ($resql)
|
||||
print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
|
||||
}
|
||||
|
||||
print '<form method="post" action="search.php" name="search_form">';
|
||||
|
||||
$moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('DateOperationShort') . ': ';
|
||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1);
|
||||
$moreforfilter .= $langs->trans('PeriodEndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1);
|
||||
|
||||
|
||||
if ($moreforfilter) {
|
||||
print '<div class="liste_titre">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder);
|
||||
@ -161,7 +191,6 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="left"> '.$langs->trans("Account").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<form method="post" action="search.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
@ -189,6 +218,8 @@ if ($resql)
|
||||
print '</tr>';
|
||||
|
||||
// Loop on each record
|
||||
$total_debit=0;
|
||||
$total_credit=0;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
@ -259,10 +290,12 @@ if ($resql)
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
print "<td align=\"right\">".price($objp->amount * -1)."</td><td> </td>\n";
|
||||
$total_debit+=$objp->amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td> </td><td align=\"right\">".price($objp->amount)."</td>\n";
|
||||
$total_credit+=$objp->amount;
|
||||
}
|
||||
|
||||
// Bank account
|
||||
@ -275,6 +308,15 @@ if ($resql)
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ($num>0) {
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print '<td align="right">' . price($total_debit * - 1) . '</td>';
|
||||
print '<td align="right">' . price($total_credit) . '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -285,7 +327,7 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Si acc<63>s issu d'une recherche et rien de trouv<75>
|
||||
// If no data to display after a search
|
||||
if ($_POST["action"] == "search" && ! $num)
|
||||
{
|
||||
print $langs->trans("NoRecordFound");
|
||||
|
||||
@ -841,46 +841,56 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
'propal'=>array(
|
||||
'title'=>"ListProposalsAssociatedProject",
|
||||
'class'=>'Propal',
|
||||
'test'=>$conf->propal->enabled),
|
||||
'table'=>'propal',
|
||||
'test'=>$conf->propal->enabled && $user->rights->propale->lire),
|
||||
'order'=>array(
|
||||
'title'=>"ListOrdersAssociatedProject",
|
||||
'class'=>'Commande',
|
||||
'test'=>$conf->commande->enabled),
|
||||
'table'=>'commande',
|
||||
'test'=>$conf->commande->enabled && $user->rights->commande->lire),
|
||||
'invoice'=>array(
|
||||
'title'=>"ListInvoicesAssociatedProject",
|
||||
'class'=>'Facture',
|
||||
'test'=>$conf->facture->enabled),
|
||||
'table'=>'facture',
|
||||
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
|
||||
'invoice_predefined'=>array(
|
||||
'title'=>"ListPredefinedInvoicesAssociatedProject",
|
||||
'class'=>'FactureRec',
|
||||
'test'=>$conf->facture->enabled),
|
||||
'table'=>'facture_rec',
|
||||
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
|
||||
'order_supplier'=>array(
|
||||
'title'=>"ListSupplierOrdersAssociatedProject",
|
||||
'table'=>'commande_fournisseur',
|
||||
'class'=>'CommandeFournisseur',
|
||||
'test'=>$conf->fournisseur->enabled),
|
||||
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire),
|
||||
'invoice_supplier'=>array(
|
||||
'title'=>"ListSupplierInvoicesAssociatedProject",
|
||||
'table'=>'facture_fourn',
|
||||
'class'=>'FactureFournisseur',
|
||||
'test'=>$conf->fournisseur->enabled),
|
||||
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire),
|
||||
'contract'=>array(
|
||||
'title'=>"ListContractAssociatedProject",
|
||||
'class'=>'Contrat',
|
||||
'test'=>$conf->contrat->enabled),
|
||||
'table'=>'contrat',
|
||||
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
|
||||
'intervention'=>array(
|
||||
'title'=>"ListFichinterAssociatedProject",
|
||||
'class'=>'Fichinter',
|
||||
'table'=>'fichinter',
|
||||
'disableamount'=>1,
|
||||
'test'=>$conf->ficheinter->enabled),
|
||||
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
|
||||
'trip'=>array(
|
||||
'title'=>"ListTripAssociatedProject",
|
||||
'class'=>'Deplacement',
|
||||
'table'=>'deplacement',
|
||||
'disableamount'=>1,
|
||||
'test'=>$conf->deplacement->enabled),
|
||||
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
|
||||
'agenda'=>array(
|
||||
'title'=>"ListActionsAssociatedProject",
|
||||
'class'=>'ActionComm',
|
||||
'table'=>'actioncomm',
|
||||
'disableamount'=>1,
|
||||
'test'=>$conf->agenda->enabled)
|
||||
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire)
|
||||
);
|
||||
|
||||
//Insert reference
|
||||
@ -891,11 +901,12 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
foreach ($listofreferent as $keyref => $valueref)
|
||||
{
|
||||
$title=$valueref['title'];
|
||||
$tablename=$valueref['table'];
|
||||
$classname=$valueref['class'];
|
||||
$qualified=$valueref['test'];
|
||||
if ($qualified)
|
||||
{
|
||||
$elementarray = $object->get_element_list($keyref);
|
||||
$elementarray = $object->get_element_list($keyref, $tablename);
|
||||
if (count($elementarray)>0 && is_array($elementarray))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
@ -170,6 +170,8 @@ LastSubscriptionAmount=Last subscription amount
|
||||
MembersStatisticsByCountries=Members statistics by country
|
||||
MembersStatisticsByState=Members statistics by state/province
|
||||
MembersStatisticsByTown=Members statistics by town
|
||||
MembersStatisticsByRegion=Members statistics by region
|
||||
MemberByRegion=Members by region
|
||||
NbOfMembers=Number of members
|
||||
NoValidatedMemberYet=No validated members found
|
||||
MembersByCountryDesc=This screen show you statistics on members by countries. Graphic depends however on Google online graph service and is available only if an internet connection is is working.
|
||||
|
||||
@ -389,33 +389,17 @@ class Project extends CommonObject
|
||||
* Return list of elements for type linked to project
|
||||
*
|
||||
* @param string $type 'propal','order','invoice','order_supplier','invoice_supplier'
|
||||
* @param string $tablename name of table associated of the type
|
||||
* @return array List of orders linked to project, <0 if error
|
||||
*/
|
||||
function get_element_list($type)
|
||||
function get_element_list($type, $tablename)
|
||||
{
|
||||
$elements = array();
|
||||
|
||||
$sql = '';
|
||||
if ($type == 'propal')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "propal WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'order')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "commande WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'invoice')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facture WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'invoice_predefined')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facture_rec WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'order_supplier')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "commande_fournisseur WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'invoice_supplier')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "facture_fourn WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'contract')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "contrat WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'intervention')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "fichinter WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'trip')
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "deplacement WHERE fk_projet=" . $this->id;
|
||||
if ($type == 'agenda')
|
||||
$sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project=" . $this->id;
|
||||
else
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $tablename." WHERE fk_projet=" . $this->id;
|
||||
if (! $sql) return -1;
|
||||
|
||||
//print $sql;
|
||||
|
||||
@ -151,6 +151,7 @@ $listofreferent=array(
|
||||
'invoice'=>array(
|
||||
'title'=>"ListInvoicesAssociatedProject",
|
||||
'class'=>'Facture',
|
||||
'margin'=>'add',
|
||||
'table'=>'facture',
|
||||
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
|
||||
'invoice_predefined'=>array(
|
||||
@ -166,6 +167,7 @@ $listofreferent=array(
|
||||
'invoice_supplier'=>array(
|
||||
'title'=>"ListSupplierInvoicesAssociatedProject",
|
||||
'class'=>'FactureFournisseur',
|
||||
'margin'=>'minus',
|
||||
'table'=>'facture_fourn',
|
||||
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire),
|
||||
'contract'=>array(
|
||||
@ -183,6 +185,7 @@ $listofreferent=array(
|
||||
'title'=>"ListTripAssociatedProject",
|
||||
'class'=>'Deplacement',
|
||||
'table'=>'deplacement',
|
||||
'margin'=>'minus',
|
||||
'disableamount'=>1,
|
||||
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
|
||||
'agenda'=>array(
|
||||
@ -237,7 +240,7 @@ foreach ($listofreferent as $key => $value)
|
||||
if (empty($value['disableamount'])) print '<td align="right" width="120">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right" width="200">'.$langs->trans("Status").'</td>';
|
||||
print '</tr>';
|
||||
$elementarray = $project->get_element_list($key);
|
||||
$elementarray = $project->get_element_list($key, $tablename);
|
||||
if (count($elementarray)>0 && is_array($elementarray))
|
||||
{
|
||||
$var=true;
|
||||
@ -334,6 +337,74 @@ foreach ($listofreferent as $key => $value)
|
||||
}
|
||||
}
|
||||
|
||||
// Margin display of the project
|
||||
print_titre("Margin");
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left" width="200">'.$langs->trans("Element").'</td>';
|
||||
print '<td align="right" width="100">'.$langs->trans("Number").'</td>';
|
||||
print '<td align="right" width="100">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right" width="100">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$title=$value['title'];
|
||||
$classname=$value['class'];
|
||||
$tablename=$value['table'];
|
||||
$qualified=$value['test'];
|
||||
$margin = $value['margin'];
|
||||
if (isset($margin))
|
||||
{
|
||||
$elementarray = $project->get_element_list($key, $tablename);
|
||||
if (count($elementarray)>0 && is_array($elementarray))
|
||||
{
|
||||
$var=true;
|
||||
$total_ht = 0;
|
||||
$total_ttc = 0;
|
||||
$num=count($elementarray);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$element = new $classname($db);
|
||||
$element->fetch($elementarray[$i]);
|
||||
$element->fetch_thirdparty();
|
||||
//print $classname;
|
||||
|
||||
$total_ht = $total_ht + $element->total_ht;
|
||||
$total_ttc = $total_ttc + $element->total_ttc;
|
||||
}
|
||||
|
||||
print '<tr >';
|
||||
print '<td align="left" >'.$classname.'</td>';
|
||||
print '<td align="right">'.$i.'</td>';
|
||||
print '<td align="right">'.price($total_ht).'</td>';
|
||||
print '<td align="right">'.price($total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
if ($margin=="add")
|
||||
{
|
||||
$margin_ht+= $total_ht;
|
||||
$margin_ttc+= $total_ttc;
|
||||
}
|
||||
else
|
||||
{
|
||||
$margin_ht-= $total_ht;
|
||||
$margin_ttc-= $total_ttc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// and the margin amount total
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="right" colspan=2 >'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right" >'.price($margin_ht).'</td>';
|
||||
print '<td align="right" >'.price($margin_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -290,7 +290,7 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
|
||||
$result=$thirdparty->fetch($id,$ref,$ref_ext);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
|
||||
$thirdparty_result_fields=array(
|
||||
'id' => $thirdparty->id,
|
||||
'ref' => $thirdparty->name,
|
||||
@ -328,16 +328,16 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
|
||||
'vat_number' => $thirdparty->tva_intra,
|
||||
'note_private' => $thirdparty->note_private,
|
||||
'note_public' => $thirdparty->note_public);
|
||||
|
||||
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields=new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);
|
||||
//Get extrafield values
|
||||
$thirdparty->fetch_optionals($thirdparty->id,$extralabels);
|
||||
|
||||
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
{
|
||||
$thirdparty_result_fields=array_merge($thirdparty_result_fields,array('options_'.$key => $thirdparty->array_options['options_'.$key]));
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ function createThirdParty($authentication,$thirdparty)
|
||||
|
||||
$newobject->canvas=$thirdparty['canvas'];
|
||||
$newobject->particulier=$thirdparty['individual'];
|
||||
|
||||
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields=new ExtraFields($db);
|
||||
@ -520,16 +520,16 @@ function updateThirdParty($authentication,$thirdparty)
|
||||
if (! $error)
|
||||
{
|
||||
$objectfound=false;
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$object=new Societe($db);
|
||||
$result=$object->fetch($thirdparty['id']);
|
||||
|
||||
|
||||
if (!empty($object->id)) {
|
||||
|
||||
|
||||
$objectfound=true;
|
||||
|
||||
|
||||
$object->ref=$thirdparty['ref'];
|
||||
$object->name=$thirdparty['ref'];
|
||||
$object->ref_ext=$thirdparty['ref_ext'];
|
||||
@ -546,12 +546,12 @@ function updateThirdParty($authentication,$thirdparty)
|
||||
$object->address=$thirdparty['address'];
|
||||
$object->zip=$thirdparty['zip'];
|
||||
$object->town=$thirdparty['town'];
|
||||
|
||||
|
||||
$object->country_id=$thirdparty['country_id'];
|
||||
if ($thirdparty['country_code']) $object->country_id=getCountry($thirdparty['country_code'],3);
|
||||
$object->province_id=$thirdparty['province_id'];
|
||||
//if ($thirdparty['province_code']) $newobject->province_code=getCountry($thirdparty['province_code'],3);
|
||||
|
||||
|
||||
$object->phone=$thirdparty['phone'];
|
||||
$object->fax=$thirdparty['fax'];
|
||||
$object->email=$thirdparty['email'];
|
||||
@ -562,15 +562,15 @@ function updateThirdParty($authentication,$thirdparty)
|
||||
$object->idprof4=$thirdparty['profid4'];
|
||||
$object->idprof5=$thirdparty['profid5'];
|
||||
$object->idprof6=$thirdparty['profid6'];
|
||||
|
||||
|
||||
$object->capital=$thirdparty['capital'];
|
||||
|
||||
|
||||
$object->barcode=$thirdparty['barcode'];
|
||||
$object->tva_assuj=$thirdparty['vat_used'];
|
||||
$object->tva_intra=$thirdparty['vat_number'];
|
||||
|
||||
|
||||
$object->canvas=$thirdparty['canvas'];
|
||||
|
||||
|
||||
//Retreive all extrafield for thirdsparty
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields=new ExtraFields($db);
|
||||
@ -580,9 +580,9 @@ function updateThirdParty($authentication,$thirdparty)
|
||||
$key='options_'.$key;
|
||||
$object->array_options[$key]=$thirdparty[$key];
|
||||
}
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$result=$object->update($thirdparty['id'],$fuser);
|
||||
if ($result <= 0) {
|
||||
$error++;
|
||||
@ -640,6 +640,7 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
||||
// Init and check authentication
|
||||
$objectresp=array();
|
||||
$arraythirdparties=array();
|
||||
|
||||
$errorcode='';$errorlabel='';
|
||||
$error=0;
|
||||
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
|
||||
@ -647,9 +648,11 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql ="SELECT s.rowid, s.nom as ref, s.ref_ext, s.address, s.zip, s.town, p.libelle as country, s.phone, s.fax, s.url";
|
||||
$sql ="SELECT s.rowid as socRowid, s.nom as ref, s.ref_ext, s.address, s.zip, s.town, p.libelle as country, s.phone, s.fax, s.url, extra.*";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON s.fk_pays = p.rowid';
|
||||
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as extra ON s.rowid=fk_object";
|
||||
|
||||
$sql.=" WHERE entity=".$conf->entity;
|
||||
foreach($filterthirdparty as $key => $val)
|
||||
{
|
||||
@ -658,6 +661,11 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
||||
if ($key == 'category' && $val != '') $sql.=" AND s.rowid IN (SELECT fk_societe FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") ";
|
||||
}
|
||||
dol_syslog("Function: getListOfThirdParties sql=".$sql);
|
||||
|
||||
$extrafields=new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -666,18 +674,25 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$extrafieldsOptions=array();
|
||||
$obj=$db->fetch_object($resql);
|
||||
$arraythirdparties[]=array('id'=>$obj->rowid,
|
||||
'ref'=>$obj->ref,
|
||||
'ref_ext'=>$obj->ref_ext,
|
||||
'adress'=>$obj->adress,
|
||||
'zip'=>$obj->zip,
|
||||
'town'=>$obj->town,
|
||||
'country'=>$obj->country,
|
||||
'phone'=>$obj->phone,
|
||||
'fax'=>$obj->fax,
|
||||
'url'=>$obj->url
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$extrafieldsOptions['options_'.$key] = $obj->{$key};
|
||||
}
|
||||
$arraythirdparties[]=array('id'=>$obj->socRowid,
|
||||
'ref'=>$obj->ref,
|
||||
'ref_ext'=>$obj->ref_ext,
|
||||
'adress'=>$obj->adress,
|
||||
'zip'=>$obj->zip,
|
||||
'town'=>$obj->town,
|
||||
'country'=>$obj->country,
|
||||
'phone'=>$obj->phone,
|
||||
'fax'=>$obj->fax,
|
||||
'url'=>$obj->url
|
||||
);
|
||||
$arraythirdparties[$i] = array_merge($arraythirdparties[$i],$extrafieldsOptions);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user