diff --git a/ChangeLog b/ChangeLog index 8f822d08771..f83979aa8e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.6.4 compared to 3.6.3 ***** +- Fix: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask + ***** ChangeLog for 3.6.3 compared to 3.6.2 ***** - Fix: ref_ext was not saved when recording a customer order from web service - Fix: amarok is a bugged theme making dolidroid failed. We switch to eldy automatically with dolidroid. @@ -38,6 +41,11 @@ English Dolibarr ChangeLog - Fix: [ bug #2542 ] Contracts store localtax preferences - Fix: Bad permission assignments for stock movements actions - Fix: [ bug #2891 ] Category hooks do not work +- Fix: [ bug #2696 ] Adding complementary attribute fails if code is numerics +- Fix: [ bug #3074 ] Accruals accounting use payment date instead of commitment date in turnover reports for salaries +- Fix: Not showing product supplier reference when page break +- Fix: [ bug #3341 ] Missing translation in /compta/paiement_charge.php +- Fix: [ bug #3342 ] Taxes dictionary page does not accept localized decimals for localtax2 rate ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. @@ -211,6 +219,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 diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index c667754d4ab..9db6f3a4da3 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -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; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 4a4e66e4ea5..38f991faf52 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -516,7 +516,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $i=0; foreach ($listfieldinsert as $f => $value) { - if ($value == 'price' || preg_match('/^amount/i',$value)) { + if ($value == 'price' || preg_match('/^amount/i',$value) || preg_match('/^localtax/i',$value) || $value == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } else if ($value == 'entity') { @@ -564,7 +564,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $i = 0; foreach ($listfieldmodify as $field) { - if ($field == 'price' || preg_match('/^amount/i',$field)) { + if ($field == 'price' || preg_match('/^amount/i',$field) || preg_match('/^localtax/i',$field) || $field == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } else if ($field == 'entity') { @@ -1080,17 +1080,20 @@ if ($id) $align="center"; } else if ($fieldlist[$field]=='localtax1') { + $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); if ($obj->localtax1 == 0) $valuetoshow = ''; $align="right"; } else if ($fieldlist[$field]=='localtax2') { + $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); if ($obj->localtax2 == 0) $valuetoshow = ''; $align="right"; } else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) { + $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $align="right"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 84b0f65d679..483b6ec8258 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -535,13 +535,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) @@ -2862,10 +2863,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; } } @@ -2893,11 +2896,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; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cac43ced746..95441e5f257 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2403,13 +2403,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) @@ -3218,10 +3219,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; } } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 6d1e417f4ea..cecb76703dd 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1133,7 +1133,6 @@ class AccountLine extends CommonObject } else { - dol_print_error($this->db); return -1; } } diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index bdb30e46528..428112f7289 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -419,7 +419,7 @@ else // State print ''.$langs->trans('State').''; - if ($account->fk_departement > 0) print getState($account->fk_departement); + if ($account->state_id > 0) print getState($account->state_id); print ''; // Conciliate diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 63cdcaeb865..72103f6ac5a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2173,13 +2173,24 @@ class Facture extends CommonInvoice $pu_tva = $tabprice[4]; $pu_ttc = $tabprice[5]; - // Update line into database - $this->line=new FactureLigne($this->db); + // Old properties: $price, $remise (deprecated) + $price = $pu; + $remise = 0; + if ($remise_percent > 0) + { + $remise = round(($pu * $remise_percent / 100),2); + $price = ($pu - $remise); + } + $price = price2num($price); - // Stock previous line records - $staticline=new FactureLigne($this->db); - $staticline->fetch($rowid); - $this->line->oldline = $staticline; + //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); + + $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) @@ -2547,15 +2558,16 @@ class Facture extends CommonInvoice $numref = ""; $numref = $obj->getNextValue($soc,$this,$mode); - if ($numref != "") - { - return $numref; - } - else - { + /** + * $numref can be empty in case we ask for the last value because if there is no invoice created with the + * set up mask. + */ + if ($mode != 'last' && !$numref) { dol_print_error($db,"Facture::getNextNumRef ".$obj->error); return ""; } + + return $numref; } else { @@ -3436,10 +3448,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; } } @@ -3497,7 +3511,7 @@ class FactureLigne extends CommonInvoiceLine return -1; } } - + // POS or by external module, take lowest buying price if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 18aeaa722da..dab5631bab4 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -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 '
'; @@ -232,7 +239,7 @@ print '
'; print ''.$langs->trans("ThirdParty").''; 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 ''; // User print ''.$langs->trans("CreatedBy").''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 205aba9a778..66645f4affa 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -1,7 +1,8 @@ - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 RaphaĆ«l Doursenaud * * 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 @@ -574,7 +575,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $chargestatic->lib=$obj->libelle; $chargestatic->paye=$obj->paye; print ''.$chargestatic->getNomUrl(1).''; - print ''.dol_print_date($obj->date_ech,'day').''; + print ''.dol_print_date($db->jdate($obj->date_ech),'day').''; print ''.price($obj->amount).''; print ''.price($obj->sumpaid).''; print ''.$chargestatic->getLibStatut(3).''; @@ -915,7 +916,7 @@ if ($resql) $obj = $db->fetch_object($resql); $var=!$var; - print "".dol_print_date($obj->da,"day").""; + print "".dol_print_date($db->jdate($obj->da),"day").""; print "$obj->libelle $obj->label"; $i++; } diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index a54a0bcd935..a660259d706 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -178,7 +178,7 @@ if ($_GET["action"] == 'create') print ''; - print ""; + print ""; print ''; print '\n"; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 51f9a83ed3c..61e366d0ce5 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -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++; } } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 1e09ea0a8fe..7089652d3d3 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -543,17 +543,23 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti * Salaries */ +if ($modecompta == 'CREANCES-DETTES') { + $column = 'p.datev'; +} else { + $column = 'p.datep'; +} + print ''; -$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user"; +$sql = "SELECT p.label as nom, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; $sql.= " WHERE p.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) - $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; + $sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; $sql.= " GROUP BY u.rowid, p.label, p.datep, p.fk_user"; $sql.= " ORDER BY u.firstname"; - + dol_syslog("get payment salaries sql=".$sql); $result=$db->query($sql); $subtotal_ht = 0; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index fdc9b0472f0..32294b61bea 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -473,9 +473,16 @@ $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$acti /* * Salaries */ + +if ($modecompta == 'CREANCES-DETTES') { + $column = 'p.datev'; +} else { + $column = 'p.datep'; +} + $subtotal_ht = 0; $subtotal_ttc = 0; -$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql = "SELECT p.label as nom, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql.= " WHERE p.entity = ".$conf->entity; $sql.= " GROUP BY p.label, dm"; diff --git a/htdocs/contact/exportimport.php b/htdocs/contact/exportimport.php index bcb3b9c2be0..c76655f5099 100644 --- a/htdocs/contact/exportimport.php +++ b/htdocs/contact/exportimport.php @@ -33,80 +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 '
Charge
".$langs->trans('Charge')."
'.$langs->trans("Ref").''.$chid.'
'.$langs->trans("Type")."".$charge->type_libelle."
'.$langs->trans("Salaries").'
'; - -$linkback = ''.$langs->trans("BackToList").''; - -// Ref -print ''; - -// Name -print ''; -print ''; - -// 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 ''; - } - else - { - print ''; - } + $head = contact_prepare_head($contact); + + dol_fiche_head($head, 'exportimport', $title, 0, 'contact'); + + + /* + * Fiche en mode visu + */ + print '
'.$langs->trans("Ref").''; -print $form->showrefnav($contact, 'id', $linkback); -print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$contact->lastname.''.$langs->trans("Firstname").''.$contact->firstname.'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("Company").''; - print $langs->trans("ContactNotLinkedToCompany"); - print '
'; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Name + print ''; + print ''; + + // Company + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + if ($contact->socid > 0) + { + $objsoc = new Societe($db); + $objsoc->fetch($contact->socid); + + print ''; + } + else + { + print ''; + } + } + + // Civility + print ''; + + print '
'.$langs->trans("Ref").''; + print $form->showrefnav($contact, 'id', $linkback); + print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$contact->lastname.''.$langs->trans("Firstname").''.$contact->firstname.'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("Company").''; + print $langs->trans("ContactNotLinkedToCompany"); + print '
'.$langs->trans("UserTitle").''; + print $contact->getCivilityLabel(); + print '
'; + + print '
'; + + print '
'; + + print $langs->trans("ExportCardToFormat").': '; + print ''; + print img_picto($langs->trans("VCard"),'vcard.png').' '; + print $langs->trans("VCard"); + print ''; } -// Civility -print ''.$langs->trans("UserTitle").''; -print $contact->getCivilityLabel(); -print ''; - -print ''; - -print '
'; - -print '
'; - -print $langs->trans("ExportCardToFormat").': '; -print ''; -print img_picto($langs->trans("VCard"),'vcard.png').' '; -print $langs->trans("VCard"); -print ''; - - - - $db->close(); llxFooter(); diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php index 51a80d8d994..5d4904faa87 100644 --- a/htdocs/contact/info.php +++ b/htdocs/contact/info.php @@ -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,23 +45,25 @@ $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 '
'; -print '
'; + print '
'; + print '
'; -dol_print_object_info($contact); + dol_print_object_info($contact); -print "
"; + print "
"; +} llxFooter(); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 1681324323a..79e6246fc60 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -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.='
'.$langs->trans("ContactSynchronized").'
'; - $db->commit(); - } - else - { - $message.='
'.$ldap->error.'
'; - $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.='
'.$langs->trans("ContactSynchronized").'
'; + $db->commit(); + } + else + { + $message.='
'.$ldap->error.'
'; + $db->rollback(); + } } } @@ -79,135 +82,137 @@ 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 ''; - -// Ref -print ''; - -// Name -print ''; -print ''; - -// Company -if ($contact->socid > 0) +if ($id > 0) { - $objsoc = new Societe($db); - $objsoc->fetch($contact->socid); + $head = contact_prepare_head($contact); - print ''; -} -else -{ - print '
'.$langs->trans("Ref").''; -print $form->showrefnav($contact,'id'); -print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$contact->lastname.''.$langs->trans("Firstname").''.$contact->firstname.'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("Company").''; - print $langs->trans("ContactNotLinkedToCompany"); + dol_fiche_head($head, 'ldap', $title, 0, 'contact'); + + + print ''; + + // Ref + print ''; -} -// Civility -print ''; + // Name + print ''; + print ''; -// LDAP DN -print '\n"; - -// LDAP Cle -print '\n"; - -// LDAP Server -print '\n"; -print '\n"; -print '\n"; - -print '
'.$langs->trans("Ref").''; + print $form->showrefnav($contact,'id'); print '
'.$langs->trans("UserTitle").''; -print $contact->getCivilityLabel(); -print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$contact->lastname.''.$langs->trans("Firstname").''.$contact->firstname.'
LDAP '.$langs->trans("LDAPContactDn").''.$conf->global->LDAP_CONTACT_DN."
LDAP '.$langs->trans("LDAPNamingAttribute").''.$conf->global->LDAP_KEY_CONTACTS."
LDAP '.$langs->trans("LDAPPrimaryServer").''.$conf->global->LDAP_SERVER_HOST."
LDAP '.$langs->trans("LDAPSecondaryServer").''.$conf->global->LDAP_SERVER_HOST_SLAVE."
LDAP '.$langs->trans("LDAPServerPort").''.$conf->global->LDAP_SERVER_PORT."
'; - -print ''; - - -dol_htmloutput_mesg($message); - - -/* - * Barre d'actions - */ - -print '
'; - -if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') -{ - print ''.$langs->trans("ForceSynchronize").''; -} - -print "
\n"; - -if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') print "
\n"; - - - -// Affichage attributs LDAP -print_titre($langs->trans("LDAPInformationsForThisContact")); - -print ''; - -print ''; -print ''; -print ''; -print ''; - -// 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 ''; - } - else - { - $result=show_ldap_content($records,0,$records['count'],true); - } + $objsoc = new Societe($db); + $objsoc->fetch($contact->socid); + + print ''; } else { - print ''; + print ''; } - $ldap->unbind(); - $ldap->close(); + // Civility + print ''; + + // LDAP DN + print '\n"; + + // LDAP Cle + print '\n"; + + // LDAP Server + print '\n"; + print '\n"; + print '\n"; + + print '
'.$langs->trans("LDAPAttributes").''.$langs->trans("Value").'
'.$langs->trans("ErrorFailedToReadLDAP").'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')
'.$langs->trans("Company").''; + print $langs->trans("ContactNotLinkedToCompany"); + print '
'.$langs->trans("UserTitle").''; + print $contact->getCivilityLabel(); + print '
LDAP '.$langs->trans("LDAPContactDn").''.$conf->global->LDAP_CONTACT_DN."
LDAP '.$langs->trans("LDAPNamingAttribute").''.$conf->global->LDAP_KEY_CONTACTS."
LDAP '.$langs->trans("LDAPPrimaryServer").''.$conf->global->LDAP_SERVER_HOST."
LDAP '.$langs->trans("LDAPSecondaryServer").''.$conf->global->LDAP_SERVER_HOST_SLAVE."
LDAP '.$langs->trans("LDAPServerPort").''.$conf->global->LDAP_SERVER_PORT."
'; + + print ''; + + + dol_htmloutput_mesg($message); + + + /* + * Barre d'actions + */ + + print '
'; + + if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') + { + print ''.$langs->trans("ForceSynchronize").''; + } + + print "
\n"; + + if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr') print "
\n"; + + + + // Affichage attributs LDAP + print_titre($langs->trans("LDAPInformationsForThisContact")); + + print ''; + + print ''; + print ''; + print ''; + print ''; + + // 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 ''; + } + else + { + $result=show_ldap_content($records,0,$records['count'],true); + } + } + else + { + print ''; + } + + $ldap->unbind(); + $ldap->close(); + } + else + { + dol_print_error('',$ldap->error); + } + + + print '
'.$langs->trans("LDAPAttributes").''.$langs->trans("Value").'
'.$langs->trans("ErrorFailedToReadLDAP").'
'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')
'; + } -else -{ - dol_print_error('',$ldap->error); -} - - -print '
'; - - $db->close(); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 92ba03e9861..bd74fc75ef8 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -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 '
'; - print ''; - print ''; - print ''; + dol_fiche_head($head, 'perso', $title, 0, 'contact'); - print ''; - - // Ref - print ''; - - // Name - print ''; - print ''; - - // Company - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + if ($action == 'edit') { - if ($object->socid > 0) + /* + * Fiche en mode edition + */ + + print ''; + print ''; + print ''; + print ''; + + print '
'.$langs->trans("Ref").''; - print $object->id; - print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.''.$langs->trans("Firstname").''.$object->firstname.'
'; + + // Ref + print ''; + + // Name + print ''; + print ''; + + // 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 ''; - } - else - { - print ''; - } - } - - // Civility - print ''; - - // Date To Birth - print ''; - - print ''; - } - else - { - print ''; - } - print ''; - - print "
'.$langs->trans("Ref").''; + print $object->id; + print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.''.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("Company").''; - print $langs->trans("ContactNotLinkedToCompany"); - print '
'.$langs->trans("UserTitle").''; - print $object->getCivilityLabel(); - print '
'.$langs->trans("DateToBirth").''; - $form=new Form($db); - print $form->select_date($object->birthday,'birthday',0,0,1,"perso"); - print ''.$langs->trans("Alert").': '; - if (! empty($object->birthday_alert)) - { - print '

