Merge remote-tracking branch 'origin/3.5' into 3.6

Conflicts:
	htdocs/contact/vcard.php
	htdocs/societe/consumption.php
This commit is contained in:
Laurent Destailleur 2015-07-19 11:38:44 +02:00
commit fbc0b5b313
13 changed files with 508 additions and 468 deletions

View File

@ -212,6 +212,10 @@ Fix: [ bug #2861 ] Undefined variable $res when migrating
Fix: [ bug #2837 ] Product list table column header does not match column body 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 #2835 ] Customer prices of a product shows incorrect history order
Fix: [ bug #2814 ] JPEG photos are not displayed in Product photos page 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
***** ChangeLog for 3.5.6 compared to 3.5.5 ***** ***** ChangeLog for 3.5.6 compared to 3.5.5 *****
Fix: Avoid missing class error for fetch_thirdparty method #1973 Fix: Avoid missing class error for fetch_thirdparty method #1973

View File

@ -217,6 +217,13 @@ complete_head_from_modules($conf,$langs,null,$head,$h,$type);
dol_fiche_head($head,'byyear',$langs->trans("Statistics")); 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">'; 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>'; print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($mode == 'customer') $filter='s.client in (1,2,3)'; if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1'; 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>'; print '</td></tr>';
// User // User
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>'; print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';

View File

@ -87,7 +87,7 @@ class RejetPrelevement
dol_syslog("RejetPrelevement::Create id $id"); dol_syslog("RejetPrelevement::Create id $id");
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT; $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
$facs = $this->getListInvoices(); $facs = $this->getListInvoices(1);
$this->db->begin(); $this->db->begin();
@ -132,7 +132,7 @@ class RejetPrelevement
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
$fac = new Facture($this->db); $fac = new Facture($this->db);
$fac->fetch($facs[$i]); $fac->fetch($facs[$i][0]);
// Make a negative payment // Make a negative payment
$pai = new Paiement($this->db); $pai = new Paiement($this->db);
@ -144,7 +144,7 @@ class RejetPrelevement
* PHP installs sends only the part integer negative * 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->datepaye = $date_rejet;
$pai->paiementid = 3; // type of payment: withdrawal $pai->paiementid = 3; // type of payment: withdrawal
$pai->num_paiement = $fac->ref; $pai->num_paiement = $fac->ref;
@ -152,7 +152,7 @@ class RejetPrelevement
if ($pai->create($this->user) < 0) // we call with no_commit if ($pai->create($this->user) < 0) // we call with no_commit
{ {
$error++; $error++;
dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i]); dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
} }
else else
{ {
@ -270,21 +270,23 @@ 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; global $conf;
$arr = array(); $arr = array();
//Returns all invoices of a withdrawal //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.= " 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.= " WHERE pf.fk_prelevement_lignes = ".$this->id;
$sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -298,7 +300,14 @@ class RejetPrelevement
while ($i < $num) while ($i < $num)
{ {
$row = $this->db->fetch_row($resql); $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++; $i++;
} }
} }

View File

@ -33,21 +33,23 @@ $id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db);
/* /*
* View * View
*/ */
$form = new Form($db);
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'); llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db); if ($id > 0)
{
$contact = new Contact($db);
$contact->fetch($id, $user); $contact->fetch($id, $user);
$head = contact_prepare_head($contact); $head = contact_prepare_head($contact);
dol_fiche_head($head, 'exportimport', $title, 0, 'contact'); dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
@ -103,9 +105,7 @@ print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$contact->id.'">';
print img_picto($langs->trans("VCard"),'vcard.png').' '; print img_picto($langs->trans("VCard"),'vcard.png').' ';
print $langs->trans("VCard"); print $langs->trans("VCard");
print '</a>'; print '</a>';
}
$db->close(); $db->close();

View File

@ -35,6 +35,8 @@ $contactid = GETPOST("id",'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe'); $result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
$contact = new Contact($db);
/* /*
@ -43,9 +45,10 @@ $result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'); llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
if ($contactid > 0)
{
$result = $contact->fetch($contactid, $user);
$contact = new Contact($db);
$contact->fetch($contactid, $user);
$contact->info($contactid); $contact->info($contactid);
@ -60,6 +63,7 @@ print '</td></tr></table>';
dol_print_object_info($contact); dol_print_object_info($contact);
print "</div>"; print "</div>";
}
llxFooter(); llxFooter();

View File

@ -40,8 +40,10 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db); $contact = new Contact($db);
$contact->fetch($id, $user);
if ($id > 0)
{
$contact->fetch($id, $user);
/* /*
* Actions * Actions
@ -73,18 +75,21 @@ if ($action == 'dolibarr2ldap')
$db->rollback(); $db->rollback();
} }
} }
}
/* /*
* View * View
*/ */
$form = new Form($db);
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'); llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db); if ($id > 0)
{
$head = contact_prepare_head($contact); $head = contact_prepare_head($contact);
dol_fiche_head($head, 'ldap', $title, 0, 'contact'); dol_fiche_head($head, 'ldap', $title, 0, 'contact');
@ -207,7 +212,7 @@ else
print '</table>'; print '</table>';
}
$db->close(); $db->close();

