Merge remote-tracking branch 'Dolibarr/3.5' into 3.5
This commit is contained in:
commit
249883dda2
10
ChangeLog
10
ChangeLog
@ -3,7 +3,7 @@ English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
|
||||
Fix: Paypal link were broken dur to SSL v3 closed.
|
||||
Fix: Paypal link were broken due to SSL v3 closed.
|
||||
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
||||
Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 00H
|
||||
Fix: [ bug #1757 ] Sorting breaks product/service statistics
|
||||
@ -22,6 +22,14 @@ Fix: [ bug #2861 ] Undefined variable $res when migrating
|
||||
Fix: [ bug #2837 ] Product list table column header does not match column body
|
||||
Fix: [ bug #2835 ] Customer prices of a product shows incorrect history order
|
||||
Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page
|
||||
Fix: [ bug #2715 ] Statistics page has broken layout with long thirdparty names
|
||||
Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid
|
||||
Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter
|
||||
Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result
|
||||
Fix: [ bug #1791 ] Margin menu not available if any Finance module is not enabled
|
||||
Fix: [ bug #3310 ] OrderLine::fetch, FactureLigne::fetch and PropaleLigne::fetch do not return anything
|
||||
Fix: [ bug #3206 ] PropaleLigne, OrderLine and FactureLigne given to triggers through update function does not contain all the information
|
||||
Fix: [ bug #3313 ] Error enabling module with PostgreSQL database
|
||||
|
||||
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
||||
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
||||
|
||||
@ -984,7 +984,7 @@ if ($nboftargetok) {
|
||||
print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n";
|
||||
unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe";
|
||||
|
||||
print "Check that in your Wine setup, you create a Z: drive that point to your /tmp directory.\n";
|
||||
print "Check that in your Wine setup, you create a Z: drive that point to your / directory.\n";
|
||||
|
||||
$SOURCEBACK=$SOURCE;
|
||||
$SOURCEBACK =~ s/\//\\/g;
|
||||
|
||||
@ -528,13 +528,14 @@ class Propal extends CommonObject
|
||||
$price = $pu - $remise;
|
||||
}
|
||||
|
||||
// Update line
|
||||
$this->line=new PropaleLigne($this->db);
|
||||
//Fetch current line from the database and then clone the object and set it in $oldline property
|
||||
$line = new PropaleLigne($this->db);
|
||||
$line->fetch($rowid);
|
||||
|
||||
// Stock previous line records
|
||||
$staticline=new PropaleLigne($this->db);
|
||||
$staticline->fetch($rowid);
|
||||
$this->line->oldline = $staticline;
|
||||
$staticline = clone $line;
|
||||
|
||||
$line->oldline = $staticline;
|
||||
$this->line = $line;
|
||||
|
||||
// Reorder if fk_parent_line change
|
||||
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
|
||||
@ -2845,10 +2846,12 @@ class PropaleLigne extends CommonObject
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2876,11 +2879,12 @@ class PropaleLigne extends CommonObject
|
||||
if (empty($this->total_localtax2)) $this->total_localtax2=0;
|
||||
if (empty($this->rang)) $this->rang=0;
|
||||
if (empty($this->remise)) $this->remise=0;
|
||||
if (empty($this->remise_percent)) $this->remise_percent=0;
|
||||
if (empty($this->remise_percent) || ! is_numeric($this->remise_percent)) $this->remise_percent=0;
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
|
||||
if (! is_numeric($this->qty)) $this->qty = 0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
|
||||
@ -2349,13 +2349,14 @@ class Commande extends CommonOrder
|
||||
$price = ($pu - $remise);
|
||||
}
|
||||
|
||||
// Update line
|
||||
$this->line=new OrderLine($this->db);
|
||||
//Fetch current line from the database and then clone the object and set it in $oldline property
|
||||
$line = new OrderLine($this->db);
|
||||
$line->fetch($rowid);
|
||||
|
||||
// Stock previous line records
|
||||
$staticline=new OrderLine($this->db);
|
||||
$staticline->fetch($rowid);
|
||||
$this->line->oldline = $staticline;
|
||||
$staticline = clone $line;
|
||||
|
||||
$line->oldline = $staticline;
|
||||
$this->line = $line;
|
||||
|
||||
// Reorder if fk_parent_line change
|
||||
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
|
||||
@ -3156,10 +3157,12 @@ class OrderLine extends CommonOrderLine
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1133,7 +1133,6 @@ class AccountLine extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2224,13 +2224,14 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
$price = price2num($price);
|
||||
|
||||
// Update line into database
|
||||
$this->line=new FactureLigne($this->db);
|
||||
//Fetch current line from the database and then clone the object and set it in $oldline property
|
||||
$line = new FactureLigne($this->db);
|
||||
$line->fetch($rowid);
|
||||
|
||||
// Stock previous line records
|
||||
$staticline=new FactureLigne($this->db);
|
||||
$staticline->fetch($rowid);
|
||||
$this->line->oldline = $staticline;
|
||||
$staticline = clone $line;
|
||||
|
||||
$line->oldline = $staticline;
|
||||
$this->line = $line;
|
||||
|
||||
// Reorder if fk_parent_line change
|
||||
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
|
||||
@ -3471,10 +3472,12 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -217,6 +217,13 @@ complete_head_from_modules($conf,$langs,null,$head,$h,$type);
|
||||
|
||||
dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
||||
|
||||
$tmp_companies = $form->select_thirdparty_list($socid,'socid',$filter,1, 0, 0, array(), '', 1);
|
||||
//Array passed as an argument to Form::selectarray to build a proper select input
|
||||
$companies = array();
|
||||
|
||||
foreach ($tmp_companies as $value) {
|
||||
$companies[$value['value']] = $value['label'];
|
||||
}
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
@ -232,7 +239,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, 'style="width: 100%"');
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* 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
|
||||
@ -685,7 +686,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
$chargestatic->lib=$obj->libelle;
|
||||
$chargestatic->paye=$obj->paye;
|
||||
print '<td>'.$chargestatic->getNomUrl(1).'</td>';
|
||||
print '<td align="center">'.dol_print_date($obj->date_ech,'day').'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_ech),'day').'</td>';
|
||||
print '<td align="right">'.price($obj->amount).'</td>';
|
||||
print '<td align="right">'.price($obj->sumpaid).'</td>';
|
||||
print '<td align="center">'.$chargestatic->getLibStatut(3).'</td>';
|
||||
@ -1026,7 +1027,7 @@ if ($resql)
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var]."><td>".dol_print_date($obj->da,"day")."</td>";
|
||||
print "<tr ".$bc[$var]."><td>".dol_print_date($db->jdate($obj->da),"day")."</td>";
|
||||
print "<td><a href=\"action/fiche.php\">$obj->libelle $obj->label</a></td></tr>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class RejetPrelevement
|
||||
|
||||
dol_syslog("RejetPrelevement::Create id $id");
|
||||
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
|
||||
$facs = $this->getListInvoices();
|
||||
$facs = $this->getListInvoices(1);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -132,7 +132,7 @@ class RejetPrelevement
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$fac = new Facture($this->db);
|
||||
$fac->fetch($facs[$i]);
|
||||
$fac->fetch($facs[$i][0]);
|
||||
|
||||
// Make a negative payment
|
||||
$pai = new Paiement($this->db);
|
||||
@ -144,7 +144,7 @@ class RejetPrelevement
|
||||
* PHP installs sends only the part integer negative
|
||||
*/
|
||||
|
||||
$pai->amounts[$facs[$i]] = price2num($fac->total_ttc * -1);
|
||||
$pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * -1);
|
||||
$pai->datepaye = $date_rejet;
|
||||
$pai->paiementid = 3; // type of payment: withdrawal
|
||||
$pai->num_paiement = $fac->ref;
|
||||
@ -152,7 +152,7 @@ class RejetPrelevement
|
||||
if ($pai->create($this->user) < 0) // we call with no_commit
|
||||
{
|
||||
$error++;
|
||||
dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i]);
|
||||
dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -269,22 +269,24 @@ class RejetPrelevement
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the list of invoices
|
||||
* Retrieve the list of invoices
|
||||
* @param int $amounts If you want to get the amount of the order for each invoice
|
||||
*
|
||||
* @return void
|
||||
* @return Array List of invoices related to the withdrawal line
|
||||
* @TODO A withdrawal line is today linked to one and only one invoice. So the function should return only one object ?
|
||||
*/
|
||||
private function getListInvoices()
|
||||
private function getListInvoices($amounts=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$arr = array();
|
||||
|
||||
//Returns all invoices of a withdrawal
|
||||
$sql = "SELECT f.rowid as facid";
|
||||
$sql = "SELECT f.rowid as facid, pl.amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON (pf.fk_prelevement_lignes = pl.rowid)";
|
||||
$sql.= " WHERE pf.fk_prelevement_lignes = ".$this->id;
|
||||
$sql.= " AND pf.fk_facture = f.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
@ -298,7 +300,14 @@ class RejetPrelevement
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$arr[$i] = $row[0];
|
||||
if (!$amounts) $arr[$i] = $row[0];
|
||||
else
|
||||
{
|
||||
$arr[$i] = array(
|
||||
$row[0],
|
||||
$row[1]
|
||||
);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,81 +33,80 @@ $id = GETPOST('id', 'int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
$contact = new Contact($db);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($id, $user);
|
||||
|
||||
|
||||
$head = contact_prepare_head($contact);
|
||||
|
||||
dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
|
||||
|
||||
|
||||
/*
|
||||
* Fiche en mode visu
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($contact, 'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
|
||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
if ($id > 0)
|
||||
{
|
||||
if ($contact->socid > 0)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
$contact->fetch($id, $user);
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
print '</td></tr>';
|
||||
}
|
||||
$head = contact_prepare_head($contact);
|
||||
|
||||
dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
|
||||
|
||||
|
||||
/*
|
||||
* Fiche en mode visu
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($contact, 'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
|
||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
if ($contact->socid > 0)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $contact->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("ExportCardToFormat").': ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$contact->id.'">';
|
||||
print img_picto($langs->trans("VCard"),'vcard.png').' ';
|
||||
print $langs->trans("VCard");
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $contact->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("ExportCardToFormat").': ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$contact->id.'">';
|
||||
print img_picto($langs->trans("VCard"),'vcard.png').' ';
|
||||
print $langs->trans("VCard");
|
||||
print '</a>';
|
||||
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
@ -35,6 +35,8 @@ $contactid = GETPOST("id",'int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
|
||||
|
||||
$contact = new Contact($db);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -43,25 +45,26 @@ $result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
|
||||
|
||||
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
|
||||
if ($contactid > 0)
|
||||
{
|
||||
$result = $contact->fetch($contactid, $user);
|
||||
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($contactid, $user);
|
||||
$contact->info($contactid);
|
||||
$contact->info($contactid);
|
||||
|
||||
|
||||
$head = contact_prepare_head($contact);
|
||||
$head = contact_prepare_head($contact);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("ContactsAddresses"), 0, 'contact');
|
||||
dol_fiche_head($head, 'info', $langs->trans("ContactsAddresses"), 0, 'contact');
|
||||
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
print '</td></tr></table>';
|
||||
print '<table width="100%"><tr><td>';
|
||||
print '</td></tr></table>';
|
||||
|
||||
dol_print_object_info($contact);
|
||||
dol_print_object_info($contact);
|
||||
|
||||
print "</div>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -40,37 +40,40 @@ if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($id, $user);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'dolibarr2ldap')
|
||||
if ($id > 0)
|
||||
{
|
||||
$message="";
|
||||
$contact->fetch($id, $user);
|
||||
|
||||
$db->begin();
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$ldap=new Ldap();
|
||||
$result=$ldap->connect_bind();
|
||||
|
||||
$info=$contact->_load_ldap_info();
|
||||
$dn=$contact->_load_ldap_dn($info);
|
||||
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
||||
|
||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||
|
||||
if ($result >= 0)
|
||||
if ($action == 'dolibarr2ldap')
|
||||
{
|
||||
$message.='<div class="ok">'.$langs->trans("ContactSynchronized").'</div>';
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<div class="error">'.$ldap->error.'</div>';
|
||||
$db->rollback();
|
||||
$message="";
|
||||
|
||||
$db->begin();
|
||||
|
||||
$ldap=new Ldap();
|
||||
$result=$ldap->connect_bind();
|
||||
|
||||
$info=$contact->_load_ldap_info();
|
||||
$dn=$contact->_load_ldap_dn($info);
|
||||
$olddn=$dn; // We can say that old dn = dn as we force synchro
|
||||
|
||||
$result=$ldap->update($dn,$info,$user,$olddn);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$message.='<div class="ok">'.$langs->trans("ContactSynchronized").'</div>';
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$message.='<div class="error">'.$ldap->error.'</div>';
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,138 +82,139 @@ if ($action == 'dolibarr2ldap')
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$head = contact_prepare_head($contact);
|
||||
|
||||
dol_fiche_head($head, 'ldap', $title, 0, 'contact');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($contact,'id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
|
||||
print '<td>'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
|
||||
|
||||
// Company
|
||||
if ($contact->socid > 0)
|
||||
if ($id > 0)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
$head = contact_prepare_head($contact);
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
dol_fiche_head($head, 'ldap', $title, 0, 'contact');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($contact,'id');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $contact->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
// Name
|
||||
print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
|
||||
print '<td>'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
|
||||
|
||||
// LDAP DN
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPContactDn").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_CONTACT_DN."</td></tr>\n";
|
||||
|
||||
// LDAP Cle
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_KEY_CONTACTS."</td></tr>\n";
|
||||
|
||||
// LDAP Server
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr')
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$contact->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') print "<br>\n";
|
||||
|
||||
|
||||
|
||||
// Affichage attributs LDAP
|
||||
print_titre($langs->trans("LDAPInformationsForThisContact"));
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("LDAPAttributes").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Lecture LDAP
|
||||
$ldap=new Ldap();
|
||||
$result=$ldap->connect_bind();
|
||||
if ($result > 0)
|
||||
{
|
||||
$info=$contact->_load_ldap_info();
|
||||
$dn=$contact->_load_ldap_dn($info,1);
|
||||
$search = "(".$contact->_load_ldap_dn($info,2).")";
|
||||
$records=$ldap->getAttribute($dn,$search);
|
||||
|
||||
//var_dump($records);
|
||||
|
||||
// Affichage arbre
|
||||
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
|
||||
// Company
|
||||
if ($contact->socid > 0)
|
||||
{
|
||||
if (! is_array($records))
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=show_ldap_content($records,0,$records['count'],true);
|
||||
}
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $contact->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
// LDAP DN
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPContactDn").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_CONTACT_DN."</td></tr>\n";
|
||||
|
||||
// LDAP Cle
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPNamingAttribute").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_KEY_CONTACTS."</td></tr>\n";
|
||||
|
||||
// LDAP Server
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPPrimaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPSecondaryServer").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_HOST_SLAVE."</td></tr>\n";
|
||||
print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur" colspan="3">'.$conf->global->LDAP_SERVER_PORT."</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_htmloutput_mesg($message);
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr')
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$contact->id.'&action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') print "<br>\n";
|
||||
|
||||
|
||||
|
||||
// Affichage attributs LDAP
|
||||
print_titre($langs->trans("LDAPInformationsForThisContact"));
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("LDAPAttributes").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Lecture LDAP
|
||||
$ldap=new Ldap();
|
||||
$result=$ldap->connect_bind();
|
||||
if ($result > 0)
|
||||
{
|
||||
$info=$contact->_load_ldap_info();
|
||||
$dn=$contact->_load_ldap_dn($info,1);
|
||||
$search = "(".$contact->_load_ldap_dn($info,2).")";
|
||||
$records=$ldap->getAttribute($dn,$search);
|
||||
|
||||
//var_dump($records);
|
||||
|
||||
// Affichage arbre
|
||||
if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0))
|
||||
{
|
||||
if (! is_array($records))
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=show_ldap_content($records,0,$records['count'],true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
|
||||
}
|
||||
|
||||
$ldap->unbind();
|
||||
$ldap->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('',$ldap->error);
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error('',$ldap->error);
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
|
||||
@ -38,210 +38,213 @@ if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
$object = new Contact($db);
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
$result = $object->fetch($id, $user);
|
||||
|
||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
|
||||
if ($id > 0)
|
||||
{
|
||||
$ret = $object->fetch($id);
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
// Note: Correct date should be completed with location to have exact GM time of birth.
|
||||
$object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
|
||||
$object->birthday_alert = $_POST["birthday_alert"];
|
||||
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
|
||||
{
|
||||
// Note: Correct date should be completed with location to have exact GM time of birth.
|
||||
$object->birthday = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
|
||||
$object->birthday_alert = $_POST["birthday_alert"];
|
||||
|
||||
$result = $object->update_perso($id, $user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->old_name='';
|
||||
$object->old_firstname='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $object->error;
|
||||
}
|
||||
$result = $object->update_perso($id, $user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->old_name='';
|
||||
$object->old_firstname='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $object->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$object->fetch($id, $user);
|
||||
|
||||
$head = contact_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'perso', $title, 0, 'contact');
|
||||
|
||||
if ($action == 'edit')
|
||||
if ($id > 0)
|
||||
{
|
||||
/*
|
||||
* Fiche en mode edition
|
||||
*/
|
||||
$head = contact_prepare_head($object);
|
||||
|
||||
print '<form name="perso" method="POST" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
dol_fiche_head($head, 'perso', $title, 0, 'contact');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $object->id;
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
|
||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
if ($action == 'edit')
|
||||
{
|
||||
if ($object->socid > 0)
|
||||
/*
|
||||
* Fiche en mode edition
|
||||
*/
|
||||
|
||||
print '<form name="perso" method="POST" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $object->id;
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
|
||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($object->socid);
|
||||
if ($object->socid > 0)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($object->socid);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $object->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
// Date To Birth
|
||||
print '<tr><td>'.$langs->trans("DateToBirth").'</td><td>';
|
||||
$form=new Form($db);
|
||||
print $form->select_date($object->birthday,'birthday',0,0,1,"perso");
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="2">'.$langs->trans("Alert").': ';
|
||||
if (! empty($object->birthday_alert))
|
||||
{
|
||||
print '<input type="checkbox" name="birthday_alert" checked="checked"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="checkbox" name="birthday_alert"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print "</table><br>";
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</center>';
|
||||
|
||||
print "</form>";
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Fiche en mode visu
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
|
||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
if ($object->socid > 0)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($object->socid);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $object->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $object->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
// Date To Birth
|
||||
print '<tr>';
|
||||
if (! empty($object->birthday))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.dol_print_date($object->birthday,"day");
|
||||
|
||||
print ' ';
|
||||
//var_dump($birthdatearray);
|
||||
$ageyear=convertSecondToTime($now-$object->birthday,'year')-1970;
|
||||
$agemonth=convertSecondToTime($now-$object->birthday,'month')-1;
|
||||
if ($ageyear >= 2) print '('.$ageyear.' '.$langs->trans("DurationYears").')';
|
||||
else if ($agemonth >= 2) print '('.$agemonth.' '.$langs->trans("DurationMonths").')';
|
||||
else print '('.$agemonth.' '.$langs->trans("DurationMonth").')';
|
||||
|
||||
|
||||
print ' - ';
|
||||
if ($object->birthday_alert) print $langs->trans("BirthdayAlertOn");
|
||||
else print $langs->trans("BirthdayAlertOff");
|
||||
// Date To Birth
|
||||
print '<tr><td>'.$langs->trans("DateToBirth").'</td><td>';
|
||||
$form=new Form($db);
|
||||
print $form->select_date($object->birthday,'birthday',0,0,1,"perso");
|
||||
print '</td>';
|
||||
|
||||
print '<td colspan="2">'.$langs->trans("Alert").': ';
|
||||
if (! empty($object->birthday_alert))
|
||||
{
|
||||
print '<input type="checkbox" name="birthday_alert" checked="checked"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="checkbox" name="birthday_alert"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print "</table><br>";
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</center>';
|
||||
|
||||
print "</form>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.$langs->trans("Unknown")."</td>";
|
||||
}
|
||||
print "</tr>";
|
||||
/*
|
||||
* Fiche en mode visu
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "</table>";
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
}
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
dol_fiche_end();
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
|
||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
// Barre d'actions
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
||||
if ($object->socid > 0)
|
||||
{
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($object->socid);
|
||||
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $object->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
// Date To Birth
|
||||
print '<tr>';
|
||||
if (! empty($object->birthday))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.dol_print_date($object->birthday,"day");
|
||||
|
||||
print ' ';
|
||||
//var_dump($birthdatearray);
|
||||
$ageyear=convertSecondToTime($now-$object->birthday,'year')-1970;
|
||||
$agemonth=convertSecondToTime($now-$object->birthday,'month')-1;
|
||||
if ($ageyear >= 2) print '('.$ageyear.' '.$langs->trans("DurationYears").')';
|
||||
else if ($agemonth >= 2) print '('.$agemonth.' '.$langs->trans("DurationMonths").')';
|
||||
else print '('.$agemonth.' '.$langs->trans("DurationMonth").')';
|
||||
|
||||
|
||||
print ' - ';
|
||||
if ($object->birthday_alert) print $langs->trans("BirthdayAlertOn");
|
||||
else print $langs->trans("BirthdayAlertOff");
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.$langs->trans("Unknown")."</td>";
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
// Barre d'actions
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->societe->contact->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,4 +252,3 @@ if ($action != 'edit')
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -35,70 +35,72 @@ $id = GETPOST('id', 'int');
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
$contact = new Contact($db);
|
||||
$result=$contact->fetch($id);
|
||||
|
||||
$physicalperson=1;
|
||||
|
||||
$company = new Societe($db);
|
||||
if ($contact->socid)
|
||||
if ($id > 0)
|
||||
{
|
||||
$result=$company->fetch($contact->socid);
|
||||
//print "ee";
|
||||
$result=$contact->fetch($id);
|
||||
|
||||
$physicalperson=1;
|
||||
|
||||
$company = new Societe($db);
|
||||
if ($contact->socid)
|
||||
{
|
||||
$result=$company->fetch($contact->socid);
|
||||
//print "ee";
|
||||
}
|
||||
|
||||
// We create VCard
|
||||
$v = new vCard();
|
||||
$v->setProdId('Dolibarr '.DOL_VERSION);
|
||||
|
||||
$v->setUid('DOLIBARR-CONTACTID-'.$contact->id);
|
||||
$v->setName($contact->lastname, $contact->firstname, "", "", "");
|
||||
$v->setFormattedName($contact->getFullName($langs));
|
||||
|
||||
// By default, all informations are for work (except phone_perso and phone_mobile)
|
||||
$v->setPhoneNumber($contact->phone_pro, "PREF;WORK;VOICE");
|
||||
$v->setPhoneNumber($contact->phone_mobile, "CELL;VOICE");
|
||||
$v->setPhoneNumber($contact->fax, "WORK;FAX");
|
||||
|
||||
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK;POSTAL");
|
||||
$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK");
|
||||
$v->setEmail($contact->email,'internet,pref');
|
||||
$v->setNote($contact->note);
|
||||
|
||||
$v->setTitle($contact->poste);
|
||||
|
||||
// Data from linked company
|
||||
if ($company->id)
|
||||
{
|
||||
$v->setURL($company->url, "WORK");
|
||||
if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "WORK;VOICE");
|
||||
if (! $contact->fax) $v->setPhoneNumber($company->fax, "WORK;FAX");
|
||||
if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country_code, "WORK;POSTAL");
|
||||
if ($company->email != $contact->email) $v->setEmail($company->email,'internet');
|
||||
// Si contact lie a un tiers non de type "particulier"
|
||||
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->nom);
|
||||
}
|
||||
|
||||
// Personal informations
|
||||
$v->setPhoneNumber($contact->phone_perso, "HOME;VOICE");
|
||||
if ($contact->birthday) $v->setBirthday($contact->birthday);
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
// Renvoi la VCard au navigateur
|
||||
|
||||
$output = $v->getVCard();
|
||||
|
||||
$filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
|
||||
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
||||
//$filename = dol_sanitizeFileName($filename);
|
||||
|
||||
|
||||
header("Content-Disposition: attachment; filename=\"".$filename."\"");
|
||||
header("Content-Length: ".dol_strlen($output));
|
||||
header("Connection: close");
|
||||
header("Content-Type: text/x-vcard; name=\"".$filename."\"");
|
||||
|
||||
print $output;
|
||||
}
|
||||
|
||||
// We create VCard
|
||||
$v = new vCard();
|
||||
$v->setProdId('Dolibarr '.DOL_VERSION);
|
||||
|
||||
$v->setUid('DOLIBARR-CONTACTID-'.$contact->id);
|
||||
$v->setName($contact->lastname, $contact->firstname, "", "", "");
|
||||
$v->setFormattedName($contact->getFullName($langs));
|
||||
|
||||
// By default, all informations are for work (except phone_perso and phone_mobile)
|
||||
$v->setPhoneNumber($contact->phone_pro, "PREF;WORK;VOICE");
|
||||
$v->setPhoneNumber($contact->phone_mobile, "CELL;VOICE");
|
||||
$v->setPhoneNumber($contact->fax, "WORK;FAX");
|
||||
|
||||
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK;POSTAL");
|
||||
$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK");
|
||||
$v->setEmail($contact->email,'internet,pref');
|
||||
$v->setNote($contact->note);
|
||||
|
||||
$v->setTitle($contact->poste);
|
||||
|
||||
// Data from linked company
|
||||
if ($company->id)
|
||||
{
|
||||
$v->setURL($company->url, "WORK");
|
||||
if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "WORK;VOICE");
|
||||
if (! $contact->fax) $v->setPhoneNumber($company->fax, "WORK;FAX");
|
||||
if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country_code, "WORK;POSTAL");
|
||||
if ($company->email != $contact->email) $v->setEmail($company->email,'internet');
|
||||
// Si contact lie a un tiers non de type "particulier"
|
||||
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->nom);
|
||||
}
|
||||
|
||||
// Personal informations
|
||||
$v->setPhoneNumber($contact->phone_perso, "HOME;VOICE");
|
||||
if ($contact->birthday) $v->setBirthday($contact->birthday);
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
// Renvoi la VCard au navigateur
|
||||
|
||||
$output = $v->getVCard();
|
||||
|
||||
$filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf"
|
||||
$filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
|
||||
//$filename = dol_sanitizeFileName($filename);
|
||||
|
||||
|
||||
header("Content-Disposition: attachment; filename=\"".$filename."\"");
|
||||
header("Content-Length: ".dol_strlen($output));
|
||||
header("Connection: close");
|
||||
header("Content-Type: text/x-vcard; name=\"".$filename."\"");
|
||||
|
||||
print $output;
|
||||
|
||||
?>
|
||||
|
||||
@ -119,7 +119,6 @@ class box_prospect extends ModeleBoxes
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR);
|
||||
$this->info_box_contents[0][0] = array('td' => 'align="left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed"));
|
||||
}
|
||||
|
||||
@ -836,7 +836,7 @@ class Form
|
||||
$out.= '<option value="'.$obj->rowid.'">'.$label.'</option>';
|
||||
}
|
||||
|
||||
array_push($outarray, array('key'=>$obj->rowid, 'value'=>$obj->name, 'label'=>$obj->name));
|
||||
array_push($outarray, array('key'=>$obj->rowid, 'value'=>$obj->rowid, 'label'=>$label));
|
||||
|
||||
$i++;
|
||||
if (($i % 10) == 0) $out.="\n";
|
||||
|
||||
@ -152,7 +152,7 @@ class Menubase
|
||||
$sql.= " '".$this->fk_menu."',";
|
||||
$sql.= " ".($this->fk_mainmenu?"'".$this->fk_mainmenu."'":"null").",";
|
||||
$sql.= " ".($this->fk_leftmenu?"'".$this->fk_leftmenu."'":"null").",";
|
||||
$sql.= " '".$this->position."',";
|
||||
$sql.= " '".(int) $this->position."',";
|
||||
$sql.= " '".$this->db->escape($this->url)."',";
|
||||
$sql.= " '".$this->db->escape($this->target)."',";
|
||||
$sql.= " '".$this->db->escape($this->titre)."',";
|
||||
|
||||
@ -134,9 +134,11 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
}
|
||||
|
||||
// Financial
|
||||
$tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled)),
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire)),
|
||||
'module'=>'comptabilite|accounting|facture|deplacement|don|tax');
|
||||
$tmpentry = array(
|
||||
'enabled' => (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled) || !empty($conf->facture->enabled) || !empty($conf->deplacement->enabled) || !empty($conf->don->enabled) || !empty($conf->tax->enabled) || !empty($conf->margin->enabled)),
|
||||
'perms' => (!empty($user->rights->compta->resultat->lire) || !empty($user->rights->accounting->plancompte->lire) || !empty($user->rights->facture->lire) || !empty($user->rights->deplacement->lire) || !empty($user->rights->don->lire) || !empty($user->rights->tax->charges->lire) || !empty($user->rights->margins->liretous)),
|
||||
'module' => 'comptabilite|accounting|facture|deplacement|don|tax'
|
||||
);
|
||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
{
|
||||
|
||||
@ -1009,7 +1009,6 @@ abstract class DolibarrModules
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
//var_dump($this->menu); exit;
|
||||
foreach ($this->menu as $key => $value)
|
||||
{
|
||||
$menu = new Menubase($this->db);
|
||||
@ -1018,11 +1017,9 @@ abstract class DolibarrModules
|
||||
if (! $this->menu[$key]['fk_menu'])
|
||||
{
|
||||
$menu->fk_menu=0;
|
||||
//print 'aaa'.$this->menu[$key]['fk_menu'];
|
||||
}
|
||||
else
|
||||
{
|
||||
//print 'xxx'.$this->menu[$key]['fk_menu'];exit;
|
||||
$foundparent=0;
|
||||
$fk_parent=$this->menu[$key]['fk_menu'];
|
||||
if (preg_match('/^r=/',$fk_parent)) // old deprecated method
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
* \brief File that include conf.php file and commons lib like functions.lib.php
|
||||
*/
|
||||
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.7');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.5.8');
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
// Define syslog constants
|
||||
|
||||
@ -50,9 +50,9 @@ $pagenext = $page + 1;
|
||||
$startdate=$enddate='';
|
||||
|
||||
if (!empty($_POST['startdatemonth']))
|
||||
$startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
$startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
if (!empty($_POST['enddatemonth']))
|
||||
$enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
$enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@ -72,9 +72,9 @@ $pagenext = $page + 1;
|
||||
$startdate=$enddate='';
|
||||
|
||||
if (!empty($_POST['startdatemonth']))
|
||||
$startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
$startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
if (!empty($_POST['enddatemonth']))
|
||||
$enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
$enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -40,6 +40,7 @@ $result = restrictedArea($user, 'societe', $socid, '&societe');
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('infothirdparty'));
|
||||
|
||||
$soc = new Societe($db);
|
||||
|
||||
|
||||
/*
|
||||
@ -59,27 +60,27 @@ $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->e
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($socid);
|
||||
$soc->info($socid);
|
||||
if ($socid > 0)
|
||||
{
|
||||
$result = $soc->fetch($socid);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($soc);
|
||||
$soc->info($socid);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("ThirdParty"),0,'company');
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($soc);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($soc);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($soc);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -999,6 +999,7 @@ else
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print $object->showOptionals($extrafields,'edit');
|
||||
@ -1407,6 +1408,7 @@ else
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print $object->showOptionals($extrafields,'edit');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user