Skip to content

Commit

Permalink
Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
FHenry committed Mar 7, 2016
2 parents 50decb3 + 7a65ebe commit 002a388
Show file tree
Hide file tree
Showing 21 changed files with 135 additions and 73 deletions.
2 changes: 1 addition & 1 deletion htdocs/categories/class/categorie.class.php
Expand Up @@ -1241,7 +1241,7 @@ function containing($id,$type,$mode='object')

$sql = "SELECT ct.fk_categorie, c.label, c.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c";
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type];
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type];
$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";

$res = $this->db->query($sql);
Expand Down
16 changes: 7 additions & 9 deletions htdocs/compta/prelevement/class/bonprelevement.class.php
Expand Up @@ -1262,26 +1262,24 @@ function generate()
$fileDebiteurSection = '';
$fileEmetteurSection = '';
$i = 0;
$j = 0;
$this->total = 0;

/*
* section Debiteur (sepa Debiteurs bloc lines)
*/

$tmp_invoices = array();

$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
while ($j < $num)
{
$objfac = $this->db->fetch_object($resql);
$ListOfFactures = $ListOfFactures . $objfac->fac . ",";
$j++;
if ($resql) {
while ($objfac = $this->db->fetch_object($resql)) {
$tmp_invoices[] = $objfac->fac;
}
}

$ListOfFactures = implode($tmp_invoices);

$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/contrat/card.php
Expand Up @@ -1643,7 +1643,7 @@
{
$tmpaction='activateline';
if ($objp->statut == 4) $tmpaction='unactivateline';
if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->unactiver)) {
if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) {
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;ligne=' . $object->lines[$cursorline - 1]->id . '&amp;action=' . $tmpaction . '">';
print img_edit();
print '</a>';
Expand Down
Expand Up @@ -273,7 +273,9 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
Expand Down
Expand Up @@ -239,7 +239,9 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
Expand Down
Expand Up @@ -239,7 +239,9 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
Expand Down
Expand Up @@ -240,7 +240,9 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
Expand Down
Expand Up @@ -449,7 +449,9 @@ function write_file($object,$outputlangs,$srctemplatepath)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
Expand Down
Expand Up @@ -273,7 +273,9 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
Expand Down
8 changes: 7 additions & 1 deletion htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
Expand Up @@ -209,9 +209,15 @@ function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidede
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
// Get extension (ods or odt)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME))
{
$newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)).'-'.$newfiletmp;
}
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{
Expand Down
42 changes: 24 additions & 18 deletions htdocs/fichinter/card.php
Expand Up @@ -116,17 +116,20 @@

if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs);

header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
Expand All @@ -142,17 +145,20 @@
$result = $object->setDraft($user);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs);

header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/class/fournisseur.commande.class.php
Expand Up @@ -583,7 +583,7 @@ function getNomUrl($withpicto=0,$option='')
if (! empty($this->total_ht))
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('TVA') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_ttc))
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);

