Skip to content

Commit

Permalink
Merge remote-tracking branch 'Upstream/develop' into develop-hrm
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Oct 10, 2015
2 parents bde7279 + d7dbc8a commit f6947af
Show file tree
Hide file tree
Showing 58 changed files with 1,113 additions and 530 deletions.
168 changes: 88 additions & 80 deletions htdocs/accountancy/journal/bankjournal.php
Expand Up @@ -40,6 +40,7 @@
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
Expand Down Expand Up @@ -120,6 +121,7 @@
$societestatic = new Societe($db);
$userstatic = new User($db);
$chargestatic = new ChargeSociales($db);
$paymentdonstatic = new PaymentDonation($db);
$paymentvatstatic = new TVA($db);
$paymentsalstatic = new PaymentSalary($db);

Expand All @@ -133,7 +135,8 @@
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
$accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
$accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));

$accountancy_account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : $langs->trans("CodeNotDef"));

$tabpay = array ();
$tabbq = array ();
$tabtp = array ();
Expand Down Expand Up @@ -174,95 +177,100 @@
// get_url may return -1 which is not traversable
if (is_array($links))
{

foreach ( $links as $key => $val )
{
$tabtype[$obj->rowid] = $links[$key]['type'];

if ($links[$key]['type'] == 'payment')
{
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'payment_supplier')
foreach ( $links as $key => $val )
{
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'company')
{
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
else if ($links[$key]['type'] == 'user')
{
$userstatic->id = $links[$key]['url_id'];
$userstatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
// $tabtp[$obj->rowid][$compta_user] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];

$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
$tabtype[$obj->rowid] = $links[$key]['type'];

if ($links[$key]['type'] == 'payment')
{
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
}
else if ($links[$key]['type'] == 'payment_supplier')
{
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
}
else
else if ($links[$key]['type'] == 'company')
{
$chargestatic->lib = $links[$key]['label'];
$societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
else if ($links[$key]['type'] == 'user')
{
$userstatic->id = $links[$key]['url_id'];
$userstatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
// $tabtp[$obj->rowid][$compta_user] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];

$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]);
}
else
{
$chargestatic->lib = $links[$key]['label'];
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);

$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;


dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid)
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid)
{
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
}
else if ($links[$key]['type'] == 'payment_donation')
{
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
$paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation");
$tabtp[$obj->rowid][$accountancy_account_pay_donation] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat");
$tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$paymentsalstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
}
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
}
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat");
$tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$paymentsalstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
}
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
/*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/
}

}

$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
Expand Down
5 changes: 3 additions & 2 deletions htdocs/adherents/list.php
Expand Up @@ -195,9 +195,10 @@
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
$moreforfilter.='</div>';
}
if (! empty($moreforfilter))
{
Expand All @@ -209,7 +210,7 @@
print '</div>';
}

print '<table class="liste">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/adherents/stats/byproperties.php
Expand Up @@ -116,7 +116,7 @@
}

// Print array
print '<table class="border" width="100%">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Nature").'</td>';
print '<td align="center">'.$langs->trans("NbOfMembers").'</td>';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/adherents/stats/geo.php
Expand Up @@ -282,7 +282,7 @@
if ($mode)
{
// Print array / Affiche le tableau
print '<table class="border" width="100%">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td align="center">'.$label.'</td>';
if ($label2) print '<td align="center">'.$label2.'</td>';
Expand Down
12 changes: 7 additions & 5 deletions htdocs/adherents/stats/index.php
Expand Up @@ -167,23 +167,24 @@
$data = $stats->getAllByYear();


print '<table class="border" width="100%">';
print '<tr height="24">';
print '<table class="noborder">';
print '<tr class="liste_titre" height="24">';
print '<td align="center">'.$langs->trans("Year").'</td>';
print '<td align="center">'.$langs->trans("NbOfSubscriptions").'</td>';
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
print '</tr>';

$oldyear=0;
$var=false;
foreach ($data as $val)
{
$year = $val['year'];
print $avg;
while ($oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr height="24">';
$var=!$var;
print '<tr '.$bc[$var].' height="24">';
print '<td align="center">';
print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">';
print $oldyear;
Expand All @@ -194,7 +195,8 @@
print '<td align="right">0</td>';
print '</tr>';
}
print '<tr height="24">';
$var=!$var;
print '<tr '.$bc[$var].' height="24">';
print '<td align="center">';
//print '<a href="month.php?year='.$year.'">';
print $year;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/adherents/type.php
Expand Up @@ -168,7 +168,7 @@

print load_fiche_titre($langs->trans("MembersTypes"));

dol_fiche_head('');
//dol_fiche_head('');

$sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
Expand Down Expand Up @@ -211,7 +211,7 @@
dol_print_error($db);
}

dol_fiche_end();
//dol_fiche_end();

/*
* Hotbar
Expand Down
30 changes: 29 additions & 1 deletion htdocs/asterisk/wrapper.php
Expand Up @@ -112,6 +112,34 @@ function llxFooter()

llxHeader();

$sql = "SELECT s.nom as name FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid";
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND (s.phone='".$db->escape($called)."'";
$sql.= " OR sp.phone='".$db->escape($called)."'";
$sql.= " OR sp.phone_perso='".$db->escape($called)."'";
$sql.= " OR sp.phone_mobile='".$db->escape($called)."')";
$sql.= $db->plimit(1);

dol_syslog('click to dial search information with phone '.$called, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj)
{
$found = $obj->name;
} else {
$found = $notfound;
}
$db->free($resql);
}
else
{
dol_print_error($db,'Error');
$found = 'Error';
}

$number=strtolower($called);
$pos=strpos($number,"local");
if (! empty($number))
Expand All @@ -120,7 +148,7 @@ function llxFooter()
{
$errno=0;
$errstr=0;
$strCallerId = "Dolibarr <".strtolower($caller).">";
$strCallerId = "Dolibarr call $found <".strtolower($number).">";
$oSocket = @fsockopen($strHost, $port, $errno, $errstr, 10);
if (!$oSocket)
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/comm/action/class/actioncomm.class.php
Expand Up @@ -220,7 +220,7 @@ function add($user,$notrigger=0)
$this->userassigned[$tmpid]=array('id'=>$tmpid);
}

if (is_object($this->contact) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated


$userownerid=$this->userownerid;
Expand Down

0 comments on commit f6947af

Please sign in to comment.