"; - - print '
'; - print ''; - print '   '; - print ''; - print '
'; - - print "
"; -} -else -{ - /* - * Fiche en mode visu - */ - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Name - print ''; - print ''; - - // Company - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) - { - if ($object->socid > 0) - { - $objsoc = new Societe($db); - $objsoc->fetch($object->socid); - - print ''; + print ''; + } + else + { + print ''; + } } - else - { - print ''; - } - } + // Civility + print ''; - // Civility - print ''; - - // Date To Birth - print ''; - if (! empty($object->birthday)) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - - print ''; + + print ''; + } + else + { + print ''; + } + print ''; + + print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback); - print '
'.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.''.$langs->trans("Firstname").''.$object->firstname.'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("Company").''.$objsoc->getNomUrl(1).'
'.$langs->trans("Company").''; + print $langs->trans("ContactNotLinkedToCompany"); + print '
'.$langs->trans("Company").''; - print $langs->trans("ContactNotLinkedToCompany"); - print '
'.$langs->trans("UserTitle").''; + print $object->getCivilityLabel(); + print '
'.$langs->trans("UserTitle").''; - print $object->getCivilityLabel(); - print '
'.$langs->trans("DateToBirth").''.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 '
'.$langs->trans("DateToBirth").''; + $form=new Form($db); + print $form->select_date($object->birthday,'birthday',0,0,1,"perso"); print ''.$langs->trans("Alert").': '; + if (! empty($object->birthday_alert)) + { + print '