View File

@ -38,14 +38,16 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db); $object = new Contact($db);
$result = $object->fetch($id, $user);
if ($id > 0)
{
/* /*
* Action * Action
*/ */
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer) if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
{ {
$ret = $object->fetch($id);
// Note: Correct date should be completed with location to have exact GM time of birth. // 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 = dol_mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
$object->birthday_alert = $_POST["birthday_alert"]; $object->birthday_alert = $_POST["birthday_alert"];
@ -61,22 +63,22 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
$error = $object->error; $error = $object->error;
} }
} }
}
/* /*
* View * View
*/ */
$form = new Form($db);
$now=dol_now(); $now=dol_now();
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas'); llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
$form = new Form($db); if ($id > 0)
{
$object->fetch($id, $user);
$head = contact_prepare_head($object); $head = contact_prepare_head($object);
dol_fiche_head($head, 'perso', $title, 0, 'contact'); dol_fiche_head($head, 'perso', $title, 0, 'contact');
@ -244,6 +246,7 @@ if ($action != 'edit')
print "</div>"; print "</div>";
} }
} }
}
llxFooter(); llxFooter();

View File

@ -35,6 +35,9 @@ $id = GETPOST('id', 'int');
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db); $contact = new Contact($db);
if ($id > 0)
{
$result=$contact->fetch($id); $result=$contact->fetch($id);
$physicalperson=1; $physicalperson=1;
@ -100,4 +103,5 @@ header("Connection: close");
header("Content-Type: text/x-vcard; name=\"".$filename."\""); header("Content-Type: text/x-vcard; name=\"".$filename."\"");
print $output; print $output;
}

View File

@ -847,7 +847,7 @@ class Form
$out.= '<option value="'.$obj->rowid.'">'.$label.'</option>'; $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++; $i++;
if (($i % 10) == 0) $out.="\n"; if (($i % 10) == 0) $out.="\n";

View File

@ -150,7 +150,7 @@ class vCard
{ {
$this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); $this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
$this->filename = "$first%20$family.vcf"; $this->filename = "$first%20$family.vcf";
if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix")); if (empty($this->properties["FN"])) $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
} }
/** /**

View File

@ -186,7 +186,7 @@ if ($type_element == 'order')
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_commande = c.rowid"; $where.= " AND d.fk_commande = c.rowid";
$where.= " AND c.entity = ".$conf->entity; $where.= " AND c.entity = ".$conf->entity;
$dateprint = 'c.datef'; $datePrint = 'c.date_commande';
$doc_number='c.ref'; $doc_number='c.ref';
$thirdTypeSelect='customer'; $thirdTypeSelect='customer';
} }

View File

@ -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 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('infothirdparty')); $hookmanager->initHooks(array('infothirdparty'));
$soc = new Societe($db);
/* /*
@ -59,8 +60,10 @@ $error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->e
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty"),$help_url); llxHeader('',$langs->trans("ThirdParty"),$help_url);
$soc = new Societe($db); if ($socid > 0)
$soc->fetch($socid); {
$result = $soc->fetch($socid);
$soc->info($socid); $soc->info($socid);
/* /*
@ -71,13 +74,12 @@ $head = societe_prepare_head($soc);
dol_fiche_head($head, 'info', $langs->trans("ThirdParty"), 0, 'company'); dol_fiche_head($head, 'info', $langs->trans("ThirdParty"), 0, 'company');
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($soc); dol_print_object_info($soc);
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>'; dol_fiche_end();
}
llxFooter(); llxFooter();

View File

@ -1025,6 +1025,7 @@ else
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $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 $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)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print $object->showOptionals($extrafields,'edit'); print $object->showOptionals($extrafields,'edit');
@ -1436,6 +1437,7 @@ else
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $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 $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)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print $object->showOptionals($extrafields,'edit'); print $object->showOptionals($extrafields,'edit');