Expand Down
6 changes: 0 additions & 6 deletions htdocs/fourn/facture/card.php
Expand Up @@ -1655,12 +1655,6 @@
if ($objectref == 'PROV')
{
$savdate=$object->date;
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION))
{
$object->date=dol_now();
//TODO: Possibly will have to control payment information into suppliers
//$object->date_lim_reglement=$object->calculate_date_lim_reglement();
}
$numref = $object->getNextNumRef($societe);
}
else
Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/facture/list.php
Expand Up @@ -304,7 +304,7 @@
print '<input class="flat" type="text" size="6" name="search_amount_all_tax" value="'.$search_amount_all_tax.'">';
print '</td><td class="liste_titre" align="right">';
$liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid"));
print $form->selectarray('filtre', $liststatus, $search_status, 1);
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print '</td><td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
Expand Down
3 changes: 3 additions & 0 deletions htdocs/langs/en_US/admin.lang
Expand Up @@ -582,6 +582,7 @@ Permission38=Export products
Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed on assigned tasks (timesheet)
Permission42=Create/modify projects (shared project and projects i'm contact for)
Permission44=Delete projects (shared project and projects i'm contact for)
Permission45=Export projects
Permission61=Read interventions
Permission62=Create/modify interventions
Permission64=Delete interventions
Expand Down Expand Up @@ -635,6 +636,7 @@ Permission162=Create/modify contracts/subscriptions
Permission163=Activate a service/subscription of a contract
Permission164=Disable a service/subscription of a contract
Permission165=Delete contracts/subscriptions
Permission167=Export contracts
Permission171=Read trips and expenses (yours and your subordinates)
Permission172=Create/modify trips and expenses
Permission173=Delete trips and expenses
Expand Down Expand Up @@ -783,6 +785,7 @@ Permission2403=Delete actions (events or tasks) linked to his account
Permission2411=Read actions (events or tasks) of others
Permission2412=Create/modify actions (events or tasks) of others
Permission2413=Delete actions (events or tasks) of others
Permission2414=Export actions/tasks of others
Permission2501=Read/Download documents
Permission2502=Download documents
Permission2503=Submit or delete documents
Expand Down
7 changes: 4 additions & 3 deletions htdocs/langs/fr_FR/admin.lang
Expand Up @@ -583,6 +583,7 @@ Permission38=Exporter les produits
Permission41=Lire les projets et les tâches (projets publiques et projets dont je suis contact). Peut également entrer le temps consommé sur les tâches assignées (feuille de temps)
Permission42=Créer/modifier les projets et tâches (partagés ou dont je suis contact)
Permission44=Supprimer les projets et tâches (partagés ou dont je suis contact)
Permission45=Exporter les projets
Permission61=Consulter les interventions
Permission62=Créer/modifier les interventions
Permission64=Supprimer les interventions
Expand Down Expand Up @@ -772,8 +773,8 @@ Permission20001=Lire les demandes de congé (les vôtres et celle de vos subordo
Permission20002=Créer/modifier vos demandes de congé
Permission20003=Supprimer les demandes de congé
Permission20004=Lire toutes les demandes de congé (même celle des utilisateurs non subordonnés)
Permission20005=Create/modify leave requests for everybody
Permission20006=Admin leave requests (setup and update balance)
Permission20005=Créer/modifier les congés pour tout le monde
Permission20006=Administration des demandes de congés (configuration et mise à jour du solde)
Permission23001=Voir les travaux planifiés
Permission23002=Créer/Modifier des travaux planifiées
Permission23003=Effacer travail planifié
Expand Down Expand Up @@ -1660,7 +1661,7 @@ NotSupportedByAllThemes=Fonctionne avec le thème eldy mais n'est pas pris en ch
BackgroundColor=Couleur de fond
TopMenuBackgroundColor=Couleur de fond pour le menu Gauche
LeftMenuBackgroundColor=Couleur de fond pour le menu Gauche
BackgroundTableTitleColor=Background color for Table title line
BackgroundTableTitleColor=Couleur de fond pour les titres des lignes des tables
BackgroundTableLineOddColor=Couleur de fond pour les lignes impaires des tables
BackgroundTableLineEvenColor=Couleur de fond pour les lignes paires des tales
MinimumNoticePeriod=Période de préavis minimum (Votre demande de congé doit être faite avant ce délai)
Expand Down
4 changes: 2 additions & 2 deletions htdocs/langs/fr_FR/products.lang
Expand Up @@ -240,8 +240,8 @@ ProductUsedForBuild=Consommé automatiquement par la fabrication
ProductBuilded=Fabrication terminée
ProductsMultiPrice=Produits multi-prix
ProductsOrServiceMultiPrice=Prix clients (des produits ou services, multi-prix)
ProductSellByQuarterHT=Products turnover quarterly before tax
ServiceSellByQuarterHT=Services turnover quarterly before tax
ProductSellByQuarterHT=Chiffre d'affaires trimestriel des produits hors taxes
ServiceSellByQuarterHT=Chiffre d'affaires trimestriel des services hors taxes
Quarter1=1er trimestre
Quarter2=2eme trimestre
Quarter3=3eme trimestre
Expand Down
4 changes: 3 additions & 1 deletion htdocs/product/admin/product.php
Expand Up @@ -56,7 +56,9 @@
}

// Clean param
if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) $conf->global->PRODUIT_MULTIPRICES_LIMIT = 5;
if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) {
dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity);
}



Expand Down
17 changes: 13 additions & 4 deletions htdocs/societe/class/societe.class.php
Expand Up @@ -4,7 +4,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
Expand Down Expand Up @@ -1660,10 +1660,19 @@ function getSalesRepresentatives(User $user)

$reparray=array();

$sql = "SELECT u.rowid, u.lastname, u.firstname, u.email";
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.email";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = sc.fk_user AND sc.fk_soc =".$this->id;
$sql.= " AND entity in (0, ".$conf->entity.")";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
{
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE ((ug.fk_user = sc.fk_user";
$sql.= " AND ug.entity = ".$conf->entity.")";
$sql.= " OR u.admin = 1)";
}
else
$sql.= " WHERE entity in (0, ".$conf->entity.")";

$sql.= " AND u.rowid = sc.fk_user AND sc.fk_soc =".$this->id;

$resql = $this->db->query($sql);
if ($resql)
Expand Down

0 comments on commit 002a388

Please sign in to comment.