"; + + print '
'; + print ''; + print '   '; + print ''; + print '
'; + + print ""; } else { - print ''.$langs->trans("DateToBirth").''.$langs->trans("Unknown").""; - } - print ""; + /* + * Fiche en mode visu + */ + print ''; - print "
"; + $linkback = ''.$langs->trans("BackToList").''; -} + // Ref + print ''.$langs->trans("Ref").''; + print $form->showrefnav($object, 'id', $linkback); + print ''; -dol_fiche_end(); + // Name + print ''.$langs->trans("Lastname").' / '.$langs->trans("Label").''.$object->lastname.''; + print ''.$langs->trans("Firstname").''.$object->firstname.''; -if ($action != 'edit') -{ - // Barre d'actions - if ($user->societe_id == 0) - { - print '
'; - - if ($user->rights->societe->contact->creer) + // Company + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - print ''.$langs->trans('Modify').''; + if ($object->socid > 0) + { + $objsoc = new Societe($db); + $objsoc->fetch($object->socid); + + print ''.$langs->trans("Company").''.$objsoc->getNomUrl(1).''; + } + + else + { + print ''.$langs->trans("Company").''; + print $langs->trans("ContactNotLinkedToCompany"); + print ''; + } } - print "
"; + // Civility + print ''.$langs->trans("UserTitle").''; + print $object->getCivilityLabel(); + print ''; + + // Date To Birth + print ''; + if (! empty($object->birthday)) + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + + print ''.$langs->trans("DateToBirth").''.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 ''; + } + else + { + print ''.$langs->trans("DateToBirth").''.$langs->trans("Unknown").""; + } + print ""; + + print ""; + + } + + dol_fiche_end(); + + if ($action != 'edit') + { + // Barre d'actions + if ($user->societe_id == 0) + { + print '
'; + + if ($user->rights->societe->contact->creer) + { + print ''.$langs->trans('Modify').''; + } + + print "
"; + } } } diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index e78c298c541..1a69eaeb80e 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -35,69 +35,73 @@ $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; - diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 89edfcbae8e..d547d635855 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -118,7 +118,7 @@ if ($action == 'add') if (! $error) { // attrname must be alphabetical and lower case only - if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname'])) + if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname']) && !is_numeric($_POST["attrname"])) { // Construct array for parameter (value of select list) $default_value = GETPOST('default_value'); diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 6d62989727b..294178eb7b0 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -136,7 +136,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")); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 39639a7783e..902fff35bcb 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -847,7 +847,7 @@ class Form $out.= ''; } - 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"; diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 512aa011d98..f0da8530ac2 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -150,7 +150,7 @@ class vCard { $this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); $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")); } /** diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 92489cd9d61..544984b9c5a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -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->don->enabled) || ! empty($conf->tax->enabled) || ! empty($conf->salaries->enabled) || ! empty($conf->fournisseur->enabled)), - 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire)), - 'module'=>'comptabilite|accounting|facture|don|tax|salaries'); + $tmpentry=array( + 'enabled' => (! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled) || ! empty($conf->margin->enabled) || ! empty($conf->salaries->enabled) || ! empty($conf->fournisseur->enabled)), + 'perms' => (! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || !empty($user->rights->margins->liretous) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire)), + 'module' => 'comptabilite|accounting|facture|don|tax|salaries|margin' + ); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) { diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 8b636fd247f..3504c99e1d1 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1013,7 +1013,6 @@ abstract class DolibarrModules $this->db->begin(); - //var_dump($this->menu); exit; foreach ($this->menu as $key => $value) { $menu = new Menubase($this->db); @@ -1022,11 +1021,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 diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 4124d4745f6..e45f45cb79b 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -301,7 +301,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pageposafter=$pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,1); $posyafter=$pdf->GetY(); if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text { diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 83d1aac952b..5376d7fcd27 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -309,7 +309,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pageposafter=$pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,1); $posyafter=$pdf->GetY(); if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index ce9885c1f1a..2e591bf67be 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1105,6 +1105,8 @@ class Expedition extends CommonObject $obj = $this->db->fetch_object($resql); $line->line_id = $obj->line_id; + $line->rowid = $obj->line_id; // TODO deprecated + $line->id = $obj->line_id; $line->fk_origin_line = $obj->fk_origin_line; $line->origin_line_id = $obj->fk_origin_line; // TODO deprecated $line->entrepot_id = $obj->fk_entrepot; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 73f3ae3e77a..0e23287ac31 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -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.6.4'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.5'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z new file mode 100755 index 00000000000..df25b6497f0 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z new file mode 100755 index 00000000000..2053dd16f03 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z new file mode 100755 index 00000000000..71cef637e83 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z new file mode 100755 index 00000000000..af54a16a09a Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z new file mode 100755 index 00000000000..23445ef2f4b Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z new file mode 100755 index 00000000000..37da24ac6a9 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z new file mode 100755 index 00000000000..1b98d135f68 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z new file mode 100755 index 00000000000..aa35d093a84 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z new file mode 100755 index 00000000000..d5fff04b704 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansextralight.z b/htdocs/includes/tcpdf/fonts/dejavusansextralight.z new file mode 100755 index 00000000000..a966f6de5c4 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansextralight.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z new file mode 100755 index 00000000000..209e2d50b74 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmono.z b/htdocs/includes/tcpdf/fonts/dejavusansmono.z new file mode 100755 index 00000000000..126cc9228fe Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmono.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z new file mode 100755 index 00000000000..76b78bc8f8b Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonob.z b/htdocs/includes/tcpdf/fonts/dejavusansmonob.z new file mode 100755 index 00000000000..ef5638e2510 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonob.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z new file mode 100755 index 00000000000..aa6da414977 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z new file mode 100755 index 00000000000..a866f79821a Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z new file mode 100755 index 00000000000..0fa53ab2eff Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z new file mode 100755 index 00000000000..14be5c14e57 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z differ diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 4f5ac8fb9ec..e4e35c2653a 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -65,7 +65,7 @@ ErrorNoValueForCheckBoxType=Please fill value for checkbox list ErrorNoValueForRadioType=Please fill value for radio list ErrorBadFormatValueList=The list value cannot have more than one come : %s, but need at least one: llave,valores ErrorFieldCanNotContainSpecialCharacters=Field %s must not contains special characters. -ErrorFieldCanNotContainSpecialNorUpperCharacters=Field %s must not contains special characters, nor upper case characters. +ErrorFieldCanNotContainSpecialNorUpperCharacters=Field %s must not contain special characters, nor upper case characters and cannot contain only numbers. ErrorNoAccountancyModuleLoaded=No accountancy module activated ErrorExportDuplicateProfil=This profile name already exists for this export set. ErrorLDAPSetupNotComplete=Dolibarr-LDAP matching is not complete. diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 34aea94e70f..b1328fbff66 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -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 diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index b8d5f7f66ba..88b97df78fc 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -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']); /* diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 678660b7e6f..dbf8e45044a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -770,7 +770,8 @@ class Task extends CommonObject { $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time"); $ret = $tasktime_id; - + $this->timespent_id = $ret; + if (! $notrigger) { // Call triggers diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index a22a49e35eb..6b1f1bc53f4 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -186,7 +186,7 @@ if ($type_element == 'order') $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; $where.= " AND c.entity = ".$conf->entity; - $dateprint = 'c.datef'; + $datePrint = 'c.date_commande'; $doc_number='c.ref'; $thirdTypeSelect='customer'; } diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php index 0deec041932..d4c030f7664 100644 --- a/htdocs/societe/info.php +++ b/htdocs/societe/info.php @@ -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,25 +60,26 @@ $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 '
'; + dol_print_object_info($soc); + print '
'; -print '
'; -dol_print_object_info($soc); -print '
'; - -print ''; - + dol_fiche_end(); +} llxFooter(); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index a6ecf470d38..df0222fbde1 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1025,6 +1025,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'); @@ -1436,6 +1437,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');